How to add Sanoid metrics to Linux node_exporter

Hello folks,

I am brand new to Prometheus and Grafana, so please be kind.

I use ZFS and Sanoid, which only has Nagios alerts for monitoring. I saw someone requested Prometheus ones here:

and thought it should not be too hard to get these into Grafana. Sanoid has no daemon or anything, it is just a script that autosnapshots/prunes/outputs health data about your ZFS pools/snapshots etc.

I set up a free tier Grafana Cloud account and added the relevant server using the quickstart Linux grafana-easystart-app/linux-node instructions. My metrics appear in the dashboard etc, so first hurdle jumped.

Reading through quite a lot of the docs, I thought a sensible approach to this would be to convert these metrics into a .prom textfile and pull it in using the textfile collector.

I understood that grafana-agent had a subset of the functionality of the prometheus agent and it seems to be doing the node_exporter functions, but I cannot figure out how to make it pull in the metrics from the file. I tried:

/usr/bin/grafana-agent --config.file /etc/grafana-agent.yaml --log.level error --collector.textfile.directory /etc/grafana-text-file-collectors/

but --collector.textfile.directory is not a valid flag and none of the other flags seemed like an equivalent.

I like the simplicity of the grafana-agent and hoped to just add a few metrics into the information it is already scraping off the machine – is there an obvious way to do this that I’m missing?

This:

sounded relevant, but still did not say how to actually do it.

I don’t have much experience with Grafana Agent → Grafana Cloud, but I have used the textfile collector a few times. Here is a good blog post about it:

https://www.robustperception.io/using-the-textfile-collector-from-a-shell-script