Linux Labs

Observability: metrics, alerts, logs / Stage 5 of 9 · step 5 of 6

Alerts do not reach the receiver

medium ~30 min
Not running Starting usually ~20 s
Report a problem

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

  1. The ShopInstanceDown alerts with the team="web" and severity="critical" labels reach the web team — /web.
  2. When two instances go down at once, the web team gets them in one notification — one group.
  3. Other critical alerts still go to the on-call engineer — the pager receiver.
  4. The settings are saved in /etc/prometheus/alertmanager.yml, Alertmanager has reloaded the file since the last edit, and amtool check-config passes. 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 ShopInstanceDown rule and the instances themselves need no fixing.

Visible only to you. Saved as you type.

All notes

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

Hints

0 of 3 open · they open one at a time
Hint 1
Show the solution after 3 failed checks

Leave the lab?

The machine keeps running for 10 more minutes, then it is removed. Files are lost; completed goals stay.

Loading…