Linux Labs

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

A machine dropped out of monitoring

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

Situation

This server is watched by the office monitoring. Prometheus runs right here: every 5 seconds it scrapes the metrics of the machine itself — CPU, memory, disks, network — from the node_exporter exporter. In the Prometheus configuration this is the node job.

Since last night the machine's graphs have been empty, and the on-call summary shows its up as 0. Meanwhile Prometheus keeps scraping its own metrics just fine.

There is no browser to the machine, so look at Prometheus from the terminal: queries — promtool query instant http://localhost:9090 '<query>', its API — curl -s localhost:9090/api/v1/… and jq. sudo works without a password.

Task

  1. The node job's target in Prometheus is up: promtool query instant http://localhost:9090 'up{job="node"}' prints => 1.
  2. node_exporter runs as the prometheus-node-exporter service; the service is enabled and listens on port 9100.
  3. The settings are saved in files: promtool check config /etc/prometheus/prometheus.yml passes, Prometheus runs with what the file says, the prometheus service is enabled — after the services restart the machine stays in monitoring.

Constraints

  • node_exporter listens on port 9100 on every office server — that is how the other Prometheus servers find the machine.
  • The node job stays in /etc/prometheus/prometheus.yml under its own name.

What Prometheus knows about each of its targets — the scrape address, the state and the last error — is shown by curl -s localhost:9090/api/v1/targets | jq '.data.activeTargets[] | {scrapeUrl, health, lastError}'

Visible only to you. Saved as you type.

All notes

Lab goals

0 of 3
  • The node job's target in Prometheus is up — not checked yet
  • node_exporter runs as the prometheus-node-exporter service, is enabled and listens on port 9100 — not checked yet
  • The settings live in files; promtool check config passes, Prometheus runs with what is in prometheus.yml, the prometheus 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…