Last active
May 22, 2024 13:03
-
-
Save lephleg/fa07777eb8147edae1d41b0d87e8a87e to your computer and use it in GitHub Desktop.
Ads A8C Grafana Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ define "ads.slack.title" }} | |
{{ if gt (len .Alerts.Firing) 0 }} | |
🔥 {{ len .Alerts.Firing }} alert(s) firing | |
{{ end }} | |
{{ if gt (len .Alerts.Resolved) 0 }} | |
✅ {{ len .Alerts.Resolved }} alert(s) resolved | |
{{ end }} | |
{{ end }} | |
{{ define "ads.slack.alert_links" }} | |
{{ if gt (len .DashboardURL) 0 }}<{{ .DashboardURL }}|Dashboard> | {{ end }}{{ if gt (len .PanelURL) 0 }}<{{ .PanelURL }}|Panel> | {{ end }}{{ if gt (len .GeneratorURL) 0 }}<{{ .GeneratorURL }}|Alert> | {{ end }}{{ if gt (len .SilenceURL) 0 }}<{{ .SilenceURL }}|Silence>{{ end }} | |
{{ end }} | |
{{ define "ads.slack.alert_firing" }} | |
*{{ .Annotations.summary }}* | |
{{ .Annotations.description }} | |
{{ template "ads.slack.alert_links" .}} | |
{{ end }} | |
{{ define "ads.slack.alert_resolved" }} | |
*{{ .Annotations.summary }}* | |
{{ template "ads.slack.alert_links" .}} | |
{{ end }} | |
{{ define "ads.slack.message" }} | |
{{ if gt (len .Alerts.Firing) 0 }} | |
{{ range .Alerts.Firing }} {{ template "ads.slack.alert_firing" .}} {{ end }} | |
{{ end }} | |
{{ if gt (len .Alerts.Resolved) 0 }} | |
{{ range .Alerts.Resolved }} {{ template "ads.slack.alert_resolved" .}} {{ end }} | |
{{ end }} | |
{{ end }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Refers to this: https://mc.a8c.com/grafana/alerting/notifications/templates/Ads%20Slack%20Notifications/edit?alertmanager=grafana