From 2f645ebcfb8fc52aa85885857215d7aa9817e634 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Fri, 22 Aug 2025 08:30:39 +0000 Subject: [PATCH] fix: respect disabled flag for storage device alerts Storage devices with alerts disabled in the Thresholds tab were still triggering alerts. Added proper checking of the disabled override flag in CheckStorage() to match the behavior of guest alerts. --- internal/alerts/alerts.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/alerts/alerts.go b/internal/alerts/alerts.go index f64b629da..36e8d94b6 100644 --- a/internal/alerts/alerts.go +++ b/internal/alerts/alerts.go @@ -533,9 +533,27 @@ func (m *Manager) CheckStorage(storage models.Storage) { m.mu.RUnlock() return } + + // Check if there's an override for this storage device + override, hasOverride := m.config.Overrides[storage.ID] threshold := m.config.StorageDefault m.mu.RUnlock() + // If alerts are disabled for this storage device, clear any existing alerts and return + if hasOverride && override.Disabled { + m.mu.Lock() + alertID := fmt.Sprintf("%s-usage", storage.ID) + if _, exists := m.activeAlerts[alertID]; exists { + delete(m.activeAlerts, alertID) + log.Info(). + Str("alertID", alertID). + Str("storage", storage.Name). + Msg("Cleared alert - storage has alerts disabled") + } + m.mu.Unlock() + return + } + m.checkMetric(storage.ID, storage.Name, storage.Node, storage.Instance, "Storage", "usage", storage.Usage, &threshold) }