I have a FreeBSD file server with a 10TB array in RAID-Z (so 8TB usable with 2TB redundancy). I am trying to figure out how to get the system to notify me, preferably by email, if one of the drives fail. This is because the machine runs without a screen, and is rarely logged into directly.
I want a notification because otherwise our only hint that something has gone wrong is when a second drive goes and takes data with it.
Add this to /etc/periodic.conf:
Then you will have the status of your zfs pool added to the daily periodic emails that are sent. If you currently aren't receiving them you could add your email address in also via the variable:
daily_output="[email protected]"
You could try something that queries and parses the output of
zpool status
via cron/email. Or a commercial solution at: http://www.santools.com/smartmonux.htmlchkdsk is one script you could run via cron that when properly configured will email you when zpool errors are detected.
For direct monitoring you can use 'zpool status -x' which will give script-friendly output. It will either say "all pools are healthy" or list pools that have errors or are unavailable.
If you have your cron setup to send emails, simply drop this one-liner. It will print to stderr if there's an error detected, which cron will trigger into an email.