Files
homelab/k8s-ng/core/prom-stack/alertmanager-config.yaml
T
Aleksandr Bogomiakov f2d5b97465
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 29s
Fixed alert reporting, instance label, gitea limits
2026-10-08 17:03:46 +01:00

61 lines
3.5 KiB
YAML

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" }}🔥 <b>FIRING · {{ len .Alerts.Firing }}</b>{{ else }}✅ <b>RESOLVED · {{ len .Alerts.Resolved }}</b>{{ end }}
{{ with .CommonLabels.alertname }}<b>{{ . | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}</b>{{ end }}{{ with .CommonLabels.severity }} · <code>{{ . | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}</code>{{ end }}
{{ range .Alerts }}
{{ if eq .Status "firing" }}🔴{{ else }}🟢{{ end }} {{ with .Annotations.summary }}<b>{{ . | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}</b>{{ else }}<b>{{ .Labels.alertname | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}</b>{{ end }}
{{ with .Annotations.description }}{{ . | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}{{ end }}
{{ if or .Labels.namespace .Labels.pod .Labels.container .Labels.node .Labels.instance }}
<b>Context</b>
{{ with .Labels.namespace }}Namespace: <code>{{ . | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}</code>{{ end }}
{{ with .Labels.pod }}Pod: <code>{{ . | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}</code>{{ end }}
{{ with .Labels.container }}Container: <code>{{ . | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}</code>{{ end }}
{{ with .Labels.node }}Node: <code>{{ . | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}</code>{{ end }}
{{ if and (not .Labels.node) .Labels.instance }}Instance: <code>{{ .Labels.instance | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}</code>{{ end }}
{{ end }}
Started: {{ .StartsAt | tz "Europe/London" | date "2006-01-02 15:04 MST" }}
<a href="{{ .GeneratorURL | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}">📈 Open graph</a>{{ with .Annotations.runbook_url }} · <a href="{{ . | reReplaceAll "&" "&amp;" | reReplaceAll "<" "&lt;" | reReplaceAll ">" "&gt;" }}">📖 Runbook</a>{{ end }}
{{ end }}
- name: "null"