man zfs-program describes the capabilities of the Lua interpreter built in to the ZFS subsystem.
You can use this with the Zabbix agent to measure just about anything about zpools and zfs volumes but you have to jump through a couple of hoops. Here's a starter example: obtain the percentage free space in a zpool.
In /etc/opt/ooce/zabbix/zabbix_agentd.conf.d/zfs.conf:
The main hoop is that zfs program must be run as root, for some reason. So run visudo and add
Then in your Zabbix server create an item with a key such as zfs.zpool.free[rpool] to get the free space on that pool. Now that the means of running zfs program is determined, you can obtain just about any metric about a pool.
You can use this with the Zabbix agent to measure just about anything about zpools and zfs volumes but you have to jump through a couple of hoops. Here's a starter example: obtain the percentage free space in a zpool.
Code:
~# cat /opt/ooce/zabbix/scripts/zfree.l args = ... pool = args["argv"][1] used = zfs.get_prop(pool,"used") available = zfs.get_prop(pool,"available") return available * 1000 / (used + available)
UserParameter=zfs.zpool.free[*],sudo -u root /usr/sbin/zfs program -jn $1 /opt/ooce/zabbix/scripts/zfree.l $1 | sed 's/{"return":\(.*\)}'
zabbixa ALL=(root:bin) NOPASSWD: /usr/sbin/zfs
Comment