We have a gauge metric called: node_filesystem_size_bytes
node_filesystem_free_bytes{device="/dev/sda1",fstype="vfat",
instance="localhost:9100",job="node",mountpoint="/boot/efi"} 70300672
node_filesystem_free_bytes{device="/dev/sda5",fstype="ext4",
instance="localhost:9100",job="node",mountpoint="/"} 30791843840
node_filesystem_free_bytes{device="tmpfs",fstype="tmpfs",
instance="localhost:9100",job="node",mountpoint="/run"} 817094656
node_filesystem_free_bytes{device="tmpfs",fstype="tmpfs",
instance="localhost:9100",job="node",mountpoint="/run/lock"} 5238784
node_filesystem_free_bytes{device="tmpfs",fstype="tmpfs",
instance="localhost:9100",job="node",mountpoint="/run/user/1000"} 826912768
The following statement aggregates the metric and sum()
its values.
sum without(device, fstype, mountpoint)(node_filesystem_size_bytes)
Notice the result:
{instance="localhost:9100",job="node"} 32511390720
The metric name is gone and we only have the instance label.
Counters track the number of events. The metric increases over time. It is useless in raw format, what we want is a way to see how it changes over time. We have the rate function, increase and the irate function to operate on counter values.
The metric node_network_receive_bytes_total
returns the following time series:
node_network_receive_bytes_total{device="eth0", instance="node-exporter:9100", job="node"} 375063
node_network_receive_bytes_total{device="lo", instance="node-exporter:9100", job="node"} 0
Now we can compute the rate on that metric on 5 minute windows:
rate(node_network_receive_bytes_total[5m])
And we get:
{device="eth0", instance="node-exporter:9100", job="node"} 36.86666666666667
{device="lo", instance="node-exporter:9100", job="node"} 0