From d5bfdaca25fd04be0b273f8feacb13076148c6a4 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Wed, 22 May 2024 15:20:27 -0500 Subject: [PATCH] v-m/alertmanager-ntfy: Add labels to notifications Just having the alert name and group name in the ntfy notification is not enough to really indicate what the problem is, as some alerts can generate notifications for many reasons. In the email notifications AlertManager sends by default, the values (but not the keys) of all labels are included in the subject, so we will reproduce that here. --- victoria-metrics/alertmanager-ntfy.config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/victoria-metrics/alertmanager-ntfy.config.yml b/victoria-metrics/alertmanager-ntfy.config.yml index c1333bd..730b9a8 100644 --- a/victoria-metrics/alertmanager-ntfy.config.yml +++ b/victoria-metrics/alertmanager-ntfy.config.yml @@ -19,6 +19,9 @@ ntfy: {{ else -}} {{ index .Labels "alertname" }} {{ index .Labels "alertgroup" }} + {{ range $key, $value := .Labels -}} + {{ if not (eq $key "alertname" "alertgroup") }}{{ $value }} {{ end -}} + {{ end -}} {{ end -}} description: | {{ index .Annotations "description" }}