Step 5 of 6 · lab · 30 min
Alerts do not reach the receiver
Two instances of the online shop were down for twenty minutes last night. Prometheus saw it and the alert fired, yet the team in charge of the shop received not a single notification. Find where the alerts get lost and make the team learn about the instances that went down in one message.
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 · on your own
No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.
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 done yet
-
When two instances go down at once, the web team gets them in one notification — one group — not done yet
-
Other critical alerts still go to the on-call engineer — the pager receiver — not done 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 done yet
The machine is starting
Hints
0 of 3Lab 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 done yet
-
When two instances go down at once, the web team gets them in one notification — one group — not done yet
-
Other critical alerts still go to the on-call engineer — the pager receiver — not done 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 done yet
Goals are checked on the machine after every command.