-
Template name:
telegram.message
-
Content:
{{ define "alert_list" }}{{ range . }}{{ .Labels.alertname }} {{ range .Annotations.SortedPairs }}<strong>{{ .Name }}</strong>: {{ .Value }} {{ end }}| {{ if gt (len .GeneratorURL) 0 }}<a href="{{ .GeneratorURL }}">source</a> | {{ end }}{{ if gt (len .SilenceURL) 0 }}<a href="{{ .SilenceURL }}">silence</a> | {{ end }}{{ if gt (len .DashboardURL) 0 }}<a href="{{ .DashboardURL }}">dashboard</a> | {{ end }}{{ if gt (len .PanelURL) 0 }}<a href="{{ .PanelURL }}">panel</a> |{{ end }} — {{ end }}{{ end }} {{ define "telegram.message" }} {{ if gt (len .Alerts.Firing) 0 }}<strong>FIRING!!!</strong> — {{ template "alert_list" .Alerts.Firing }} {{ if gt (len .Alerts.Resolved) 0 }} {{ end }}{{ end }}{{ if gt (len .Alerts.Resolved) 0 }}<strong>Resolved</strong> — {{ template "alert_list" .Alerts.Resolved }} {{ end }}{{ end }}
-
Contact point | Optional Telegram settings | Message:
{{ template "telegram.message" . }}
-
Add verbose annotations to your alerts. Example:
The <code>{{ $labels.host }}</code> host is low on free space! Used: {{ $values.display.Value }}%
(wheredisplay
is one of the queries). -
I usually add the following queries:
data
(the datasource query),metric
(the reduce expression),condition
, anddisplay
, which isround($metric)
. Multi-dimensional rules documentation.
Also, check out this fork by @gelldur, this templeate is much more cmprehensive.
@otomay, If you are not confident with the meaning of these A/B/C stuff, there's an article you should read carefully https://grafana.com/docs/grafana/next/alerting/alerting-rules/create-grafana-managed-rule/
The meaning of A0, A1, B0, B1, etc. is unique to your alert configuration, you should clearly understand what each of them mean, because Grafana does not help with this at all. As I wrote in the original gist, I tend to give my queries meaningful names:
data
,metric
, andcondition
, this spares me from guessing what does all these A/B/C mean. Your case is specific for your configuration and not related to the template itself, so I'm afraid this is not the right place to seek help, sorry.