TExcelTAD
Home › Site Reliability Engineering: SLOs, Incidents & Chaos › Routing Pages & Tickets with Alertmanager

Routing Pages & Tickets with Alertmanager

Prometheus decides that an alert fires; Alertmanager decides who hears about it, how and how often. For SLO alerts the routing is simple and strict: severity="page" goes to the on-call pager, severity="ticket" goes to the team's ticket queue, and a page suppresses the ticket for the same problem. Observability covers Alertmanager's configuration in general; this lesson configures it for SLOs and tests it with amtool.

The configuration

bash · try it yourself
cat > alertmanager.yml <<'YML'
route:
  receiver: default
  group_by: [alertname, job]
  routes:
    - matchers: ['severity="page"']
      receiver: oncall-pager
      group_wait: 30s
      repeat_interval: 1h
    - matchers: ['severity="ticket"']
      receiver: sre-tickets
      group_wait: 5m
      group_interval: 30m
      repeat_interval: 1d
inhibit_rules:
  - source_matchers: ['severity="page"']
    target_matchers: ['severity="ticket"']
    equal: [alertname, job]
receivers:
  - name: default
  - name: oncall-pager
    pagerduty_configs:
      - routing_key_file: /etc/alertmanager/pagerduty-key
  - name: sre-tickets
    webhook_configs:
      - url: http://ticket-bridge.internal:8080/alertmanager
YML
amtool check-config alertmanager.yml
amtool config routes --config.file=alertmanager.yml
amtool config routes test --config.file=alertmanager.yml severity=page alertname=CheckoutErrorBudgetBurn
amtool config routes test --config.file=alertmanager.yml severity=ticket
# a CI check: the ticket must NOT reach the pager
amtool config routes test --config.file=alertmanager.yml --verify.receivers=oncall-pager severity=ticket 2>&1
echo "exit $?"
Checking 'alertmanager.yml'  SUCCESS
Found:
 - global config
 - route
 - 1 inhibit rules
 - 3 receivers
 - 0 templates

Routing tree:
.
└── default-route  receiver: default
    ├── {severity="page"}  receiver: oncall-pager
    └── {severity="ticket"}  receiver: sre-tickets

oncall-pager
sre-tickets
sre-tickets
WARNING: Expected receivers did not match resolved receivers.
exit 1

What the pieces do:

Setting Effect
group_by: [alertname, job] alerts with the same name and job become one notification, not one per pod or route
group_wait: 30s (page) waits briefly after the first alert so related ones arrive in the same page
repeat_interval: 1h (page) re-notifies an unresolved page every hour; tickets once a day
inhibit_rules while a page fires for CheckoutErrorBudgetBurn on job="checkout", the matching ticket is muted: one problem, one notification
routing_key_file the PagerDuty integration key is read from a file (a mounted secret), not written into the config

amtool config routes test prints the receiver(s) a set of labels would reach. With --verify.receivers it becomes an assertion: the exit code is 1 when the result differs, so the same command guards the routing in CI. Use it for every rule that must never be broken, such as "tickets never page".

Catching mistakes before deployment

amtool check-config validates references between routes and receivers:

bash · try it yourself
cat > alertmanager.yml <<'YML'
route:
  receiver: default
  routes:
    - matchers: ['severity="page"']
      receiver: oncall-pagr
receivers:
  - name: default
  - name: oncall-pager
YML
amtool check-config alertmanager.yml 2>&1
echo "exit $?"
Checking 'alertmanager.yml'  FAILED: undefined receiver "oncall-pagr" used in route

amtool: error: failed to validate 1 file(s)

exit 1

A typo in a receiver name would otherwise surface only when Alertmanager refuses to reload, during the incident that needed the page.

Silences, maintenance and acknowledgements

  • Acknowledge a page in the paging tool (PagerDuty, Opsgenie, Grafana IRM, …) when you start working on it; that stops escalation to the secondary.
  • Silence in Alertmanager for planned work or a known issue being fixed, always with an end time and a comment:
bash
# sample session: needs a running Alertmanager
$ amtool --alertmanager.url=http://alertmanager:9093 silence add \
    alertname=CheckoutErrorBudgetBurn job=checkout \
    --duration=2h --comment="DB migration INC-2041, M. Rossi"
4f1c6a8e-0b7d-4a51-9b4e-2f7c2d1f9a10
$ amtool --alertmanager.url=http://alertmanager:9093 silence query
ID                                    Matchers                                              Ends At                  Created By  Comment
4f1c6a8e-0b7d-4a51-9b4e-2f7c2d1f9a10  alertname="CheckoutErrorBudgetBurn" job="checkout"  2026-03-02 16:05:00 UTC  mrossi      DB migration INC-2041, M. Rossi
  • Don't silence SLO alerts "until fixed" without an end time: the next, different incident on the same service would be silent too.
  • Budget spent during maintenance still counts unless your SLO document excludes it; silencing only changes who gets woken.

Test yourself

Why add an inhibit rule from page to ticket for the same alert and job?

  1. Tickets are never needed
  2. So one problem produces one notification: the page, not a page plus a ticket
  3. Inhibit rules make pages faster
  4. Alertmanager requires it

What does amtool config routes test --verify.receivers=oncall-pager severity=ticket do when the ticket goes to sre-tickets?

  1. Sends a test page
  2. Prints sre-tickets, warns that the receivers don't match and exits with 1
  3. Changes the route
  4. Nothing

What should every Alertmanager silence have?

  1. No end time
  2. An end time and a comment saying why and who
  3. A severity label
  4. A receiver