Ubuntu – Monitoring a ZFS Raid Pool on Ubuntu for Integrity and Performance

cactiperformanceUbuntuzabbixzfs

I set up ZFS on Ubuntu (via fuse) for a storage array at home and it has worked great for almost a year now, despite its 'beta' status. I log in and check the array every once in a while using:

zpool status

Which results in:

NAME        STATE     READ WRITE CKSUM
media       ONLINE       0     0     0
  raidz1    ONLINE       0     0     0
    sda     ONLINE       0     0     0
    sdb     ONLINE       0     0     0
    sdc     ONLINE       0     0     0
errors: No known data errors 

This is all fine, but I'd like to automate a way to check every once in a while to make sure my pool is error-free.

I have cacti, and zabbix available at my disposal. I suppose I could also write a program that greps that output and if it doesn't find the phrase "No known data errors", send me an email.

However, is there any package already made that does this, or specifications on how I can get some performance metrics from this array?

Best Answer

assuming zabbix and gnu tools... add to zabbix agent daemon config file the following :

UserParameter=zpool.status,zpool status | grep -q "No known data errors" && echo 1 || echo 0

now, in zabbix add an item with key "zpool.status", create a trigger against it (using a function like ".last(0)=0") and you're done - trigger will fire whenever that string is missing from the zpool status output.

this also assumes that 'zpool' will be in the path of the zabbix user, and that this user will be allowed to run zpool. if not, specify full path and use sudo. another catch might be a default shell that doesn't support used syntax, in which case you can either rewrite the userparameter, or force it to use bash.