apiVersion: monitoring.coreos.com/v1alpha1 kind: AlertmanagerConfig metadata: name: telegram labels: alertmanager: main annotations: argocd.argoproj.io/sync-wave: "1" spec: route: groupBy: [cluster, namespace, alertname] # A two-minute grace period absorbs alerts which resolve immediately and # never need to interrupt a human. groupWait: 2m groupInterval: 10m repeatInterval: 12h receiver: telegram routes: - receiver: "null" matchers: - name: alertname value: Watchdog|InfoInhibitor matchType: =~ # Informational alerts remain queryable in Prometheus but do not page the # Telegram chat. Warning and critical alerts still use the parent route. - receiver: "null" matchers: - name: severity value: info matchType: = receivers: - name: telegram telegramConfigs: - botToken: name: alertmanager-telegram key: bot-token # Telegram chat IDs are routing identifiers rather than credentials; # AlertmanagerConfig only supports an integer here, not a Secret ref. chatID: 124317807 sendResolved: true parseMode: HTML message: |- {{ if eq .Status "firing" }}๐Ÿ”ฅ FIRING ยท {{ len .Alerts.Firing }}{{ else }}โœ… RESOLVED ยท {{ len .Alerts.Resolved }}{{ end }} {{ with .CommonLabels.alertname }}{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ end }}{{ with .CommonLabels.severity }} ยท {{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ end }} {{ range .Alerts }} {{ if eq .Status "firing" }}๐Ÿ”ด{{ else }}๐ŸŸข{{ end }} {{ with .Annotations.summary }}{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ else }}{{ .Labels.alertname | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ end }} {{ with .Annotations.description }}{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ end }} {{ if or .Labels.namespace .Labels.job_name .Labels.pod .Labels.container .Labels.node .Labels.instance }} Context {{ with .Labels.namespace }}Namespace: {{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ end }} {{ with .Labels.job_name }}Job: {{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ else }} {{ with .Labels.pod }}Pod: {{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ end }} {{ with .Labels.container }}Container: {{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ end }} {{ with .Labels.node }}Node: {{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ end }} {{ if and (not .Labels.node) .Labels.instance }}Instance: {{ .Labels.instance | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ end }} {{ end }} {{ end }} Started: {{ .StartsAt | tz "Europe/London" | date "2006-01-02 15:04 MST" }} " ">" }}">๐Ÿ“ˆ Open graph{{ with .Annotations.runbook_url }} ยท " ">" }}">๐Ÿ“– Runbook{{ end }} {{ end }} - name: "null"