The server is sluggish, and the on-call engineer asks: “Check the metrics for how much free memory there is.” Here the machine's figures are served by the node_exporter service — over HTTP, on port 9100. Ask it for the /metrics page, count the lines and find the memory lines. free -b is there for comparison.
Look at the exporter's answer
The node_exporter service serves the machine's figures at localhost:9100/metrics. Count the lines in its answer, find the memory lines and compare them with the output of free -b.
First, predict
How many lines will node_exporter return?
Now start the exercise, run the command and compare your prediction with the output.
The node_exporter of one machine returned about 1900 lines. What is in them?
-
The lines starting with
#are descriptions:# HELPsays what the metric counts,# TYPEgives its type. Look atcurl -s localhost:9100/metrics | grep -m4 '^#'. -
Repeat the request and you get about as many lines: the exporter returns the current values each time, with no history. Check with
curl -s localhost:9100/metrics | wc -lagain. -
The exporter reads only its own machine —
/procand/sys; this VM has no outside network at all.
The exporter returns current values — a line for every number and a description for every metric.