Observability: metrics, alerts, logs / Stage 5 of 9 · step 5 of 6
Alerts do not reach the receiver
Situation
The online shop runs on three instances of the application — the lab-shop@1, lab-shop@2 and lab-shop@3
services at 127.0.0.1:8001–8003. Prometheus scrapes their metrics, and when an instance stops answering, the
ShopInstanceDown rule fires an alert with the team="web" and severity="critical" labels. Prometheus hands its
alerts to Alertmanager on the same machine (/etc/prometheus/alertmanager.yml), which sends out the notifications.
The receivers are a training webhook at 127.0.0.1:5001; the path in the URL tells the receivers apart: /web is
the web team's channel (the web-team receiver), /pager is the on-call engineer's phone, /ops is the common
admin channel. Every notification is a JSON line in /var/lib/lab-webhook/notifications.jsonl.
Last night instances 2 and 3 were down for twenty minutes. The web team received nothing.
You can replay the night: sudo systemctl stop lab-shop@2 lab-shop@3, wait forty seconds or so and bring them
back — sudo systemctl start lab-shop@2 lab-shop@3. amtool already knows the Alertmanager address. sudo works
without a password.
Task
- The
ShopInstanceDownalerts with theteam="web"andseverity="critical"labels reach the web team —/web. - When two instances go down at once, the web team gets them in one notification — one group.
- Other critical alerts still go to the on-call engineer — the
pagerreceiver. - The settings are saved in
/etc/prometheus/alertmanager.yml, Alertmanager has reloaded the file since the last edit, andamtool check-configpasses. The Alertmanager service is enabled.
The check stops two shop instances itself, waits up to a minute for the notifications and starts the instances again. The
ShopInstanceDownrule and the instances themselves need no fixing.
Lab goals
0 of 4-
The ShopInstanceDown alerts with the team="web" and severity="critical" labels reach the web team — /web of the training webhook — not checked yet
-
When two instances go down at once, the web team gets them in one notification — one group — not checked yet
-
Other critical alerts still go to the on-call engineer — the pager receiver — not checked yet
-
The settings are saved in /etc/prometheus/alertmanager.yml, Alertmanager has reloaded the file since the last edit, amtool check-config passes; the service is enabled — not checked yet