Read-only Proxmox storage health (same PROXMOX_RO_TOKEN as the cluster card): ZFS pool health+usage, dropped zfspool storages (the donatello/leonardo SATA signal), and per-LXC rootfs fill, with a HEALTHY/WATCH/ATTENTION roll-up. Closes the monitoring gap from the 2026-06-09 audit (C1 + H2 were invisible). Pure normalizeStorage() unit-tested (4 tests). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
18 lines
622 B
JavaScript
18 lines
622 B
JavaScript
import { Router } from 'express';
|
|
import { asyncWrap } from '../errors.js';
|
|
import { storageHealth } from '../../proxmox/storage.js';
|
|
|
|
// Read-only storage/capacity health for the Sacred Valley card. Cached briefly so
|
|
// multiple polling clients coalesce into one set of PVE calls. Owner or any authed agent.
|
|
export const router = Router();
|
|
|
|
let cache = { at: 0, data: null };
|
|
const TTL = 15_000;
|
|
|
|
router.get('/', asyncWrap(async (_req, res) => {
|
|
if (cache.data && Date.now() - cache.at < TTL) return res.json(cache.data);
|
|
const data = await storageHealth();
|
|
cache = { at: Date.now(), data };
|
|
res.json(data);
|
|
}));
|