{{ with $values }}{{ if $values.C }}{{$labels.name }}: {{ $values.B.Value | printf "%.0f" }}W
{{ end }} {{ end }}
My templates:
{{ define "mymessage" }}{{ if gt (len .Alerts.Firing) 0 }}⚠️{{ range .Alerts.Firing }} {{ template "myalert" .}}{{ end }}
{{ end }}{{ if gt (len .Alerts.Resolved) 0 }}❇️{{ range .Alerts.Resolved }} {{ template "myalert" .}}
{{ end }}
{{ end }}
{{ end }}
{{define "myalert"}}{{range .Annotations.SortedPairs}}{{.Value}}
{{end}}
{{ if gt (len .PanelURL ) 0 }}Panel: {{ .PanelURL }}{{ end }}
{{ if gt (len .DashboardURL ) 0 }}Dashboard: {{ .DashboardURL }}
{{ end }}
{{range .Labels.SortedPairs}}
{{.Name }}: {{.Value }} {{ end }}
{{ if gt (len .Annotations) 0 }}
Silence alert: {{ .SilenceURL }}{{ end }}
{{ end }}
The number of the alerts/values in the notification, I mean, the notification alert should have more than one value (3) inside, according to the alert configuration.
But instead inside the notification I’m receiving only one value (the first).
The push notification should be one with the three values that are firing.
Hi! It looks like AlertValue is an annotation with the following template:
{{ with $values }}{{ if $values.C }}{{$labels.name }}: {{ $values.B.Value | printf "%.0f" }}W
{{ end }} {{ end }}
This template will mean that each alert will have one label and value. For example:
Computer: 789W
Depending on the grouping in your notification policy, and the number of alerts that are firing at any point in time, you may get one alert per notification, or multiple alerts per notification. However, each alert in any notification will only have one value in the AlertValues annotation.