diff options
| author | Paul Buetow <paul@buetow.org> | 2026-01-10 09:57:37 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-01-10 09:57:37 +0200 |
| commit | 005b9645a7c58e9b2486fb35d6038bbe607a3ce7 (patch) | |
| tree | b9bb59bc04f84a66dbd4a4d2883e635ed06b0d38 /internal/prometheus.go | |
| parent | 64b5c53384cad9b4709fba41b4c2a988bdaf294e (diff) | |
fix prometheus handling
Diffstat (limited to 'internal/prometheus.go')
| -rw-r--r-- | internal/prometheus.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/prometheus.go b/internal/prometheus.go index ab92e1a..5bf2638 100644 --- a/internal/prometheus.go +++ b/internal/prometheus.go @@ -35,6 +35,10 @@ func mergePrometheusAlerts(ctx context.Context, state state, conf config) state checkName := "Prometheus alerts" newStatus := nagiosWarning if prevState, ok := state.checks[checkName]; ok && prevState.Status == newStatus { + if prevState.PrevStatus != newStatus { + prevState.PrevStatus = newStatus + state.checks[checkName] = prevState + } return state } cs := checkResult{ @@ -49,6 +53,18 @@ func mergePrometheusAlerts(ctx context.Context, state state, conf config) state log.Printf("Fetched %d firing alerts from Prometheus host %s", len(alerts), host) + // Clear the "Prometheus alerts" check if fetch succeeded (was previously failing) + checkName := "Prometheus alerts" + if prevState, ok := state.checks[checkName]; ok && prevState.Status != nagiosOk { + cs := checkResult{ + name: checkName, + output: "OK: Prometheus connection restored", + epoch: time.Now().Unix(), + status: nagiosOk, + } + state.update(cs) + } + // Check if Watchdog alert is firing watchdogFiring := false |
