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(alerts): default NotifyOnResolve to true and prevent patrol queue spam (#1259, #1258)
rcourtman706502c22d3e
diff --git a/internal/ai/patrol_run.go b/internal/ai/patrol_run.goindex 1d3169ba7c..a2881e05ab 100644--- a/internal/ai/patrol_run.go+++ b/internal/ai/patrol_run.go@@ -96,6 +96,12 @@ func (p *PatrolService) Stop() {// patrolLoop is the main background loopfunc (p *PatrolService) patrolLoop(ctx context.Context) {+ defer func() {+ p.mu.Lock()+ p.running = false+ p.mu.Unlock()+ }()+// Seed lastPatrol from persisted run history so the API can return// last_patrol_at immediately (before the first in-process patrol completes).if history := p.GetRunHistory(1); len(history) > 0 && !history[0].CompletedAt.IsZero() {@@ -1497,10 +1503,11 @@ func (p *PatrolService) TriggerPatrolForAlert(alert *alerts.Alert) {p.mu.RLock()enabled := p.config.Enabled+ running := p.runningtriggerManager := p.triggerManagerp.mu.RUnlock()- if !enabled {+ if !enabled || !running {return}diff --git a/internal/ai/patrol_run_additional_test.go b/internal/ai/patrol_run_additional_test.goindex 5ca103339f..dc0a13af58 100644--- a/internal/ai/patrol_run_additional_test.go+++ b/internal/ai/patrol_run_additional_test.go@@ -87,6 +87,7 @@ func TestPatrolService_GetResourceCurrentState(t *testing.T) {func TestPatrolService_TriggerPatrolForAlert(t *testing.T) {ps := NewPatrolService(nil, nil)ps.adHocTrigger = make(chan *alerts.Alert, 1)+ ps.running = true // simulate started patrol loopps.TriggerPatrolForAlert(nil) // should no-opdiff --git a/internal/config/persistence.go b/internal/config/persistence.goindex 9fa0a97d5a..53b6397a0f 100644--- a/internal/config/persistence.go+++ b/internal/config/persistence.go@@ -558,6 +558,9 @@ func (c *ConfigPersistence) LoadAlertConfig() (*alerts.AlertConfig, error) {IgnoreVMIDs: []string{},},Overrides: make(map[string]alerts.ThresholdConfig),+ Schedule: alerts.ScheduleConfig{+ NotifyOnResolve: true,+ },}, nil}return nil, err@@ -718,6 +721,18 @@ func (c *ConfigPersistence) LoadAlertConfig() (*alerts.AlertConfig, error) {}config.BackupDefaults.IgnoreVMIDs = normalized}+ // Default NotifyOnResolve to true if not explicitly set in saved config.+ // Older configs (pre-5.1.12) don't have this field, so Go unmarshals it+ // as false — but the intended default is true (recovery notifications ON).+ var scheduleProbe struct {+ Schedule struct {+ NotifyOnResolve *bool `json:"notifyOnResolve"`+ } `json:"schedule"`+ }+ if err := json.Unmarshal(data, &scheduleProbe); err == nil && scheduleProbe.Schedule.NotifyOnResolve == nil {+ config.Schedule.NotifyOnResolve = true+ }+config.MetricTimeThresholds = alerts.NormalizeMetricTimeThresholds(config.MetricTimeThresholds)config.DockerIgnoredContainerPrefixes = alerts.NormalizeDockerIgnoredPrefixes(config.DockerIgnoredContainerPrefixes)