I am working with the alerts in grafana v9, I need each alert to arrive individually to Teams and not grouped in the same message. The truth was I was reading documentation in the forums and I did not find anything.
This is how my alert arrives now, all together in the same message
mytemplate
{{ define “SingleAlertContent” }}
Alerta: [{{.Status}}] {{ .Labels.alertname }}
{{ with .ValueString }}
{{- . | reReplaceAll \[\s
“” | reReplaceAll \],\s
“\n” | reReplaceAll \]
“” | reReplaceAll var='[A-Z0-9a-z]+'\s
“” | reReplaceAll labels=\{[A-Za-z0-9_\-\=\s\.:,]+\}\s
“” | reReplaceAll metric='(.*)'
" \n*$1* " | reReplaceAll value=([0-9\.]+)
“($1)\n” }}
{{ end }}
{{ if gt (len .Annotations) 0 }}
Detalle:
{{ range .Annotations.SortedPairs }}
{{ .Name }}: {{ .Value }}
{{ end }}
{{ end }}
{{ end }}
mymessage
{{ define “mymessage” }}
{{ if gt (len .Alerts.Firing) 0 }}
{{ len .Alerts.Firing }} firing:
{{ range .Alerts.Firing }} {{ template “SingleAlertContent” .}} {{ end }}
{{ end }}
{{ end }}