fix: add default TimeThresholds to prevent hair-trigger alerts (fixes #491)

Root cause: NewManager() was missing TimeThresholds initialization, causing
all alert types to use 0-second delay. This meant alerts fired immediately
on the first sample exceeding threshold, with no debouncing.

Impact: LXC containers with brief CPU spikes to ~100% (normal for single-core
saturation) triggered constant alerts instead of only alerting on sustained
high CPU usage.

Fix: Add default TimeThresholds:
- guest: 10s delay (prevents alerts from brief CPU spikes)
- node: 15s delay
- storage: 30s delay
- pbs: 30s delay

This ensures CPU must stay above threshold for the configured duration
before an alert fires, preventing noise from momentary spikes.

Fixes #491
This commit is contained in:
rcourtman
2025-10-02 11:31:56 +00:00
parent ad10d43542
commit cf365b5f80
+7 -1
View File
@@ -247,7 +247,13 @@ func NewManager() *Manager {
MinimumDelta: 2.0, // 2% minimum change
SuppressionWindow: 5, // 5 minutes
HysteresisMargin: 5.0, // 5% default margin
Overrides: make(map[string]ThresholdConfig),
TimeThresholds: map[string]int{
"guest": 10, // 10 second delay for guest CPU alerts
"node": 15, // 15 second delay for node alerts
"storage": 30, // 30 second delay for storage alerts
"pbs": 30, // 30 second delay for PBS alerts
},
Overrides: make(map[string]ThresholdConfig),
Schedule: ScheduleConfig{
QuietHours: QuietHours{
Enabled: false, // OFF - users should opt-in to quiet hours