summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-01-22 09:44:59 +0200
committerPaul Buetow <paul@buetow.org>2026-01-22 09:44:59 +0200
commit820b4e6c483734ba1d57ecdd28838657d18b3159 (patch)
treeb5e3f06486d54220722fc86d57a5d31bcfb65019 /internal
parentf50b890f4a67e43ec97f9f005f98aa3b6908dd3c (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')
-rw-r--r--internal/html.go16
-rw-r--r--internal/state.go21
2 files changed, 21 insertions, 16 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++
diff --git a/internal/state.go b/internal/state.go
index 4df7757..9deb178 100644
--- a/internal/state.go
+++ b/internal/state.go
@@ -233,12 +233,13 @@ func (s state) reportStaleAlerts(sb *strings.Builder, conf config) int {
})
}
-// reportSuppressed lists all checks that are currently suppressed via OnlyIfNotExists.
+// reportSuppressed lists all non-OK checks that are currently suppressed via OnlyIfNotExists.
// This provides visibility into which alerts are being muted during maintenance windows.
+// OK checks are never shown as suppressed since there's nothing to suppress.
func (s state) reportSuppressed(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++
@@ -263,7 +264,8 @@ func (s state) reportSuppressed(sb *strings.Builder, conf config) (count int) {
}
// reportBy iterates over checks matching the filter and writes them to sb.
-// Checks that are suppressed via OnlyIfNotExists are excluded from the report.
+// Non-OK checks that are suppressed via OnlyIfNotExists are excluded from the report.
+// OK checks are never suppressed since there's nothing to suppress.
func (s state) reportBy(sb *strings.Builder, showStatusChange, isStaleReport bool,
conf config, filter func(cs checkState) bool,
) (count int) {
@@ -274,8 +276,8 @@ func (s state) reportBy(sb *strings.Builder, showStatusChange, isStaleReport boo
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++
@@ -309,11 +311,12 @@ func (s state) reportBy(sb *strings.Builder, showStatusChange, isStaleReport boo
return
}
-// countBy counts checks matching the filter, excluding suppressed checks.
+// countBy counts checks matching the filter, excluding suppressed non-OK checks.
+// OK checks are never suppressed since there's nothing to suppress.
func (s state) countBy(conf config, filter func(cs checkState) bool) (count int) {
for name, cs := range s.checks {
- if isCheckSuppressed(name, conf) {
- continue // skip suppressed checks
+ if cs.Status != nagiosOk && isCheckSuppressed(name, conf) {
+ continue // skip suppressed checks (OK checks are never suppressed)
}
if filter(cs) {
count++