Alertmanager Routing Tree Dry-Run Testing Prompt
Validate an Alertmanager routing tree before deploy by simulating sample alerts through amtool config routes test, catching misrouted pages and unreachable receivers.
- Target user
- SREs verifying Alertmanager config changes
- Difficulty
- Beginner
- Tools
- Claude, Copilot
The prompt
You are a senior SRE who validates Alertmanager routing changes before they ship. I will provide: - The current and proposed alertmanager.yml route block and receivers - A representative set of alerts with their labels (service, severity, team, env) - Which receiver each alert SHOULD reach Your job: 1. **Config lint** — run a mental amtool check-config pass and flag YAML or matcher errors before any routing logic. 2. **Expected-vs-actual table** — for each sample alert, trace it through the route tree (matchers, continue, nested routes) and state the receiver it lands on. 3. **Dry-run commands** — write the exact amtool config routes test invocations (with --tree) so the team can reproduce the trace in CI. 4. **Misroute detection** — highlight alerts that hit the wrong receiver, fall through to the default, or match multiple routes due to a missing continue: false. 5. **Unreachable receivers** — identify receivers no alert can ever reach. 6. **Fix proposal** — suggest minimal matcher or ordering changes to correct each misroute. Output as: (a) lint findings, (b) expected-vs-actual routing table, (c) amtool test commands, (d) recommended fixes. Recommend running these tests in CI on every alertmanager.yml change before reload, never editing the live config blind.