Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

fix: respect quiet hours for recovery notifications (#1068)

rcourtman07b4765b8df6
diff --git a/internal/alerts/alerts.go b/internal/alerts/alerts.go
index 201ed06495..9aabead7d7 100644
--- a/internal/alerts/alerts.go
+++ b/internal/alerts/alerts.go
@@ -2116,6 +2116,29 @@ func (m *Manager) shouldSuppressNotification(alert *Alert) (bool, string) {
return false, ""
}
+// ShouldSuppressResolvedNotification checks if a recovery notification should be suppressed
+// during quiet hours. Recovery notifications follow the same quiet hours rules as their
+// corresponding alerts - if the original alert would have been suppressed, so is the recovery.
+func (m *Manager) ShouldSuppressResolvedNotification(alert *Alert) bool {
+ if alert == nil {
+ return false
+ }
+
+ m.mu.RLock()
+ defer m.mu.RUnlock()
+
+ suppressed, reason := m.shouldSuppressNotification(alert)
+ if suppressed {
+ log.Debug().
+ Str("alertID", alert.ID).
+ Str("type", alert.Type).
+ Str("level", string(alert.Level)).
+ Str("quietHoursRule", reason).
+ Msg("Recovery notification suppressed during quiet hours")
+ }
+ return suppressed
+}
+
// shouldNotifyAfterCooldown checks if enough time has passed since the last notification
// Returns true if notification should be sent, false if still in cooldown period
func (m *Manager) shouldNotifyAfterCooldown(alert *Alert) bool {
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index ae44c5aee2..a0edf18495 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -8131,6 +8131,10 @@ func (m *Monitor) handleAlertResolved(alertID string) {
m.notificationMgr.CancelAlert(alertID)
if m.notificationMgr.GetNotifyOnResolve() {
if resolved := m.alertManager.GetResolvedAlert(alertID); resolved != nil {
+ // Check if recovery notification should be suppressed during quiet hours
+ if m.alertManager.ShouldSuppressResolvedNotification(resolved.Alert) {
+ return
+ }
go m.notificationMgr.SendResolvedAlert(resolved)
}
}