Observability: metrics, alerts, logs / Stage 1 of 9 · step 6 of 7
A machine dropped out of monitoring
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
- The
nodejob's target in Prometheus isup:promtool query instant http://localhost:9090 'up{job="node"}'prints=> 1. - node_exporter runs as the
prometheus-node-exporterservice; the service is enabled and listens on port 9100. - The settings are saved in files:
promtool check config /etc/prometheus/prometheus.ymlpasses, Prometheus runs with what the file says, theprometheusservice 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
nodejob stays in/etc/prometheus/prometheus.ymlunder 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}'
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