From b2f5d62067a54c1e86f20fe4e6d43ecddf059e99 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Fri, 23 Oct 2026 20:10:17 +0200 Subject: [PATCH] grafana: add declarative alert status dashboard --- apps/grafana/resources/alert-status.json | 105 ++++++++++++++++++++++ apps/grafana/resources/kustomization.yaml | 7 ++ 2 files changed, 112 insertions(+) create mode 100644 apps/grafana/resources/alert-status.json diff --git a/apps/grafana/resources/alert-status.json b/apps/grafana/resources/alert-status.json new file mode 100644 index 0000000..697e734 --- /dev/null +++ b/apps/grafana/resources/alert-status.json @@ -0,0 +1,105 @@ +{ + "annotations": {"list": []}, + "description": "Current and historical firing Prometheus alerts. Public view shows only alert name, namespace and severity; it omits instance labels and annotations.", + "editable": false, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "panels": [ + { + "datasource": {"type": "prometheus", "uid": "aevstx976yku8a"}, + "description": "Number of distinct alert-name/namespace/severity groups firing now. Multiple instances of one alert are counted once.", + "fieldConfig": { + "defaults": { + "color": {"mode": "thresholds"}, + "mappings": [], + "thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}, {"color": "red", "value": 1}]}, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": {"h": 5, "w": 24, "x": 0, "y": 0}, + "id": 1, + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, + "textMode": "value_and_name" + }, + "targets": [{ + "editorMode": "code", + "expr": "count(sum by (alertname, namespace, severity) (ALERTS{alertstate=\"firing\",alertname!~\"Watchdog|InfoInhibitor\"})) or vector(0)", + "instant": true, + "range": false, + "refId": "A" + }], + "title": "Firing alert groups now", + "type": "stat" + }, + { + "datasource": {"type": "prometheus", "uid": "aevstx976yku8a"}, + "description": "Current firing alerts, grouped to avoid publishing host or instance labels. Instances is the number of active series in each group.", + "fieldConfig": {"defaults": {"custom": {"align": "auto", "cellOptions": {"type": "auto"}}}, "overrides": []}, + "gridPos": {"h": 11, "w": 24, "x": 0, "y": 5}, + "id": 2, + "options": {"cellHeight": "sm", "showHeader": true}, + "targets": [{ + "editorMode": "code", + "expr": "sum by (alertname, namespace, severity) (ALERTS{alertstate=\"firing\",alertname!~\"Watchdog|InfoInhibitor\"})", + "format": "table", + "instant": true, + "range": false, + "refId": "A" + }], + "title": "Firing alerts", + "transformations": [{ + "id": "organize", + "options": { + "excludeByName": {"Time": true}, + "indexByName": {"alertname": 0, "namespace": 1, "severity": 2, "Value": 3}, + "renameByName": {"alertname": "Alert", "namespace": "Namespace", "severity": "Severity", "Value": "Instances"} + } + }], + "type": "table" + }, + { + "datasource": {"type": "prometheus", "uid": "aevstx976yku8a"}, + "description": "Red means an alert was firing. Gaps mean it was not firing. History is limited to Prometheus retention (currently 15 days); this is not an archive of Alertmanager notifications.", + "fieldConfig": { + "defaults": { + "color": {"fixedColor": "red", "mode": "fixed"}, + "custom": {"fillOpacity": 85, "lineWidth": 0, "spanNulls": false}, + "mappings": [{"options": {"1": {"color": "red", "index": 0, "text": "Firing"}}, "type": "value"}], + "noValue": "No firing alerts" + }, + "overrides": [] + }, + "gridPos": {"h": 16, "w": 24, "x": 0, "y": 16}, + "id": 3, + "options": {"alignValue": "center", "mergeValues": true, "rowHeight": 0.8, "showValue": "never", "tooltip": {"mode": "single", "sort": "none"}}, + "targets": [{ + "editorMode": "code", + "expr": "max by (alertname, namespace, severity) (ALERTS{alertstate=\"firing\",alertname!~\"Watchdog|InfoInhibitor\"})", + "instant": false, + "legendFormat": "{{alertname}} ({{namespace}} ยท {{severity}})", + "range": true, + "refId": "A" + }], + "title": "Firing alert history", + "type": "state-timeline" + } + ], + "refresh": "30s", + "schemaVersion": 41, + "tags": ["alerts", "status"], + "templating": {"list": []}, + "time": {"from": "now-7d", "to": "now"}, + "timepicker": {}, + "timezone": "browser", + "title": "Alert status", + "uid": "homelab-alert-status", + "version": 1 +} diff --git a/apps/grafana/resources/kustomization.yaml b/apps/grafana/resources/kustomization.yaml index ac2bb70..7aad981 100644 --- a/apps/grafana/resources/kustomization.yaml +++ b/apps/grafana/resources/kustomization.yaml @@ -7,6 +7,13 @@ resources: - kubernetes-pvc-overview-dashboard.yaml - mikrotik-storage-dashboard.yaml configMapGenerator: +- name: alert-status-dashboard + files: + - alert-status.json + options: + disableNameSuffixHash: true + labels: + grafana_dashboard: "1" - name: traefik-official-dashboard files: - traefik-official.json