fix: ProxmoxCollector read wrong shape for node mem/disk
/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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user