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
Restore Monitor struct alignment broken by the cadence overrides
[email protected]83581a4cfb9f
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.goindex f11faaf521..2d3e7bca8d 100644--- a/internal/monitoring/monitor.go+++ b/internal/monitoring/monitor.go@@ -1053,96 +1053,93 @@ func (h InstanceHealth) NormalizeCollections() InstanceHealth {// Monitor handles all monitoring operationstype Monitor struct {- config *config.Config- state *models.State- orgID string // Organization ID for tenant isolation (empty = default/legacy)- pveClients map[string]PVEClientInterface- pbsClients map[string]*pbs.Client- pmgClients map[string]*pmg.Client- availabilityStatuses map[string]AvailabilityProbeStatus- pollProviders map[InstanceType]PollProvider- pollMetrics *PollMetrics- scheduler *AdaptiveScheduler- stalenessTracker *StalenessTracker- taskQueue *TaskQueue- pollTimeout time.Duration- circuitBreakers map[string]*circuitBreaker- deadLetterQueue *TaskQueue- failureCounts map[string]int- lastOutcome map[string]taskOutcome- backoffCfg backoffConfig- rng *rand.Rand- maxRetryAttempts int- tempCollector *TemperatureCollector // SSH-based temperature collector- guestMetadataStore *config.GuestMetadataStore- dockerMetadataStore *config.DockerMetadataStore- hostMetadataStore *config.HostMetadataStore- hostContinuityStore *config.HostContinuityStore- hostAgentLifecycleMu sync.RWMutex- mu sync.RWMutex- startTime time.Time- rateTracker *RateTracker- metricsHistory *MetricsHistory- metricsStore *metrics.Store // Persistent SQLite metrics storage- alertManager *alerts.Manager- alertResolvedAICallback func(*alerts.Alert)- alertTriggeredAICallback func(*alerts.Alert)- connectionsSnapshotLister func() []alerts.ConnectionSnapshot // returns platform connection snapshots for the connection-degraded check- incidentStore *memory.IncidentStore- notificationMgr *notifications.NotificationManager- configPersist *config.ConfigPersistence- discoveryService *discovery.Service // Background discovery service- activePollCount int32 // Number of active polling operations- pollCounter int64 // Counter for polling cycles- authFailures map[string]int // Track consecutive auth failures per node- lastAuthAttempt map[string]time.Time // Track last auth attempt time- lastClusterCheck map[string]time.Time // Track last cluster check for standalone nodes- lastPhysicalDiskPoll map[string]time.Time // Track last physical disk poll time per instance- lastPVEBackupPoll map[string]time.Time // Track last PVE backup poll per instance- lastPBSBackupPoll map[string]time.Time // Track last PBS backup poll per instance- pveBackupInventoryReady map[string]map[string]bool // Track PVE guest inventory readiness for backup orphan detection- pveBackupTemplateSubjects map[string]map[string]struct{} // Track template VMIDs excluded from runtime workloads but valid for backups- backupPermissionWarnings map[string]string // Track backup permission issues per instance (instance -> warning message)- persistence *config.ConfigPersistence // Add persistence for saving updated configs- pbsBackupPollers map[string]bool // Track PBS backup polling goroutines per instance- pbsBackupCacheTime map[string]map[pbsBackupGroupKey]time.Time // Track when each PBS backup group was last fetched- runtimePollingMu sync.RWMutex // Guards the polling-cadence overrides below; polling goroutines read them every cycle- backupPollingEnabledOverride *bool // Runtime override for config.EnableBackupPolling (nil = use config)- backupPollingIntervalOverride *time.Duration // Runtime override for config.BackupPollingInterval (nil = use config)- pbsPollingIntervalOverride *time.Duration // Runtime override for config.PBSPollingInterval (nil = use config)- pmgPollingIntervalOverride *time.Duration // Runtime override for config.PMGPollingInterval (nil = use config)- runtimeCtx context.Context // Context used while monitor is running- wsHub *websocket.Hub // Hub used for broadcasting state- diagMu sync.RWMutex // Protects diagnostic snapshot maps- nodeSnapshots map[string]NodeMemorySnapshot- guestSnapshots map[string]GuestMemorySnapshot- rrdCacheMu sync.RWMutex // Protects short-lived guest memory caches.- nodeRRDMemCache map[string]rrdMemCacheEntry- vmRRDMemCache map[string]rrdMemCacheEntry- vmAgentMemCache map[string]agentMemCacheEntry- removedDockerHosts map[string]time.Time // Track deliberately removed Docker hosts (ID -> removal time)- dockerTokenBindings map[string]string // Track token ID -> Docker host identity bindings to enforce uniqueness- dockerIdentityFlaps map[string]*dockerIdentityFlapTracker // Track per-host identity flapping (cloned VMs sharing machine-id)- removedKubernetesClusters map[string]time.Time // Track deliberately removed Kubernetes clusters (ID -> removal time)- kubernetesTokenBindings map[string]string // Track token ID -> agent ID bindings to enforce uniqueness- removedHostAgents map[string]time.Time // Track deliberately removed host agents (ID -> removal time)- hostTokenBindings map[string]string // Track tokenID:hostname -> host identity bindings- hostReportApplyLocksMu sync.Mutex- hostReportApplyLocks map[string]*hostReportApplyLock- hostReportOrderMu sync.Mutex- hostReportOrders map[string]hostReportOrder- dockerCommands map[string]*dockerHostCommand- dockerCommandIndex map[string]string- guestMetadataMu sync.RWMutex- guestMetadataCache map[string]guestMetadataCacheEntry- guestMetadataLimiterMu sync.Mutex- guestMetadataLimiter map[string]time.Time- guestMetadataSlots chan struct{}- guestMetadataMinRefresh time.Duration- guestMetadataRefreshJitter time.Duration- guestMetadataRetryBackoff time.Duration- guestMetadataHoldDuration time.Duration- guestAgentWorkSlots chan struct{}+ config *config.Config+ state *models.State+ orgID string // Organization ID for tenant isolation (empty = default/legacy)+ pveClients map[string]PVEClientInterface+ pbsClients map[string]*pbs.Client+ pmgClients map[string]*pmg.Client+ availabilityStatuses map[string]AvailabilityProbeStatus+ pollProviders map[InstanceType]PollProvider+ pollMetrics *PollMetrics+ scheduler *AdaptiveScheduler+ stalenessTracker *StalenessTracker+ taskQueue *TaskQueue+ pollTimeout time.Duration+ circuitBreakers map[string]*circuitBreaker+ deadLetterQueue *TaskQueue+ failureCounts map[string]int+ lastOutcome map[string]taskOutcome+ backoffCfg backoffConfig+ rng *rand.Rand+ maxRetryAttempts int+ tempCollector *TemperatureCollector // SSH-based temperature collector+ guestMetadataStore *config.GuestMetadataStore+ dockerMetadataStore *config.DockerMetadataStore+ hostMetadataStore *config.HostMetadataStore+ hostContinuityStore *config.HostContinuityStore+ hostAgentLifecycleMu sync.RWMutex+ mu sync.RWMutex+ startTime time.Time+ rateTracker *RateTracker+ metricsHistory *MetricsHistory+ metricsStore *metrics.Store // Persistent SQLite metrics storage+ alertManager *alerts.Manager+ alertResolvedAICallback func(*alerts.Alert)+ alertTriggeredAICallback func(*alerts.Alert)+ connectionsSnapshotLister func() []alerts.ConnectionSnapshot // returns platform connection snapshots for the connection-degraded check+ incidentStore *memory.IncidentStore+ notificationMgr *notifications.NotificationManager+ configPersist *config.ConfigPersistence+ discoveryService *discovery.Service // Background discovery service+ activePollCount int32 // Number of active polling operations+ pollCounter int64 // Counter for polling cycles+ authFailures map[string]int // Track consecutive auth failures per node+ lastAuthAttempt map[string]time.Time // Track last auth attempt time+ lastClusterCheck map[string]time.Time // Track last cluster check for standalone nodes+ lastPhysicalDiskPoll map[string]time.Time // Track last physical disk poll time per instance+ lastPVEBackupPoll map[string]time.Time // Track last PVE backup poll per instance+ lastPBSBackupPoll map[string]time.Time // Track last PBS backup poll per instance+ pveBackupInventoryReady map[string]map[string]bool // Track PVE guest inventory readiness for backup orphan detection+ pveBackupTemplateSubjects map[string]map[string]struct{} // Track template VMIDs excluded from runtime workloads but valid for backups+ backupPermissionWarnings map[string]string // Track backup permission issues per instance (instance -> warning message)+ persistence *config.ConfigPersistence // Add persistence for saving updated configs+ pbsBackupPollers map[string]bool // Track PBS backup polling goroutines per instance+ pbsBackupCacheTime map[string]map[pbsBackupGroupKey]time.Time // Track when each PBS backup group was last fetched+ runtimePollingMu sync.RWMutex // Guards runtimePollingOverride; polling goroutines read it every cycle+ runtimePollingOverride runtimePollingOverrides // Runtime polling-cadence overrides pushed by the settings API (#1619)+ runtimeCtx context.Context // Context used while monitor is running+ wsHub *websocket.Hub // Hub used for broadcasting state+ diagMu sync.RWMutex // Protects diagnostic snapshot maps+ nodeSnapshots map[string]NodeMemorySnapshot+ guestSnapshots map[string]GuestMemorySnapshot+ rrdCacheMu sync.RWMutex // Protects short-lived guest memory caches.+ nodeRRDMemCache map[string]rrdMemCacheEntry+ vmRRDMemCache map[string]rrdMemCacheEntry+ vmAgentMemCache map[string]agentMemCacheEntry+ removedDockerHosts map[string]time.Time // Track deliberately removed Docker hosts (ID -> removal time)+ dockerTokenBindings map[string]string // Track token ID -> Docker host identity bindings to enforce uniqueness+ dockerIdentityFlaps map[string]*dockerIdentityFlapTracker // Track per-host identity flapping (cloned VMs sharing machine-id)+ removedKubernetesClusters map[string]time.Time // Track deliberately removed Kubernetes clusters (ID -> removal time)+ kubernetesTokenBindings map[string]string // Track token ID -> agent ID bindings to enforce uniqueness+ removedHostAgents map[string]time.Time // Track deliberately removed host agents (ID -> removal time)+ hostTokenBindings map[string]string // Track tokenID:hostname -> host identity bindings+ hostReportApplyLocksMu sync.Mutex+ hostReportApplyLocks map[string]*hostReportApplyLock+ hostReportOrderMu sync.Mutex+ hostReportOrders map[string]hostReportOrder+ dockerCommands map[string]*dockerHostCommand+ dockerCommandIndex map[string]string+ guestMetadataMu sync.RWMutex+ guestMetadataCache map[string]guestMetadataCacheEntry+ guestMetadataLimiterMu sync.Mutex+ guestMetadataLimiter map[string]time.Time+ guestMetadataSlots chan struct{}+ guestMetadataMinRefresh time.Duration+ guestMetadataRefreshJitter time.Duration+ guestMetadataRetryBackoff time.Duration+ guestMetadataHoldDuration time.Duration+ guestAgentWorkSlots chan struct{}// Configurable guest agent timeouts (refs #592)guestAgentFSInfoTimeout time.DurationguestAgentNetworkTimeout time.Durationdiff --git a/internal/monitoring/monitor_runtime_settings.go b/internal/monitoring/monitor_runtime_settings.goindex 80d13f7b1f..9d1436d784 100644--- a/internal/monitoring/monitor_runtime_settings.go+++ b/internal/monitoring/monitor_runtime_settings.go@@ -11,13 +11,23 @@ import "time"// runtimePollingMu because polling goroutines read them every cycle while// the settings API writes them.+// runtimePollingOverrides holds the polling-cadence values the settings API+// has pushed into this live monitor, shadowing the corresponding fields of+// the monitor's detached config copy. nil means "use the config value".+type runtimePollingOverrides struct {+ backupEnabled *bool+ backupInterval *time.Duration+ pbsInterval *time.Duration+ pmgInterval *time.Duration+}+// backupPollingEnabledSetting returns the effective EnableBackupPolling value.func (m *Monitor) backupPollingEnabledSetting() bool {if m == nil || m.config == nil {return false}m.runtimePollingMu.RLock()- override := m.backupPollingEnabledOverride+ override := m.runtimePollingOverride.backupEnabledm.runtimePollingMu.RUnlock()if override != nil {return *override@@ -32,7 +42,7 @@ func (m *Monitor) backupPollingIntervalSetting() time.Duration {return 0}m.runtimePollingMu.RLock()- override := m.backupPollingIntervalOverride+ override := m.runtimePollingOverride.backupIntervalm.runtimePollingMu.RUnlock()if override != nil {return *override@@ -47,7 +57,7 @@ func (m *Monitor) pbsPollingIntervalSetting() time.Duration {return 0}m.runtimePollingMu.RLock()- override := m.pbsPollingIntervalOverride+ override := m.runtimePollingOverride.pbsIntervalm.runtimePollingMu.RUnlock()if override != nil {return *override@@ -62,7 +72,7 @@ func (m *Monitor) pmgPollingIntervalSetting() time.Duration {return 0}m.runtimePollingMu.RLock()- override := m.pmgPollingIntervalOverride+ override := m.runtimePollingOverride.pmgIntervalm.runtimePollingMu.RUnlock()if override != nil {return *override@@ -80,10 +90,10 @@ func (m *Monitor) SetBackupPollingEnabled(enabled bool) {}m.runtimePollingMu.Lock()wasEnabled := m.config != nil && m.config.EnableBackupPolling- if m.backupPollingEnabledOverride != nil {- wasEnabled = *m.backupPollingEnabledOverride+ if m.runtimePollingOverride.backupEnabled != nil {+ wasEnabled = *m.runtimePollingOverride.backupEnabled}- m.backupPollingEnabledOverride = &enabled+ m.runtimePollingOverride.backupEnabled = &enabledm.runtimePollingMu.Unlock()if enabled && !wasEnabled {@@ -108,10 +118,10 @@ func (m *Monitor) SetBackupPollingInterval(interval time.Duration) {if m.config != nil {previous = m.config.BackupPollingInterval}- if m.backupPollingIntervalOverride != nil {- previous = *m.backupPollingIntervalOverride+ if m.runtimePollingOverride.backupInterval != nil {+ previous = *m.runtimePollingOverride.backupInterval}- m.backupPollingIntervalOverride = &interval+ m.runtimePollingOverride.backupInterval = &intervalm.runtimePollingMu.Unlock()if interval > 0 && (previous <= 0 || interval < previous) {@@ -127,7 +137,7 @@ func (m *Monitor) SetPBSPollingInterval(interval time.Duration) {return}m.runtimePollingMu.Lock()- m.pbsPollingIntervalOverride = &interval+ m.runtimePollingOverride.pbsInterval = &intervalm.runtimePollingMu.Unlock()}@@ -139,7 +149,7 @@ func (m *Monitor) SetPMGPollingInterval(interval time.Duration) {return}m.runtimePollingMu.Lock()- m.pmgPollingIntervalOverride = &interval+ m.runtimePollingOverride.pmgInterval = &intervalm.runtimePollingMu.Unlock()}