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: address triage issues #1149, #1153, #1162, #1163
rcourtman70dbb495adb9
diff --git a/frontend-modern/src/components/Alerts/ResourceTable.tsx b/frontend-modern/src/components/Alerts/ResourceTable.tsxindex c03bfcafb9..3265a892f1 100644--- a/frontend-modern/src/components/Alerts/ResourceTable.tsx+++ b/frontend-modern/src/components/Alerts/ResourceTable.tsx@@ -1182,6 +1182,11 @@ export function ResourceTable(props: ResourceTableProps) {{resource.clusterName}</span></Show>+ <Show when={resource.type === 'storage' && resource.node}>+ <span class="rounded px-2 py-0.5 text-[10px] font-medium whitespace-nowrap bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300">+ {resource.node}+ </span>+ </Show></div></Show><Show when={resource.subtitle}>diff --git a/frontend-modern/src/components/Alerts/Thresholds/components/ResourceCard.tsx b/frontend-modern/src/components/Alerts/Thresholds/components/ResourceCard.tsxindex d88e76732f..84e56470f3 100644--- a/frontend-modern/src/components/Alerts/Thresholds/components/ResourceCard.tsx+++ b/frontend-modern/src/components/Alerts/Thresholds/components/ResourceCard.tsx@@ -180,6 +180,13 @@ export const ResourceCard: Component<ResourceCardProps> = (props) => {</span></Show>+ {/* Node badge for storage resources */}+ <Show when={props.resource.type === 'storage' && props.resource.node}>+ <span class="flex-shrink-0 px-1.5 py-0.5 rounded text-xs font-medium bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300">+ {props.resource.node}+ </span>+ </Show>+{/* Custom badge */}<Show when={hasCustomSettings()}><span class="flex-shrink-0 px-1.5 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-400">diff --git a/internal/alerts/alerts.go b/internal/alerts/alerts.goindex cf0f497753..3d787c8c57 100644--- a/internal/alerts/alerts.go+++ b/internal/alerts/alerts.go@@ -916,6 +916,11 @@ func (m *Manager) checkFlappingLocked(alertID string) bool {validHistory = append(validHistory, t)}}+ // Limit to max 10 entries to prevent unbounded growth+ const maxFlappingHistory = 10+ if len(validHistory) > maxFlappingHistory {+ validHistory = validHistory[len(validHistory)-maxFlappingHistory:]+ }m.flappingHistory[alertID] = validHistory// Check if we've exceeded the threshold@@ -5361,13 +5366,13 @@ func (m *Manager) CheckBackups(key = fmt.Sprintf("pbs:%s:%s:%s", backup.Instance, backup.BackupType, backup.VMID)displayName = fmt.Sprintf("VMID %s", backup.VMID)instance = fmt.Sprintf("PBS:%s", backup.Instance)- node = backup.Datastore+ node = "Unknown"}} else {key = fmt.Sprintf("pbs:%s:%s:%s", backup.Instance, backup.BackupType, backup.VMID)displayName = fmt.Sprintf("VMID %s", backup.VMID)instance = fmt.Sprintf("PBS:%s", backup.Instance)- node = backup.Datastore+ node = "Unknown"}updateRecord(key, backupRecord{@@ -7574,6 +7579,11 @@ func (m *Manager) checkPMGQuarantineBacklog(pmg models.PMGInstance, defaults PMGvalidSnapshots = append(validSnapshots, snap)}}+ // Limit to max 48 samples to prevent unbounded growth+ const maxQuarantineSnapshots = 48+ if len(validSnapshots) > maxQuarantineSnapshots {+ validSnapshots = validSnapshots[len(validSnapshots)-maxQuarantineSnapshots:]+ }m.pmgQuarantineHistory[pmg.ID] = validSnapshotsm.mu.Unlock()@@ -9366,6 +9376,14 @@ func (m *Manager) cleanupStaleMaps() {}}+ // Clean up Docker update tracking for stale entries+ for containerID, firstSeen := range m.dockerUpdateFirstSeen {+ if now.Sub(firstSeen) > staleThreshold {+ delete(m.dockerUpdateFirstSeen, containerID)+ cleaned+++ }+ }+// Clean up rate limit entries older than 1 hourrateLimitThreshold := RateLimitCleanupWindowfor resourceID, times := range m.alertRateLimit {diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.goindex b7ca805a1e..e39180b7a7 100644--- a/internal/monitoring/monitor.go+++ b/internal/monitoring/monitor.go@@ -2832,6 +2832,95 @@ func (m *Monitor) cleanupGuestMetadataCache(now time.Time) {}}+// cleanupTrackingMaps removes stale entries from various tracking maps to prevent unbounded memory growth.+// This cleans up auth tracking, polling timestamps, and circuit breaker state for resources+// that haven't been accessed in over 24 hours.+func (m *Monitor) cleanupTrackingMaps(now time.Time) {+ const staleThreshold = 24 * time.Hour+ cutoff := now.Add(-staleThreshold)+ cleaned := 0++ m.mu.Lock()+ defer m.mu.Unlock()++ // Clean up auth tracking maps - entries older than 24 hours+ for nodeID, ts := range m.lastAuthAttempt {+ if ts.Before(cutoff) {+ delete(m.lastAuthAttempt, nodeID)+ delete(m.authFailures, nodeID)+ cleaned+++ }+ }++ // Clean up last cluster check timestamps+ for instanceID, ts := range m.lastClusterCheck {+ if ts.Before(cutoff) {+ delete(m.lastClusterCheck, instanceID)+ cleaned+++ }+ }++ // Clean up last physical disk poll timestamps+ for instanceID, ts := range m.lastPhysicalDiskPoll {+ if ts.Before(cutoff) {+ delete(m.lastPhysicalDiskPoll, instanceID)+ cleaned+++ }+ }++ // Clean up last PVE backup poll timestamps+ for instanceID, ts := range m.lastPVEBackupPoll {+ if ts.Before(cutoff) {+ delete(m.lastPVEBackupPoll, instanceID)+ cleaned+++ }+ }++ // Clean up last PBS backup poll timestamps+ for instanceID, ts := range m.lastPBSBackupPoll {+ if ts.Before(cutoff) {+ delete(m.lastPBSBackupPoll, instanceID)+ cleaned+++ }+ }++ // Clean up circuit breakers for keys not in active clients+ // Build set of active keys from pveClients and pbsClients+ activeKeys := make(map[string]struct{})+ for key := range m.pveClients {+ activeKeys[key] = struct{}{}+ }+ for key := range m.pbsClients {+ activeKeys[key] = struct{}{}+ }+ for key := range m.pmgClients {+ activeKeys[key] = struct{}{}+ }++ // Only clean up circuit breakers for inactive keys that have been idle+ // for longer than the stale threshold+ for key, breaker := range m.circuitBreakers {+ if _, active := activeKeys[key]; !active {+ // Key is not in active clients - check if breaker is stale+ if breaker != nil {+ _, _, _, _, lastTransition := breaker.stateDetails()+ if now.Sub(lastTransition) > staleThreshold {+ delete(m.circuitBreakers, key)+ delete(m.failureCounts, key)+ delete(m.lastOutcome, key)+ cleaned+++ }+ }+ }+ }++ if cleaned > 0 {+ log.Debug().+ Int("entriesCleaned", cleaned).+ Msg("Cleaned stale entries from monitor tracking maps")+ }+}+// cleanupDiagnosticSnapshots removes stale diagnostic snapshots.// Snapshots older than 1 hour are removed to prevent unbounded growth// when nodes/VMs are deleted or reconfigured.@@ -4320,6 +4409,7 @@ func (m *Monitor) Start(ctx context.Context, wsHub *websocket.Hub) {m.cleanupGuestMetadataCache(now)m.cleanupDiagnosticSnapshots(now)m.cleanupRRDCache(now)+ m.cleanupTrackingMaps(now)if mock.IsMockEnabled() {// In mock mode, keep synthetic alerts freshgo m.checkMockAlerts()