fix(alertmanager): quote null receiver and wire telegram template
Unquoted null parses as YAML null and breaks routing. Add shared telegram message template.
This commit is contained in:
1 parent
c98ea8b957
commit
5936de3e56
3 files changed
+56
-3
No files matched your search
@@ -0,0 +1,44 @@
|
||||
{{- define "telegram.forust.message" -}}
|
||||
{{- $statusEmoji := "🚨" -}}
|
||||
{{- if ne .Status "firing" -}}{{- $statusEmoji = "✅" -}}{{- end -}}
|
||||
{{- $count := len .Alerts.Firing -}}
|
||||
{{- if eq .Status "resolved" -}}{{- $count = len .Alerts.Resolved -}}{{- end -}}
|
||||
{{ $statusEmoji }} <b>{{ .Status | toUpper }} ({{ $count }})</b>
|
||||
{{- range .Alerts }}
|
||||
|
||||
<b>{{ .Labels.alertname }}</b>
|
||||
{{- $sev := .Labels.severity }}
|
||||
{{- if eq $sev "critical" }} 🔥 critical
|
||||
{{- else if eq $sev "warning" }} ⚠️ warning
|
||||
{{- else if eq $sev "info" }} ℹ️ info
|
||||
{{- else if $sev }} • {{ $sev }}
|
||||
{{- end }}
|
||||
{{- if .Annotations.description }}
|
||||
|
||||
<i>{{ .Annotations.description }}</i>
|
||||
{{- end }}
|
||||
{{- if .Labels.namespace }}
|
||||
📦 Namespace: <code>{{ .Labels.namespace }}</code>
|
||||
{{- end }}
|
||||
{{- if .Labels.pod }}
|
||||
📦 Pod: <code>{{ .Labels.pod }}</code>
|
||||
{{- end }}
|
||||
{{- if .Labels.container }}
|
||||
🐳 Container: <code>{{ .Labels.container }}</code>
|
||||
{{- end }}
|
||||
{{- if .Labels.node }}
|
||||
🖥 Node: <code>{{ .Labels.node }}</code>
|
||||
{{- end }}
|
||||
{{- if .Labels.instance }}
|
||||
🖥 Instance: <code>{{ .Labels.instance }}</code>
|
||||
{{- end }}
|
||||
{{- if .Labels.job }}
|
||||
🔧 Job: <code>{{ .Labels.job }}</code>
|
||||
{{- end }}
|
||||
{{- if eq .Status "firing" }}
|
||||
🕐 Since: <code>{{ .StartsAt | date "2006-01-02 15:04 MST" }}</code>
|
||||
{{- else }}
|
||||
🕐 Resolved: <code>{{ .EndsAt | date "2006-01-02 15:04 MST" }}</code>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in new issue
Block a user