Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Do you have any server monitoring software? Syslog server? If so, have the one of those do the notifications. –  xeon May 2 '11 at 21:42
    
No server monitoring systems, this is a home set-up so I figure that would probably be veering into overkill technology –  Aatch May 3 '11 at 21:58

4 Answers 4

up vote 2 down vote accepted

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.html

share|improve this answer
    
I didn't think of a cron job, I'll probably just parse the output of zpool status and have it check for a specific string, then email me. –  Aatch May 3 '11 at 21:59
    
It's not necessary to reinvent the wheel. As @Erik shows, this stuff is already available as a FreeBSD periodic cronjob, which would allow you to re-use the standard email and monitoring facilities, which are better tested then your own homegrown script. –  Stefan Lasiewski May 26 '11 at 22:58

Add this to /etc/periodic.conf:

daily_status_zfs_enable="YES"

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="your@email.com"

share|improve this answer
    
+1 for mentioning periodic(8). These tools are already there, you just need to turn them on with echo 'daily_status_zfs_enable="YES"' >> /etc/periodic.conf. And while your at it, check out the sysutils/zfs-periodic port as well. –  Stefan Lasiewski May 26 '11 at 23:00

chkdsk is one script you could run via cron that when properly configured will email you when zpool errors are detected.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.