zabbix / community-templates

Zabbix Community Templates repository
https://share.zabbix.com
MIT License
1.25k stars 1.77k forks source link

Pool health monitoring not working using ZFS templates under Ubuntu 22.04 / Zabbix 6.0 #334

Open danboid opened 4 months ago

danboid commented 4 months ago

I used to use this template:

https://github.com/Cosium/zabbix_zfs-on-linux

Under Zabbix 4.0 and that worked fine for monitoring ZFS but I've not been able to get either template_zfs_on_linux.yaml nor template_zfs_on_linux_active.yaml to work properly with Zabbix 6.0 and Ubuntu 22.04. Both my Zabbix server and the host with the ZFS disk are running Ubuntu 22.04. The main thing I need to work with these ZFS templates is the monitoring of the ZFS pool's health.

The first thing I noticed that stopped these templates working for me with Ubuntu is that the paths for both the zfs and zpool are commands are wrong for Ubuntu. To get these templates to work at all, Ubuntu users have to replace every instance of /sbin/zfs with /usr/sbin/zfs and /sbin/zpool with /usr/sbin/zpool. Doing that fixes most of the ZFS monitoring but it doesn't fix the monitoring of pool health.

userparams_zol_without_sudo.conf has these lines for pool health:

# pool health
UserParameter=zfs.zpool.health[*],/sbin/zpool list -H -o health $1

But I read here:

https://www.zabbix.com/documentation/4.0/en/manual/installation/upgrade_notes_400#deprecated-macros-in-item-names

That positional macros aren't used any more in Zabbix 6.0 so maybe this is part of my problem?

I tried a few things such as:

# pool health
UserParameter=zfs.zpool.health[*],/sbin/zpool list -H -o health "{#POOLNAME}"

With and without the quotes or not including a (positional) macro at the end at all but nothing has fixed the ZFS health monitoring for me yet.

I've also tried using template_zfs_on_linux_active.yaml but I had to modify that slightly to get it to import properly. I had to change the version string from "6.2" to "6.0" (its in a dir called 6.0 so surely I should really be 6.0 or in a 6.2 dir?) and I had to change L4 from template_groups: to just groups: before Zabbix would import it.