Well, fear not! Kieser.net to the rescue! We have this neat little script that does and elementary check for disk failure and then emails you if it detects a failure. You should install it on your server as root, and chmod 500 so that it is executable by cron. Of course, you also need to use crontab -e to make cron run it at a sensible frequency.
Here is the script for you to cut and paste into a suitable file:
#!/bin/bash
LOG_FILE=/tmp/raid_check_$$
SYSTEM=`uname --nodename`
MAILTO='root@kieser.net'
echo "The $SYSTEM system has RAID failures on it." >>$LOG_FILE
echo "Below is the output from /proc/mdstat" >> $LOG_FILE
echo "===========================================" >> $LOG_FILE
cat /proc/mdstat | egrep 'md.*raid' | fgrep -i '(f)' >> $LOG_FILE
if [ $? -eq 0 ]
then
cat /proc/mdstat >> $LOG_FILE
echo "===========================================" >> $LOG_FILE
mail -s 'URGENT: RAID disk failure detected' $MAILTO < $LOG_FILE
fi
rm -f $LOG_FILE
exit 0
Honeypot: spam@kieser.net
No comments:
Post a Comment