Enhance AlertManagerConfig documentation with detailed comments on receivers, inhibit rules, and routing configurations

Sofiane Gerhardt 2025-10-15 17:13:16 +02:00
parent 4c34aac394
commit d01bea732b
Signed by: sofiane.gerhardt
SSH key fingerprint: SHA256:B+mV6AyYLX4aUI1b5gXcuADKOT8LepFIxknwPyd26f0

@ -34,6 +34,7 @@ kind: AlertmanagerConfig
metadata: metadata:
name: alerts name: alerts
spec: spec:
# Receivers define destinations for alerts (email, pagerduty, webhook, etc.)
receivers: receivers:
- name: email-receiver - name: email-receiver
emailConfigs: emailConfigs:
@ -47,8 +48,10 @@ spec:
sendResolved: true sendResolved: true
headers: headers:
- key: Subject - key: Subject
# Template used to format email subject. Includes namespace, status and group labels.
value: '[{{ .CommonLabels.namespace }}][{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}' value: '[{{ .CommonLabels.namespace }}][{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}'
# InhibitRules suppress notifications for lower-severity alerts when a matching higher-severity alert is firing
inhibitRules: inhibitRules:
- sourceMatch: - sourceMatch:
- name: severity - name: severity
@ -56,16 +59,19 @@ spec:
targetMatch: targetMatch:
- name: severity - name: severity
value: warning value: warning
equal: ["alertname"] equal: ["alertname"] # Fields that must match between source and target alerts to apply inhibition
# Route defines how alerts are grouped and which receiver is used by default
route: route:
groupBy: groupBy:
- alertname - alertname # Alerts with the same values for these labels are grouped together
- severity - severity
groupWait: 30s groupWait: 30s # Wait time to collect alerts before sending first notification for a group
groupInterval: 5m groupInterval: 5m # Minimum interval between notifications for an alert group
repeatInterval: 12h repeatInterval: 12h # How often to resend notifications for ongoing alerts
receiver: email-receiver receiver: email-receiver # Default receiver for alerts that don't match child routes
# Child routes allow overriding routing for specific alert matchers (e.g., severity)
routes: routes:
- matchers: - matchers:
- name: severity - name: severity