A colleague writes: “The machine's network looks busy — how much is it receiving right now?” Prometheus on the machine scrapes node_exporter, and that has the node_network_receive_bytes_total metric — bytes received on each network interface. Ask Prometheus for it twice, 10 seconds apart.
Query the counter twice
Ask Prometheus for the node_network_receive_bytes_total metric, wait 10 seconds and ask again. Compare the two numbers.
First, predict
What will the second query show, 10 seconds after the first?
Now start the exercise, run the command and compare your prediction with the output.
In 10 seconds the received-bytes counter grew by about 2 million. How many bytes per second was the machine receiving?
-
300 million is everything that came through eth1 since it appeared. Per second it is the difference of the two numbers divided by 10.
-
2 million arrived over all 10 seconds between the queries; per second it is 10 times less.
-
Two counter values and the time between them are enough: the growth divided by the seconds is the rate.
2 million bytes in 10 seconds is about 200 thousand bytes per second.