Grafana¶
Unified Alerting¶
Since Grafana 10, the legacy alerting system is gone and unified alerting is the only option.
Enable screenshots¶
A prerequisite for screenshots is Grafana Image Renderer. Either install the plugin or configure remote rendering. Then just add the following config:
/etc/grafana/grafana.ini
[unified_alerting.screenshots]
capture = true
Notification template for Telegram¶
{{ define "alert_list" -}}
{{ range . }}[{{ .Labels.alertname }}] {{ .Labels.host }}: {{ .Values.B }}
{{ 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 }}