Alerting
A small team needs every page to reach a phone. It also needs a separate signal when alerting itself is broken. Alerts start as Prometheus rules and go to Alertmanager. From there, they go to two receivers. A third path, the dead-man check, is outside Alertmanager on purpose. A dead-man check pages when an expected heartbeat stops.
Prometheus rules --> Alertmanager --> page (webhook to the phone + email) --> warn (email) --> deadman (Watchdog heartbeat, every minute) | dead-man check: no heartbeat for 5 min --> WatchdogMissing, paged on its own pathRoutes
Section titled “Routes”Alertmanager groups alerts by alertname and pop, and routes them with
these rules:
| Match | Receiver | Wait before the first notification | Between updates | Repeated while firing |
|---|---|---|---|---|
alertname=Watchdog |
deadman |
0 s | 1 min | on every 1-minute tick (repeat interval 50 s) |
severity=page |
page |
10 s | 1 min | every hour |
severity=warn, and anything else |
warn |
30 s | 5 min | every 4 hours |
The default route is warn, so an alert without a severity still arrives
at a receiver. Alertmanager sends resolved notifications for page and
warn.
| Receiver | Delivers to |
|---|---|
page |
a mobile push webhook and an email |
warn |
an email |
deadman |
an external heartbeat service |
The emails share one template. A subject looks like
[WARN] PoPDrained pop=<pop> (1 firing). The webhook and heartbeat URLs
are secret files that the deployment renders. They are never inline in the
configuration.
PoPDrained is a warning one minute after any drain. It reminds you to
undrain the PoP (a server location).
Inhibition
Section titled “Inhibition”Some alerts mute other alerts while they fire, so that one incident pages one time:
| While this fires | Muted |
|---|---|
PrefixWithdrawnEverywhere |
every alert with a pop label, and MultiplePoPsWithdrawn |
CertificateExpiresVerySoon |
CertificateExpiresSoon for the same PoP |
HostDiskFull |
HostDiskFilling for the same PoP, server and mount point |
For planned work, silence by label for the window (amtool silence add pop=<pop> --duration 2h ...). Never disable rules for planned work. A
drain already produces only the PoPDrained warning. Never silence
Watchdog. If you do, the dead-man check pages five minutes later.
The dead-man check
Section titled “The dead-man check”Watchdog is a rule that always fires (vector(1)). Alertmanager sends
it to the deadman receiver every minute. A listener outside the alerting
path receives it. If no heartbeat arrives for 5 minutes, the listener pages
WatchdogMissing over its own webhook and email, not through Alertmanager.
This covers every way that alerting can fail: Prometheus down, rule evaluation stuck, Alertmanager down, or a broken path from Alertmanager to the receivers. The listener pages one time, then again every hour while the heartbeat is missing. It sends a resolved page when the heartbeat returns.
In production, the listener is an external heartbeat service (planned, see above). It is outside both the cloud of the control plane and the network of the PoPs. The Watchdog pings it. If the pings stop for 5 minutes, the service notifies the phone.
fleetctl deadman is a listener that you run yourself, with the same
contract. GET /status shows the heartbeat count, the age of the last
heartbeat, and whether it is paging:
| Flag | Environment | Default |
|---|---|---|
--max-age |
DEADMAN_MAX_AGE |
5m: page when no heartbeat arrived for this long |
--repeat |
DEADMAN_REPEAT |
1h: page again while missing (0: once) |
--check |
DEADMAN_CHECK |
15s: how often it checks |
--alertname |
DEADMAN_ALERTNAME |
Watchdog |
--webhook, --smtp, --mail-from, --mail-to |
DEADMAN_WEBHOOK_URL, DEADMAN_SMTP, DEADMAN_MAIL_FROM, DEADMAN_MAIL_TO |
where it pages (at least one) |
A WatchdogMissing page means that you have no alerting. If you get one,
do these steps:
- Make sure that DNS itself answers.
- Find the broken hop. Examine the hops in this order: Prometheus ready,
the
alerting-metarule group healthy, Prometheus sees an active Alertmanager, Alertmanager ready, the Watchdog present in Alertmanager, the webhook of thedeadmanreceiver not failing. - After the repair, read the
ALERTShistory for the gap. Alerts can have fired and resolved while nobody saw them.
AlertmanagerNotificationsFailing (warn, 10 minutes) names an integration
(email or webhook) whose notifications fail. Alertmanager tries failed
notifications again while the alert continues to fire.
The drill
Section titled “The drill”- Delivery:
amtool alert add alertname=DeliveryTest severity=pagemust reach the phone within the 10 s group wait. A drain must reachwarnasPoPDrainedafter about a minute and a half. That is the 1-minuteforof the rule, plus evaluation and group wait. - Dead-man check: stop Alertmanager.
WatchdogMissingpages about 5 minutes later. The resolved page follows soon after Alertmanager starts again. - Inhibition: a
PrefixWithdrawnEverywherepage suppresses the per-PoP pages sent with it.
Host alerts
Section titled “Host alerts”Every PoP server runs node_exporter 1.12.1 (pinned by digest). It runs as
the node-exporter task of the pop-system Nomad job. It listens on
127.0.0.1:9102, and Prometheus scrapes it as job node. Nine alerts use
it, and each alert has a section in the host alerts runbook. The Grafana
dashboard opdns / hosts shows the same series for each PoP and server.
| Alert | Severity | Fires when |
|---|---|---|
HostExporterDown |
warn | the exporter did not answer scrapes for 5 minutes (no other host alert can fire for that server during this time) |
HostDiskFilling |
warn | a file system has under 15 % free for 15 minutes |
HostDiskFull |
page | under 5 % free for 5 minutes (mutes the warning) |
HostHighLoad |
warn | 5-minute load over 1.5 per CPU for 15 minutes |
HostNICErrors |
warn | drops and errors over 1 a second on an interface for 10 minutes |
HostUDPReceiveErrors |
warn | the kernel drops over 10 UDP datagrams a second for 10 minutes (DNS queries lost before the edge reads them) |
HostConntrackFull |
warn | the connection-tracking table over 80 % full for 5 minutes (DNS ports must bypass it) |
HostClockUnsynchronised |
warn | the clock is not synchronized, or is more than 50 ms off, for 10 minutes |
HostRebootRequired |
warn | a reboot is pending for a day. Reboot through drain with fleetctl fleet reboot (Fleet operations) |
The same last resort applies to all of these alerts. If the server cannot continue to serve, drain its PoP. The other PoPs of the anycast network then take the traffic. The statistics of Unbound are not host metrics. The edge exports them (Resolver operations).