Grafana 8 Alerting Value Template

Hey Guys,

We did some testing with the ngalerting.
Grafana 8.1.2
Datasource is elastic.

I have some Questions now:

  1. In the alert message, i want to have the url to the dasboard as HTML. I tried the following:

{{ define “alert” }}
{{ range .Alerts.Firing }}
[New Alert]
{{ range .Labels.SortedPairs }}
{{ .Name | title }}: {{ .Value | title }}
{{ end }}
Silence alert: {{ .SilenceURL | safeHtml }}

Dashboard: {{ .DashboardURL | safeHtml }}
{{ range .Annotations.SortedPairs }}
{{ .Name }}: {{ .Value }}
{{ end }}
{{ end }}
{{ end }}

Did i missed something?

  1. I want to have a nice and clean alert. But i can not format the value somehow:

    I just want the Lable and the Value. Not the hole string.
    How can i format that?

Hi @masterblaster

What kind of alerting rule did you create: a classic condition or a multidimensional rule? I believe message template only works with multi-dimensional rules. Check out this link for an explanation of the two and a brief intro to alert templating:

Hey @mattabrams,

I think i createt a multi-dimensional rule. Because the template is working, just not in that way i wanted.

According to your screenshot this is using a classic condition rule:

Maybe try reformulating the alert to use reduce or something and see how that impacts your templating?