I’m trying to format my Slack alerts (which is a horrible experience compared to the good old days of just typing the text you want for the alert), and I keep getting a strange indent in the alert text.
My Slack Contact Point template:
{{ define "slack.default.title" }}
[ Alerting ]
{{ end }}
{{ define "slack.default.message" }}
{{ range . }}
{{ if gt (len .Annotations.summary) 0 }}{{ .Annotations.summary }} {{ end }}
{{ if gt (len .DashboardURL) 0 }}Dashboard: {{ .DashboardURL }}{{ end }}
{{ end }}
{{ end }}
{{ define "slack.resolved.message" }}
{{ range . }}
{{ .Labels.alertname }} on {{ .Labels.node_name }}
{{ if gt (len .DashboardURL) 0 }}Dashboard: {{ .DashboardURL }}
{{ end }}
{{ end }}
{{ end }}
{{ define "slack" }}
{{ if gt (len .Alerts.Firing) 0 }}Alerting{{ template "slack.default.message" .Alerts.Firing }}{{ end }}
{{ if gt (len .Alerts.Resolved) 0 }}OK{{ template "slack.resolved.message" .Alerts.Resolved }}{{ end }}
{{ end }}
The body of the contact point:
I don’t understand why this indent is showing up and it’s driving me crazy!