Microsoft Teams 的 Grafana 警报模板 [关闭]

问题描述 投票:0回答:0

我正在部署 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 }}

在警报中,我有这个注释: Alert Annotations

导致此示例警报: Teams Alert

我想要一个更漂亮的模板,可以在消息中显示仪表板图像,但我不知道能够做到这一点的变量,以及带有仪表板链接的按钮。 您有任何适用于 Teams 的教程或模板构建器吗?

grafana microsoft-teams grafana-alerts grafana-templating observability
© www.soinside.com 2019 - 2024. All rights reserved.