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/html_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'internal/html_test.go') diff --git a/internal/html_test.go b/internal/html_test.go index d482eda..b77c937 100644 --- a/internal/html_test.go +++ b/internal/html_test.go @@ -219,7 +219,7 @@ func TestHtmlReport(t *testing.T) { } subject := "GOGIOS Report [C:1 W:1 U:0 S:1 OK:2]" - result := s.htmlReport(subject) + result := s.htmlReport(subject, config{}) // Check that all major sections are present expectedSections := []string{ @@ -228,6 +228,7 @@ func TestHtmlReport(t *testing.T) { "Alerts with status changed", "Unhandled alerts", "Stale alerts", + "Suppressed alerts", "Generated by Gogios", "", } @@ -399,7 +400,7 @@ func TestW3CCompliance(t *testing.T) { } subject := "GOGIOS Report [C:1 W:0 U:0 S:0 OK:0]" - html := s.htmlReport(subject) + html := s.htmlReport(subject, config{}) // W3C HTML5 Required Elements requiredElements := map[string]string{ -- cgit v1.2.3