monitor zfs from nagios/NRPE or cron on FreeBSD


I wrote this simple check-script for nrpe/nagios to get the status of various zpool volumes in a box, and output the failed volumes if any such exist.


$path/ [email] [email]

If no arguments are specified, the script will assume its run for NRPE. If one or more email addresses are specified, the script will send an email in case an array reports an error.


tank: DEGRADED / data: rebuilding / system: ok

Failed/rebuilding volumes will always be first in the output string, to help diagnose the problem when recieving the output via pager/sms.

Output Examples

output description
ok The device is reported as ok by zpool
DEGRADED The RAID volume is degraded, it's still working but without the safety of RAID, and in some cases with severe performance loss.
rebuilding The RAID is rebuilding, will return to OK when done
unknown state Volume is in an unknown state. Please report this to me (soren at so I can update the script include the following output zpool status, zpool list


Should work on all versions of FreeBSD with zfs.

Tested on FreeBSD 8.0-10.1


Latest version

Latest version 1.2

Old version



     o minor output issue with FreeBSD 10+


     o Can now email an address of choice, just use email address(es) as arguments to shellscript
     o check if zpool command exists on system before running script


     o Initial public release
       Based on my script.