Step 6 of 7 · lab · 20 min
A machine dropped out of monitoring
Since last night Prometheus has had no data on this server's CPU, memory and disks, although Prometheus itself is running. Bring the machine back into monitoring so that it stays there.
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 · 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 3-
The node job's target in Prometheus is up — not done yet
-
node_exporter runs as the prometheus-node-exporter service, is enabled and listens on port 9100 — not done yet
-
The settings live in files; promtool check config passes, Prometheus runs with what is in prometheus.yml, the prometheus service is enabled — not done yet
The machine is starting
Hints
0 of 3Lab goals
0 of 3-
The node job's target in Prometheus is up — not done yet
-
node_exporter runs as the prometheus-node-exporter service, is enabled and listens on port 9100 — not done yet
-
The settings live in files; promtool check config passes, Prometheus runs with what is in prometheus.yml, the prometheus service is enabled — not done yet
Goals are checked on the machine after every command.