From 4c9a988c62c1d2ed2bdab1bc88b7a8577d1de0f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20SCHITZ?= Date: Wed, 7 Aug 2024 17:12:19 +0200 Subject: [PATCH] Create compact_message_notification_template.yaml #366 --- ...compact_message_notification_template.yaml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 etc/grafana/alerting/compact_message_notification_template.yaml diff --git a/etc/grafana/alerting/compact_message_notification_template.yaml b/etc/grafana/alerting/compact_message_notification_template.yaml new file mode 100644 index 00000000..c0144d4c --- /dev/null +++ b/etc/grafana/alerting/compact_message_notification_template.yaml @@ -0,0 +1,25 @@ +# config file version +apiVersion: 1 + +# List of templates to import or update +templates: + # organization ID, default = 1 + - orgId: 1 + # name of the template, must be unique + name: compact.message + # content of the template + template: | + {{- /* Telegram message to use: {{ template "compact.message" . }} */ -}} + {{ define "__alerts_list" -}} + {{ range . }} + {{ if len .Annotations }} + {{ range .Annotations.SortedPairs -}} + - {{ .Name }}: {{ .Value }} + {{ end -}} + {{ end }} + {{- end -}} {{- /* range */ -}} + {{- end -}} {{- /* define __alerts_list */ -}} + {{ define "telegram.message" }} + {{ if gt (len .Alerts.Firing) 0 }} + {{- template "__alerts_list" .Alerts.Firing }}{{ end -}} + {{- end -}} \ No newline at end of file