alertmanager.yml) and explain how to route alerts to the right receivers. A typical Alertmanager configuration uses three primary sections:
global— default settings applied across receivers (overridable).route— routing tree that maps alerts to receivers.receivers— notification destinations (Slack, email, SMS, webhooks, etc.).
global, a routing tree beginning at route, and concrete receivers that deliver notifications.
Callout for quick context:
This guide focuses on Alertmanager routing: how alerts flow from the top-level route into nested routes, and how receivers and grouping control notification behavior.
global
Theglobal block sets defaults used by receiver configurations (for example, SMTP settings). Any receiver that lacks its own explicit setting will inherit values from global. Common uses include SMTP relay host, email from address, and generic webhook configuration defaults.
route
Theroute section defines the routing tree that decides which alerts are sent to which receivers. At the top level, define a fallback receiver using the top-level receiver field. Alerts that do not match a more specific child route will continue to the fallback.
Example default/fallback route:
receiver— the default receiver to send alerts to.group_by— labels used to group alerts into single notifications.routes— array of child routes, evaluated in order.
Matcher types
Alertmanager supports three common matcher syntaxes. Use the one that best matches your routing needs.
Example combining exact and regex matching:
Sub-routes (nested routes)
Routes can be nested to create parent → child relationships. Matching begins at the top-level route and then descends into child routes. A child route is only considered if its parent route matches. Example: parent route matchesjob: kubernetes; a child route matches severity: pager and overrides the receiver:
- Alerts with
job=kubernetesandseverity=pagerwill route tok8s-pager. - Alerts with
job=kubernetesbut withoutseverity=pagerwill usek8s-email(the parent route receiver).
Example: multiple teams and sub-routes
Below is a practical layout for routing alerts to different teams (database and API), with sub-routes for severities and environments:- The parent route (e.g.,
team: database) determines the initial receiver if no child route matches. - Child routes are evaluated in order and can override the parent receiver if matched.
Reloading configuration
Alertmanager does not automatically reload changes toalertmanager.yml. After editing the file you must apply the update using one of these methods:
- Restart the Alertmanager process (systemd example):
sudo systemctl restart alertmanager
- Send a SIGHUP to the process:
sudo killall -HUP alertmanager
- POST to the reload endpoint:
curl -X POST http://localhost:9093/-/reload
Always validate your YAML before reloading. A malformed configuration can prevent Alertmanager from starting or handling alerts correctly.
Continue behavior (allowing multiple matches)
By default, route traversal stops when a route matches (first match wins). If you want an alert to match a route and then continue to later routes (so the same alert is delivered to multiple receivers), setcontinue: true on the route that should allow further evaluation.
Example — send every alert to alert-logs, and also to k8s-email for Kubernetes alerts:
Grouping alerts
Alertmanager groups alerts for a route into a single notification by default. Usegroup_by to control batching. Child routes inherit group_by from their parent unless they define their own.
Top-level grouping by team:
- Top-level: alerts are grouped by
team. Alerts with the sameteamvalue are batched into single notifications. - For the
infraroute: grouping refines toregionandenv. Alerts with the sameregionandenvvalues are grouped together.
Best practices and final reminders
- Keep
global,route, andreceiverssections well organized and consistent. - Use:
matchfor exact label matches,match_refor regex-based matching,matchersfor advanced matching expressions.
- Use
continue: trueon routes when you intentionally want an alert to be handled by multiple receivers. - Validate YAML and reload Alertmanager after changes.
- Use meaningful
group_bylabels to avoid noisy notifications or overly coarse grouping.
Links and references
- Alertmanager Configuration — official Prometheus Alertmanager docs
- Alertmanager Routing — routing tree and matcher details