From f1a3d9ff7b5a747bf3e24f0ad070b7c5e4aff949 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Wed, 20 Aug 2025 14:16:06 +0000 Subject: [PATCH] fix: make pulse-relaxed tag use fixed thresholds instead of additive changed pulse-relaxed behavior to override with fixed values (95% CPU/RAM, 98% disk) rather than adding to existing thresholds. this avoids confusing interactions with custom alert rules and provides more predictable behavior also updated docs to clarify the priority order of tags vs custom rules --- README.md | 11 ++++++++++- internal/alerts/alerts.go | 32 ++++++++++++-------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 4d548855d..2481f0401 100644 --- a/README.md +++ b/README.md @@ -281,7 +281,16 @@ Control alert behavior per VM/container using Proxmox tags (no UI configuration #### Available Tags - **`pulse-no-alerts`** - Completely disables all alerts for this VM/CT - **`pulse-monitor-only`** - Shows in UI but suppresses notifications (email, webhooks) -- **`pulse-relaxed`** - Increases thresholds (CPU/RAM to 95%, disk to 98%) +- **`pulse-relaxed`** - Sets thresholds to 95% for CPU/RAM, 98% for disk + +#### Priority Order +Tags take precedence over other configurations: +1. `pulse-no-alerts` tag - Overrides everything, no alerts at all +2. `pulse-relaxed` tag - Overrides to 95%/98% regardless of custom rules +3. Custom Alert Rules from UI - Applied if no tags present +4. Default global thresholds - Used if nothing else is configured + +**Note:** `pulse-monitor-only` works with any threshold source. Tags are checked every 30-60 seconds, no restart needed. #### How to Use 1. In Proxmox, edit your VM/CT diff --git a/internal/alerts/alerts.go b/internal/alerts/alerts.go index 8ab6f22c4..97dbf5647 100644 --- a/internal/alerts/alerts.go +++ b/internal/alerts/alerts.go @@ -486,31 +486,23 @@ func (m *Manager) CheckGuest(guest interface{}, instanceName string) { // Apply relaxed thresholds if the tag is present if useRelaxedThresholds { - // Increase thresholds by 15 percentage points (e.g., 80% -> 95%) - if thresholds.CPU != nil { - relaxedCPU := &HysteresisThreshold{ - Trigger: min(thresholds.CPU.Trigger+15, 100), - Clear: min(thresholds.CPU.Clear+15, 95), - } - thresholds.CPU = relaxedCPU + // Override with fixed relaxed thresholds (not additive) + // This provides consistent behavior regardless of other settings + thresholds.CPU = &HysteresisThreshold{ + Trigger: 95, + Clear: 90, } - if thresholds.Memory != nil { - relaxedMem := &HysteresisThreshold{ - Trigger: min(thresholds.Memory.Trigger+15, 100), - Clear: min(thresholds.Memory.Clear+15, 95), - } - thresholds.Memory = relaxedMem + thresholds.Memory = &HysteresisThreshold{ + Trigger: 95, + Clear: 90, } - if thresholds.Disk != nil { - relaxedDisk := &HysteresisThreshold{ - Trigger: min(thresholds.Disk.Trigger+10, 100), - Clear: min(thresholds.Disk.Clear+10, 95), - } - thresholds.Disk = relaxedDisk + thresholds.Disk = &HysteresisThreshold{ + Trigger: 98, + Clear: 95, } log.Info(). Str("guest", name). - Msg("Applied relaxed thresholds due to pulse:relaxed tag") + Msg("Applied relaxed thresholds due to pulse-relaxed tag (95% CPU/RAM, 98% disk)") } // Check each metric