diff --git a/apps/api/src/collectors/proxmox.ts b/apps/api/src/collectors/proxmox.ts index d863281..f98087f 100644 --- a/apps/api/src/collectors/proxmox.ts +++ b/apps/api/src/collectors/proxmox.ts @@ -15,10 +15,11 @@ interface ProxmoxConfig { interface ProxmoxNodeStatus { cpu: number; - mem: number; - maxmem: number; - disk: number; - maxdisk: number; + // Unlike the LXC listing endpoint, /nodes/{node}/status nests these instead + // of using flat mem/maxmem/disk/maxdisk — mixing the two shapes up silently + // produced NaN (serialized as null over JSON) instead of throwing. + memory: { total: number; used: number }; + rootfs: { total: number; used: number }; uptime: number; } @@ -73,12 +74,12 @@ export class ProxmoxCollector implements Collector { group: "Proxmox Host", status: "up", cpuPct: round(nodeStatus.cpu * 100), - memPct: round((nodeStatus.mem / nodeStatus.maxmem) * 100), - diskPct: round((nodeStatus.disk / nodeStatus.maxdisk) * 100), + memPct: round((nodeStatus.memory.used / nodeStatus.memory.total) * 100), + diskPct: round((nodeStatus.rootfs.used / nodeStatus.rootfs.total) * 100), memPressurePct: null, cpuPressurePct: null, uptimeSec: nodeStatus.uptime, - meta: { maxmem: nodeStatus.maxmem, maxdisk: nodeStatus.maxdisk }, + meta: { maxmem: nodeStatus.memory.total, maxdisk: nodeStatus.rootfs.total }, }); for (const ct of lxcs) {