Skip to main content

Alertmanager

Alertmanager is the Prometheus component that receives firing alerts, deduplicates and groups them, applies routing and silencing rules, and delivers notifications to Slack, PagerDuty, or email. It turns raw threshold violations into a small number of actionable notifications.

What Alertmanager does

Prometheus evaluates alert rules but does not send notifications itself. It pushes firing alerts to Alertmanager, which decides who hears about them, when, and how often. One failed node that breaks 50 pods becomes one grouped notification instead of 50 pages.

flowchart TD P["Prometheus
evaluates rules"] -->|"firing alerts"| A["Alertmanager"] A -->|"group and dedupe"| R{"Routing tree"} R -->|"severity critical"| PD["PagerDuty
on-call"] R -->|"severity warning"| S["Slack
#prod-warnings"] A -->|"suppress noise"| I["Inhibition and silences"] classDef tool fill:#326CE5,color:#ffffff classDef dest fill:#D1FAE5,color:#1E293B classDef rule fill:#FFEDD5,color:#1E293B class P,A tool class PD,S dest class R,I rule

Core concepts

  • Route: a decision tree that matches alert labels and picks a receiver. The first matching child route wins unless continue: true is set.
  • Receiver: a named destination such as a Slack channel, a PagerDuty service, or a webhook.
  • Inhibition rule: mutes lower-severity alerts while a related higher-severity alert is firing, for example mute pod alerts when the node is down.
  • Silence: temporarily mutes matching alerts, usually for planned maintenance.

Production configuration

YAML
route:
receiver: slack-warnings
group_by: ["alertname", "namespace"]
group_wait: 30s # collect related alerts before the first send
group_interval: 5m # wait before notifying about new alerts in a group
repeat_interval: 4h # re-notify while still firing
routes:
- matchers:
- severity="critical"
receiver: pagerduty-prod
group_wait: 10s
receivers:
- name: slack-warnings
slack_configs:
- channel: "#prod-warnings"
api_url_file: /etc/alertmanager/secrets/slack-url
send_resolved: true
- name: pagerduty-prod
pagerduty_configs:
- routing_key_file: /etc/alertmanager/secrets/pagerduty-key
inhibit_rules:
- source_matchers:
- alertname="NodeDown"
target_matchers:
- alertname=~"Pod.*"
equal: ["node"]

Test routing and manage silences with amtool:

Bash
amtool config routes test --config.file=alertmanager.yaml severity=critical namespace=payments-prod
amtool silence add namespace="payments-prod" --duration=2h --comment="Planned patching"
Tip

Put the first debugging command in the alert annotation, such as kubectl logs {{ $labels.pod }} --previous. An engineer paged at 3am can copy it straight from Slack.

Security

Keep webhook URLs and integration keys in Kubernetes Secrets mounted as files. Anyone who can read the ConfigMap can otherwise read your credentials.

Common Mistake

Skipping group_by and inhibition rules. A single node failure then pages the on-call engineer dozens of times and causes alert fatigue.

Frequently Asked Questions

Why is Alertmanager separate from Prometheus?

Prometheus focuses on evaluating rules and storing metrics, while Alertmanager handles the messier problem of notification delivery. It deduplicates alerts coming from multiple Prometheus replicas, groups them, and applies silences and inhibition, which keeps pages meaningful.

What is the difference between a silence and an inhibition rule?

A silence is a manual, time-limited mute that a person creates, usually for maintenance. An inhibition rule is automatic and permanent: it suppresses an alert whenever a more fundamental alert, such as NodeDown, is already firing.

What do group_wait, group_interval, and repeat_interval each control?

group_wait is the delay before the first notification for a new group, group_interval is the delay before notifying about new alerts added to an existing group, and repeat_interval is how often an unresolved group is re-sent. Tuning all three is what prevents both notification floods and silent gaps.

Found a mistake, an outdated step or a broken link?