The textfile collector
The textfile
collector is a hidden gem in the Node Exporter. This single collector adds tremendous versatility to what you can accomplish with a Prometheus monitoring stack.
Using the textfile
collector, you can read Prometheus-formatted metrics from files on the server and include them in the output of the Node Exporter’s /metrics
scrape endpoint.
Being able to read metrics from a file opens up a whole new world of monitoring short-lived processes such as batch or cron jobs, where it isn’t possible or doesn’t make sense to expose metrics on an HTTP endpoint for Prometheus to scrape. For example, at my company, we leverage the textfile
collector to expose metrics related to the last time a server executed its scheduled synchronization with our configuration management system.
The textfile
collector is enabled by default but requires additional configuration to actually work. For the collector to work, it must know where it should...