Alertmanager Route Tree Generator
Pure frontend: fill in the form, copy the configuration. The generator never connects to Alertmanager, sends no notifications and triggers no reload.
How to use it
Set a default receiver, grouping dimensions and timing, optionally add severity-based child routes and a root-cause inhibit rule, then click Generate for a YAML fragment. Copy it into your alertmanager.yml, validate with amtool check-config, and inject a test alert to confirm it reaches the intended receiver. Generating is not applying: a configuration reload sits between the two.
Order decides everything in a route tree
A route is a tree, not a list. An alert enters at the root and child routes are checked in configuration order. When all matchers on a child match, that child takes the alert and no later sibling is examined, unless you explicitly set continue: true. Put the most specific routes first. A P0 route needs continue to be true if the same alert should also reach a team channel. Multiple matchers on one route are ANDed, never ORed.
Current versions use a matchers string array supporting =, !=, =~ and !~. The old match and match_re keys are ignored or rejected, which shows up as "every alert goes to default" and is genuinely confusing. This generator emits only the current syntax.
Grouping controls notification density. group_by decides which alerts merge into one message. group_wait gives a new group a moment to fill up so you do not send one message and then nineteen more. group_interval is how often new alerts in an existing group are checked. repeat_interval is how often an un-resolved alert reminds you. Putting instance in group_by can turn one cluster upgrade into dozens of independent notifications; a P0 repeat_interval that is too long means nobody is reminded of an unfixed critical alert.
Inhibit suppresses symptoms, not time
An inhibit rule says: while the source alert exists, suppress notifications for the target alert. The classic case is suppressing an inode alert when the disk is full. The root cause is present, so the derived symptom has nothing to add. Of the four parts, source_matchers identifies the root cause, target_matchers the suppressed alerts, equal lists labels that must match on both sides, and name makes the rule traceable in logs.
The most common failure is a mismatch in equal labels: one alert calls it instance, the other node; or one includes a port and the other does not. Alertmanager does not complain, it simply never applies the rule. The other classic is reversing source and target, so a warning suppresses a critical and the phone never rings. After writing the rule, use amtool config routes test with concrete label sets and see which receiver each alert reaches.
Four layers, not one magic setting
Routing is only one of four layers. The first lives in Prometheus rules: for suppresses transient flapping, and a ten-minute window can cut a noisy CPU alert from forty a day to a handful. The second is grouping, which decides whether one incident produces one notification. The third is inhibition, which handles cause and symptom. The fourth is routing, which sends P0 to a phone and info to an archive. Expecting any single layer to solve all noise problems never works.
Silence is not one of the permanent layers. Add it before a maintenance window, scoped to the alert names, cluster and instances you are actually touching; a bare severity=warning silences other services too. It expires automatically, so nobody has to remember to remove it.
Labels are the foundation. Routing only matches labels present on the alert instance. If your Prometheus rules never set severity, no severity route can match and everything falls through. Set severity, team and cluster structurally in the rule, not by writing "critical" into the alert name and hoping a regex finds it. Avoid putting a receiver name in an alert label: that turns one route tree into hundreds of configuration fragments and forces a rule edit every time the on-call rotation changes.
Kubernetes has an extra trap. Prometheus Operator can inject a matcher such as namespace="cattle-monitoring-system" into rendered routes. Alerts from another namespace then drop quietly to default while the configuration looks correct. When a rule is clearly firing but nobody is notified, dump the live configuration and look for injected matchers before touching anything else.
After you change the configuration
Alertmanager reads its configuration at startup and on reload. Change the file without reloading and amtool is testing the old tree, so the conclusion is worthless. Reload via POST /-/reload, SIGHUP or your platform's configuration flow. With multiple replicas, confirm all of them loaded the change; otherwise identical alerts can take different paths.
Verify in three steps. amtool check-config alertmanager.yml checks syntax. amtool config routes show prints the parsed tree. amtool config routes test --config.file=... severity=critical team=db shows the receiver for concrete labels. When all three pass, inject a real-format alert through the API for an end-to-end check. Stopping after the first step is the most common way to break this.
For worked examples, read Alertmanager noise reduction in practice. For rule-side for windows and expressions, see Prometheus alerting configuration. Field names and semantics follow the official Alertmanager configuration documentation.