Hello Folk,
I had the following code implemented under
Alerting → Contact Points (Grafana as Alertmanager) → EMail → Subject
{{ if eq .Status “firing” }} [Alerting] {{index .CommonLabels “alertname” }} {{end}} {{ if gt (.Alerts.Resolved | len) 0 }} [OK] {{index .CommonLabels “alertname”}} {{end}}
It stopped to work.
I tried to simplify and I came to:
{{ if .Alerts.Firing }}[Alerting] Fire ON {{ .Alerts.EntityName }} {{ end }} {{ if .Alerts.Resolved }}[OK] Fire OFF {{ .Alerts.EntityName }} {{ end }}
But this return the following outcome:
" [Alerting] Fire ON [{firing map[EntityName:XXX alertname:XXX grafana_folder:OPS API Dashboard Alerts - QFqiNzJMk rule_id:XXX] map[Rule ID:XXX] 2023-06-19 09:43:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC https://XXX/view?orgId=1 XXX https:/XXX/alerting/silence/new?alertmanager=grafana&matcher=EntityName%3DXXX&matcher=alertname%3DXXX&matcher=grafana_folder%3DOPS+API+Dashboard+Alerts±+XXX&matcher=rule_id%3DXXX https://XXX?orgId=1 https://XXX?orgId=1&viewPanel=68 map[C:122.6 D:1] [ var=‘C’ labels={EntityName=XXX} value=122.6 ], [ var=‘D’ labels={EntityName=XXX} value=1 ] }]"
I replaced with XXX internal names. Can you suggest and easy solution? I checked in documentation but it seems that there is no answer to a Simple question like “setting up dynamically the title of the alert”…