If you land here, there is an up to date version of this guide here:
https://medium.com/@ikersaint/monitoring-zfs-on-unraid-2023-26bbeb957ace
I started using ZFS a little while ago, but the lack of zfs-related information in the GUI really bothers me, however, my Unraid is mainly monitored from Grafana; so I started to look for monitoring solutions, but, didn’t found anything that works consistently good in Unraid.
This is a guide for Unraid users of ZFS Plugin who want to monitor their ZFS pools using Grafana & Prometheus & zfs_exporter. The main purpose of this is monitor general pool stats(ARC stats is possible with Telegraf) in a nice dashboard.
Requirements
Unraid <= 6.9.2
Grafana
Basic Knowledge o PromQL
Install zfs_exporter
There is a limitation on what properties you could monitor with Telegraf on Linux, that means, no health status, zdev or dataset or volume info, snapshots, size of the pools, datasets, etc.; here is where zfs_exporter comes into play, it’s a ZFS Prometheus exporter, in a single executable written in go that plays nice with Unraid.
Download from the releases page the Linux x64 version into a directory, for convenience one of your ssd pools (If you download it in the Unraid array or hdd pool, it will keep spinning the disks)
https://github.com/pdf/zfs_exporter
zfs_exporter-2.2.1.linux-amd64.tar.gz
tar -xf zfs_exporter-2.2.1.linux-amd64.tar.gz -C /ssdnvme/scripts
In the User Scripts Plugin, create a new script named zfs_exporter, the script contents is:
#!/bin/bash
echo "/ssdnvme/scripts/zfs_exporter --properties.dataset-filesystem="available,logicalused,quota,referenced,used,usedbydataset,written" --collector.dataset-snapshot --properties.dataset-snapshot="logicalused,referenced,used,written" --exclude=^ssdnvme/dockerfiles/" | at NOW -M > /dev/null 2>&1
Configure the scripts to be executed At Startup of Array, and you’re done; the location of my Docker Folder is “/ssdnvme/dockerfiles”, and it creates a lot of snapshots, you can exclude those paths with the “ — exclude” parameter. If you like to check the parameters check https://github.com/pdf/zfs_exporter.
If everything is ok, you should be able to access “http://YOURUNRAIDIP:9134/metrics" and see something like this:
If you are unable to access, check if zfs_exporter is running (“ps aux | grep zfs_exporter”)
Install Prometheus & Configure
From the Community Applications install Prometheus Docker, modify “prometheus.yml” to collect metrics from “YOURUNRAIDIP:9134”
Restart Prometheus, if everything went ok you should be able to test some expressions:
Create the Dashboard
With Grafana the process is very straightforward, add the Prometheus source, and start work the panels to your preference; example:
Some metrics are from Telegraf, the configuration is really simple, just edit telegraf.conf:
Final Words
I don’t expect to keep this Unraid configuration in the near future. Unraid 6.10 comes with ZFS 2.1, which includes zfs_influxdb (https://openzfs.github.io/openzfs-docs/man/8/zpool_influxdb.8.html), so exporting the metrics (ALL) will be very easy.