DEV Community

Frits Hoogland for YugabyteDB

Posted on

Node_exporter and vmstat statistics

Node_exporter is a monitoring agent that has become the standard agent in lots of environments and especially in the cloud, because of flexibility, ease of use and integration with prometheus.

One of the statistic sources which is collected by node_exporter is the vmstat source. This is called the 'vmstat collector' by node_exporter, and it exports the linux /proc/vmstat file statistics.

However, that is not the full story. I was looking for some specific vmstat statistics in the node exporter, and couldn't find these. The specific statistics I was looking for were 'allocstall*', 'pgscan*' and 'pgsteal*'. Because I was pretty sure these exist, I then gone to the linux system and looked in the /proc/vmstat file. And there they were... That begs the question: what is going on?

It turns out that for each specific collector, there is a default setting which turns it on or off. Most collectors are turned on, some are turned off by default, such as collector.perf, collector.ntp, collector.cgroups to name a few.

On top of the enable or disable switch, some of the collectors have one or more configuration options. One of these is, you probably guessed it by now, the vmstat collector, or collector.vmstat, for which the configuration switch is aptly named collector.vmstat.fields, which makes it obvious that only certain fields can be selected.

The collector.vmstat.fields setting with node_exporter version 1.5.0 is: ^(oom_kill|pgpg|pswp|pg.*fault).*. For those of you that speak regex, this makes it obvious: this does NOT include the statistics that I was searching for above, and the reason is this regex that filters only very specific fields.

To enable additional fields to be shown/exporter by node exporter, add the --collector.vmstat.fields flag to the startup command of node exporter, and set the regex to include the additional fields: --collector.vmstat.fields="^(oom_kill|pgpg|pswp|pg.*fault|pgscan|pgsteal|allocstall).*"

Top comments (0)