Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix: prefer status-mem over status-freemem for VM memory calculation
rcourtman902bdd92c21e
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.goindex a0f65a848e..715bdf505a 100644--- a/internal/monitoring/monitor.go+++ b/internal/monitoring/monitor.go@@ -6647,12 +6647,19 @@ func (m *Monitor) pollVMsAndContainersEfficient(ctx context.Context, instanceNammemAvailable = memTotal}memUsed = memTotal - memAvailable- case detailedStatus.FreeMem > 0 && memTotal >= detailedStatus.FreeMem:- memUsed = memTotal - detailedStatus.FreeMem- memorySource = "status-freemem"case detailedStatus.Mem > 0:+ // Prefer Mem over FreeMem: Proxmox calculates Mem as+ // (total_mem - free_mem) using the balloon's guest-visible+ // total, which is correct even when ballooning is active.+ // FreeMem is relative to the balloon allocation (not MaxMem),+ // so subtracting it from MaxMem produces wildly inflated+ // usage when the balloon has reduced the VM's memory.+ // Refs: #1185memUsed = detailedStatus.MemmemorySource = "status-mem"+ case detailedStatus.FreeMem > 0 && memTotal >= detailedStatus.FreeMem:+ memUsed = memTotal - detailedStatus.FreeMem+ memorySource = "status-freemem"}if memUsed > memTotal {memUsed = memTotaldiff --git a/internal/monitoring/monitor_polling.go b/internal/monitoring/monitor_polling.goindex ff672873cf..c417c6cb1f 100644--- a/internal/monitoring/monitor_polling.go+++ b/internal/monitoring/monitor_polling.go@@ -364,12 +364,19 @@ func (m *Monitor) pollVMsWithNodes(ctx context.Context, instanceName string, clumemAvailable = memTotal}memUsed = memTotal - memAvailable- case vmStatus.FreeMem > 0:- memUsed = memTotal - vmStatus.FreeMem- memorySource = "status-freemem"case vmStatus.Mem > 0:+ // Prefer Mem over FreeMem: Proxmox calculates Mem as+ // (total_mem - free_mem) using the balloon's guest-visible+ // total, which is correct even when ballooning is active.+ // FreeMem is relative to the balloon allocation (not MaxMem),+ // so subtracting it from MaxMem produces wildly inflated+ // usage when the balloon has reduced the VM's memory.+ // Refs: #1185memUsed = vmStatus.MemmemorySource = "status-mem"+ case vmStatus.FreeMem > 0:+ memUsed = memTotal - vmStatus.FreeMem+ memorySource = "status-freemem"default:memUsed = 0memorySource = "status-unavailable"