fix: ProxmoxCollector read wrong shape for node mem/disk
CI / web (push) Successful in 18s
CI / api (push) Successful in 24s

/nodes/{node}/status nests memory/rootfs objects; the LXC listing
endpoint uses flat mem/maxmem/disk/maxdisk. Code assumed the LXC
shape for both, so the Proxmox host's own memPct/diskPct were NaN ->
serialized as null the whole time. Found while checking sparkline
history data looked wrong for the host card specifically.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 21:34:10 -06:00
parent f3ee4c2424
commit 27c83d52b2
+8 -7
View File
@@ -15,10 +15,11 @@ interface ProxmoxConfig {
interface ProxmoxNodeStatus { interface ProxmoxNodeStatus {
cpu: number; cpu: number;
mem: number; // Unlike the LXC listing endpoint, /nodes/{node}/status nests these instead
maxmem: number; // of using flat mem/maxmem/disk/maxdisk — mixing the two shapes up silently
disk: number; // produced NaN (serialized as null over JSON) instead of throwing.
maxdisk: number; memory: { total: number; used: number };
rootfs: { total: number; used: number };
uptime: number; uptime: number;
} }
@@ -73,12 +74,12 @@ export class ProxmoxCollector implements Collector {
group: "Proxmox Host", group: "Proxmox Host",
status: "up", status: "up",
cpuPct: round(nodeStatus.cpu * 100), cpuPct: round(nodeStatus.cpu * 100),
memPct: round((nodeStatus.mem / nodeStatus.maxmem) * 100), memPct: round((nodeStatus.memory.used / nodeStatus.memory.total) * 100),
diskPct: round((nodeStatus.disk / nodeStatus.maxdisk) * 100), diskPct: round((nodeStatus.rootfs.used / nodeStatus.rootfs.total) * 100),
memPressurePct: null, memPressurePct: null,
cpuPressurePct: null, cpuPressurePct: null,
uptimeSec: nodeStatus.uptime, uptimeSec: nodeStatus.uptime,
meta: { maxmem: nodeStatus.maxmem, maxdisk: nodeStatus.maxdisk }, meta: { maxmem: nodeStatus.memory.total, maxdisk: nodeStatus.rootfs.total },
}); });
for (const ct of lxcs) { for (const ct of lxcs) {