From 4e3459bee4ecc8ceef33b0a876e584b494ad4e4a Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 21 Jan 2026 23:40:14 +0200 Subject: add OnlyIfNotExists alert suppression feature Adds ability to suppress alerts during maintenance windows by checking for the existence of a file. When the file exists and is recent (within configured max age), matching alerts are excluded from email reports. Features: - Global PrometheusOnlyIfNotExists config for Prometheus alerts - Per-check OnlyIfNotExists config for individual checks - Configurable max age (default 86400s) for suppression file - New "Suppressed alerts" section in email and HTML reports - Suppressed checks excluded from counts and unhandled sections Co-Authored-By: Claude Opus 4.5 --- internal/check.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'internal/check.go') diff --git a/internal/check.go b/internal/check.go index a171c29..aabb3ec 100644 --- a/internal/check.go +++ b/internal/check.go @@ -9,13 +9,15 @@ import ( ) type check struct { - Plugin string - Args []string - DependsOn []string `json:"DependsOn,omitempty"` - Retries int `json:"Retries,omitempty"` - RetryInterval int `json:"RetryInterval,omitempty"` - RunInterval int `json:"RunInterval,omitempty"` - RandomSpread int `json:"RandomSpread,omitempty"` + Plugin string + Args []string + DependsOn []string `json:"DependsOn,omitempty"` + Retries int `json:"Retries,omitempty"` + RetryInterval int `json:"RetryInterval,omitempty"` + RunInterval int `json:"RunInterval,omitempty"` + RandomSpread int `json:"RandomSpread,omitempty"` + OnlyIfNotExists string `json:"OnlyIfNotExists,omitempty"` // Suppress alerts if this file exists and is recent + OnlyIfNotExistsMaxS int `json:"OnlyIfNotExistsMaxS,omitempty"` // Max age in seconds for suppression file (uses global default if 0) } type namedCheck struct { -- cgit v1.2.3