From 84dd6392e5dd247cf6592c50f663fa6437e55941 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Thu, 28 Aug 2025 12:44:46 +0000 Subject: [PATCH] fix: show dash instead of 0% for VMs without guest agent disk data addresses #367 - when VMs don't have working guest agent data, display a dash instead of misleading 0% disk usage --- .../src/components/Dashboard/GuestRow.tsx | 4 +++- internal/monitoring/monitor.go | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsx index f72e8096b..4c3bcd39a 100644 --- a/frontend-modern/src/components/Dashboard/GuestRow.tsx +++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx @@ -69,6 +69,8 @@ export function GuestRow(props: GuestRowProps) { }); const diskPercent = createMemo(() => { if (!props.guest.disk || props.guest.disk.total === 0) return 0; + // Check if usage is -1 (unknown/no guest agent) + if (props.guest.disk.usage === -1) return -1; return (props.guest.disk.used / props.guest.disk.total) * 100; }); @@ -185,7 +187,7 @@ export function GuestRow(props: GuestRowProps) { {/* Disk */} 0} + when={props.guest.disk && props.guest.disk.total > 0 && diskPercent() !== -1} fallback={-} > 0 && res.Status == "running" { + diskUsage = -1 + } + // For running VMs, try to get filesystem info from guest agent if res.Status == "running" { // First check if agent is enabled by getting VM status @@ -1355,6 +1361,12 @@ func (m *Monitor) pollVMsWithNodes(ctx context.Context, instanceName string, cli diskFree := diskTotal - diskUsed diskUsage := safePercentage(float64(diskUsed), float64(diskTotal)) + // If VM shows 0 disk usage but has allocated disk, it's likely guest agent issue + // Set to -1 to indicate "unknown" rather than showing misleading 0% + if diskUsed == 0 && diskTotal > 0 && vm.Status == "running" { + diskUsage = -1 + } + // If VM has guest agent enabled and is running, try to get filesystem info if vm.Agent > 0 && vm.Status == "running" { log.Debug().