mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 19:23:31 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user