From 2f2ab19c0b5bc78a4e6aa93099c3627ee3973495 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Mon, 11 Aug 2025 08:45:49 +0000 Subject: [PATCH] fix: QEMU guest agent VMs now show memory usage correctly - Fall back to vmStatus.Mem when guest agent doesn't report FreeMem - Fixes issue where VMs with guest agent showed 0% memory usage - Addresses issue #294 --- internal/monitoring/monitor.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go index 7506269f4..b74789dd7 100644 --- a/internal/monitoring/monitor.go +++ b/internal/monitoring/monitor.go @@ -857,9 +857,12 @@ func (m *Monitor) pollVMs(ctx context.Context, instanceName string, client PVECl if vmStatus.FreeMem > 0 { // Guest agent reports free memory, so calculate used memUsed = memTotal - vmStatus.FreeMem + } else if vmStatus.Mem > 0 { + // No guest agent free memory data, but we have actual memory usage + // Use the reported memory usage from Proxmox + memUsed = vmStatus.Mem } else { - // No guest agent data - show 0% usage instead of incorrect 100% - // This indicates the guest agent is not installed/running + // No memory data available at all - show 0% usage memUsed = 0 } } else {