From 4c097253177fb5d500f6e927acf9f730c58ebd02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20K=C3=B6nig?= Date: Thu, 9 Jul 2026 20:46:07 +0200 Subject: [PATCH] format grafana ntfy alerts --- .../AZ-PRM-1/services/monitoring/alerting.nix | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hosts/AZ-PRM-1/services/monitoring/alerting.nix b/hosts/AZ-PRM-1/services/monitoring/alerting.nix index d96dbca..8dd885e 100644 --- a/hosts/AZ-PRM-1/services/monitoring/alerting.nix +++ b/hosts/AZ-PRM-1/services/monitoring/alerting.nix @@ -245,6 +245,31 @@ in { settings = { url = "$GRAFANA_NTFY_WEBHOOK_URL"; httpMethod = "POST"; + title = '' + {{ if eq .Status "resolved" }}RESOLVED{{ else }}FIRING{{ end }}: {{ index .CommonLabels "alertname" }}{{ with index .CommonLabels "target" }} {{ . }}{{ else }}{{ with index .CommonLabels "flow_id" }} {{ . }}{{ else }}{{ with index .CommonLabels "instance" }} {{ . }}{{ end }}{{ end }}{{ end }} + ''; + message = '' + {{ range .Alerts -}} + {{ $labels := .Labels -}} + {{ if eq .Status "resolved" }}✅ Resolved{{ else }}🚨 Firing{{ end }}: {{ index $labels "alertname" }} + {{ with index $labels "target" }}Target: {{ . }} + {{ end -}} + {{ with index $labels "flow_id" }}Flow: {{ with index $labels "namespace_id" }}{{ . }}/{{ end }}{{ . }} + {{ end -}} + {{ with index $labels "instance" }}Instance: {{ . }} + {{ end -}} + {{ with index $labels "severity" }}Severity: {{ . }} + {{ end -}} + {{ with index .Annotations "description" }}Details: {{ . }} + {{ end -}} + {{ with .GeneratorURL }}Source: {{ . }} + {{ end }} + {{ end -}} + ''; + headers = { + Template = "grafana"; + Markdown = "yes"; + }; }; } ];