我正在部署 Grafana (v9.4.7) 并且我正在配置警报并想更改 Teams 警报模板。 我在互联网上没有找到太多信息和例子......
目前我的警报是这样的:
{{ define "alert-template" }}
{{ if gt (len .Alerts.Firing) 0 }}
{{ range .Alerts.Firing }} {{ template "alert-teams" .}} {{ end }}
{{ end }}
{{ if gt (len .Alerts.Resolved) 0 }}
{{ range .Alerts.Resolved }} {{ template "alert-teams" .}} {{ end }}
{{ end }}
{{ end }}
{{ define "title-template" }}
{{ .Status | toUpper }}: {{ .CommonLabels.alertname -}}
{{ end }}
{{ define "alert-teams" -}}
Alert: {{ .Labels.alertname }}
{{ if gt (len .Annotations.summary) 0 }}
Summary: {{ .Annotations.summary }}
{{ end }}
{{ if gt (len .Annotations.description) 0 }}
Description: {{ .Annotations.description }}
{{ end }}
{{ if gt (len .Annotations.AlertValues) 0 }}
{{ .Annotations.AlertValues }}
{{ end }}
{{ end }}
我想要一个更漂亮的模板,可以在消息中显示仪表板图像,但我不知道能够做到这一点的变量,以及带有仪表板链接的按钮。 您有任何适用于 Teams 的教程或模板构建器吗?