Working With File System Metrics From Node Exporter
File system metrics contain information about our mounted file systems. These metrics are taken from a few different sources, but all use the node_filesystem
prefix when we view them in Prometheus.
Although most of the seven metrics we’re provided here are fairly straightforward, there are some caveats we want to address — the first being the difference between node_filesystem_avail_bytes
and node_filesystem_free_bytes
. While for some systems these two metrics may be the same, in many Unix systems a portion of the disk is reserved for the root user. In this case, node_filesystem_free_bytes
contains the amount of free space, including the space reserved for root, while node_filesystem_avail_bytes
contains only the available space for all users.
Let’s go ahead and look at the node_filesystem_avail_bytes
metric in our expression editor. Notice how we have a number of file systems mounted that we can view: Our main xvda
disk, the LXC file system for our container, and various temporary file systems. If we wanted to limit which file systems we view on the graph, we can uncheck the systems we’re not interested in.
The file system collector also supplies us with more labels than we’ve previously seen. Labels are the key-value pairs we see in the curly brackets next to the metric. We can use these to further manipulate our data, as we saw in previous lessons. So, if we wanted to view only our temporary file systems, we can use:
node_filesystem_avail_bytes{fstype="tmpfs"}
Of course, these features can be used across all metrics and are not just limited to the file system. Other metrics may also have their own specific labels, much like the fstype
and mountpoint
labels here.