@@ -94,27 +94,30 @@ locals {
9494
9595 alertmanager_template_files = length (local. alertmanager . slack_routes ) > 0 ? {
9696 " slack.tmpl" = <<- EOT
97- {{ define "slack.title" -}}
98- [{{ .Status | toUpper }}
99- {{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{- end -}}
100- ] {{ .CommonLabels.alertname }}
101- {{ end }}
102- {{ define "slack.text" -}}
103- {{ range .Alerts }}
104- *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
105- {{- if .Annotations.description }}
106- *Severity:* `{{ .Labels.severity }}`
107- *Description:* {{ .Annotations.description }}
108- {{- end }}
109- *Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:>
110- *Labels:*
111- {{ range .Labels.SortedPairs }} - *{{ .Name }}:* `{{ .Value }}`
112- {{ end }}
113- {{- if .Annotations.runbook_url }}
114- *Runbook URL:* <{{ .Annotations.runbook_url }}|Click here>
115- {{- end }}
97+ {{ define "slack.title" -}}
98+ [{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }}
99+ {{ end }}
100+
101+ {{ define "slack.text" -}}
102+ {{ with index .Alerts 0 -}}
103+ :chart_with_upwards_trend: *<{{ .GeneratorURL }}|Source Graph>*
116104 {{ end }}
105+ {{- range .Alerts -}}
106+ *Severity:* `{{ .Labels.severity }}`
107+ {{- if .Annotations.summary }}
108+ *Alert:* {{ .Annotations.summary }}
109+ {{- end }}
110+ {{- if .Annotations.description }}
111+ *Description:* {{ .Annotations.description }}
112+ {{- end }}
113+ {{- if .Annotations.runbook_url }}
114+ *Runbook URL:* <{{ .Annotations.runbook_url }}|Click here>
115+ {{- end }}
116+ *Labels:*
117+ {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
118+ {{ end }}
117119 {{ end }}
120+ {{ end }}
118121 EOT
119122 } : {}
120123
0 commit comments