Latest interface: 0.3.1
Latest system: 010
nka
User

45 posts

Posted on 16 November 2011 @ 23:08edited 23:09 43s
Well, I had a little script that was checking my 3ware card server and notify me if the raid is other than "OK". I modify it to fit ZFS.

Create a zfscheck.sh with that in it. You need to modify the "user@email.com" to your email.

#######

#######

#!/usr/local/bin/bash
zfsstat=`zpool status -x | awk '{print $4}'`

if [ $zfsstat != 'healthy' ]; then
/bin/date > /tmp/zfs.stat
echo >> /tmp/zfs.stat
/bin/hostname >> /tmp/zfs.stat
echo >> /tmp/zfs.stat
/sbin/zpool status -x >> /tmp/zfs.stat
cat /tmp/zfs.stat | /bin/mail -s "Disk failure in server : `hostname`" user@email.com
fi

#######
[code]
#######

I also have a version for a tank in particular (change "tank1" with your pool name (there's two places)... and also the email).

#######
[code]
#######

#!/usr/local/bin/bash
zfsstat=`zpool status -x tank1 | awk '{print $4}'`

if [ $zfsstat != 'healthy' ]; then
/bin/date > /tmp/zfs.stat
echo >> /tmp/zfs.stat
/bin/hostname >> /tmp/zfs.stat
echo >> /tmp/zfs.stat
/sbin/zpool status -x tank1 >> /tmp/zfs.stat
cat /tmp/zfs.stat | /bin/mail -s "Disk failure in server : `hostname`" user@email.com
fi

#######

#######

then, chmod +x zfscheck.sh, then make a cronjob that run as much as you need.

#######

crontab -e
*/30 * * * * /path/to/file/zfscheck.sh

#######

This one will run every 30 mins.
Maurizio
User

42 posts

Posted on 17 November 2011 @ 16:03
Thank you for sharing this script. Already used in my server.
The_Dave
User

221 posts

Posted on 17 November 2011 @ 18:37
Nice! Should integrate it into the interface!
Maurizio
User

42 posts

Posted on 21 November 2011 @ 14:41
This morning I found a pool error. My server is running FreeBSD 8.2-RELEASE, but the zfscheck.sh script returns ./zfscheck.sh: line 4: [: too many arguments. I have uploaded the error message output of the 'zpool status -x' command to pastebin.com so you can debug the script by yourself: http://pastebin.com/DSnFfhd1 .

Looking at /etc/periodic/daily/404.status-zfs I have replaced the first 2 lines of the script with:

zpool status -x | grep 'all pools are healthy'
if [ $? -ne 0 ]; then

and seems all work. You can download the modified version here: http://pastebin.com/qMy3SB35 .
Thanks again nka, for sharing yours ideas.
wevavyhi
User

2 posts

Posted on 21 July 2018 @ 07:54
School development is vital for the upbringing of the kids. The souls have been trained in schools and bestessays review has been divided for the reforms and all such issues for the uplift of the students in schools.
kelbee
User

48 posts

Posted on 3 April 2019 @ 19:42
Health protection has substantiated itself of extraordinary help and money related guide in specific situations when occasions turn out of the blue getfreestuffonlinenow.com - forskolin where to buy. In times when you are sick and when your health is in grave peril and when funds appear to be inadequate to support for your consideration, health protection is here to the salvage.
Rumi
User

2 posts

Posted on 11 April 2019 @ 06:55edited 06:57 10s
Its as if you had a great grasp on the subject matter, but you forgot to include your readers. Perhaps you should think about this from more than one angle.
https://www.mhrwriter.co.uk/coursework-writing-service
kelbee
User

48 posts

Posted on 17 May 2019 @ 17:39
Nutritional supplements are among the simplest ways to boost one's health and prevent disease. Although food provides the energy to execute daily tasks, most meals contain only the main recommended daily allowance free vitamin coupons of specific nutrients.
kelbee
User

48 posts

Posted on 19 May 2019 @ 19:38
Being business enterprise merchandising supplements, you are looking for time towards shove the designate, you are looking for a Supplement Manufacturers have procured because of not to mention with some luck obtain most people many times.
martin_guptil
User

2 posts

Posted on 9 June 2019 @ 13:22edited 13:23 26s
Set aside me effort to peruse every one of the remarks, however I truly delighted in the article. It demonstrated to be Very useful to me and I am certain to all the analysts here! It's constantly decent when you cannot exclusively be educated, yet in addition engaged! academic writing services
Last Page

Valid XHTML 1.1