diff options
| author | Paul Buetow <paul@buetow.org> | 2026-01-22 09:44:59 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-01-22 09:44:59 +0200 |
| commit | 820b4e6c483734ba1d57ecdd28838657d18b3159 (patch) | |
| tree | b5e3f06486d54220722fc86d57a5d31bcfb65019 /internal/html.go | |
| parent | f50b890f4a67e43ec97f9f005f98aa3b6908dd3c (diff) | |
fix OK checks incorrectly shown in suppressed section
OK checks should appear in "OK checks" section, not "Suppressed alerts".
Suppression now only applies to non-OK checks (Critical, Warning, Unknown).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/html.go')
| -rw-r--r-- | internal/html.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/internal/html.go b/internal/html.go index e2843db..71f17e4 100644 --- a/internal/html.go +++ b/internal/html.go @@ -194,11 +194,12 @@ func (s state) htmlReportStaleAlerts(sb *strings.Builder, conf config) int { } // htmlReportSuppressed generates HTML for suppressed checks. -// Shows which checks are currently muted via OnlyIfNotExists for visibility. +// Shows which non-OK checks are currently muted via OnlyIfNotExists for visibility. +// OK checks are never shown as suppressed since there's nothing to suppress. func (s state) htmlReportSuppressed(sb *strings.Builder, conf config) (count int) { for name, cs := range s.checks { - if !isCheckSuppressed(name, conf) { - continue + if cs.Status == nagiosOk || !isCheckSuppressed(name, conf) { + continue // OK checks are never shown as suppressed } count++ @@ -219,10 +220,11 @@ func (s state) htmlReportSuppressed(sb *strings.Builder, conf config) (count int return } -// countSuppressed counts the number of suppressed checks. +// countSuppressed counts the number of suppressed non-OK checks. +// OK checks are never counted as suppressed since there's nothing to suppress. func (s state) countSuppressed(conf config) (count int) { for name := range s.checks { - if isCheckSuppressed(name, conf) { + if s.checks[name].Status != nagiosOk && isCheckSuppressed(name, conf) { count++ } } @@ -242,8 +244,8 @@ func (s state) htmlReportBy(sb *strings.Builder, showStatusChange, isStaleReport if !isStaleReport && cs.Epoch < s.staleEpoch { continue // skip stale checks in non-stale report } - if isCheckSuppressed(name, conf) { - continue // skip suppressed checks + if cs.Status != nagiosOk && isCheckSuppressed(name, conf) { + continue // skip suppressed checks (OK checks are never suppressed) } count++ |
