> I found your page very helpful in setting up a raid1 system at my
> work.  I do have one unanswered question.  How does the software
> controller notify someone that one of the drives has failed?
> 
Oh, I have a little script I run daily from a cron file -- actually 
two scripts. You could run them as often as you like I suppose

The first (short) is used to manually produce the match template
#######################################################
#!/bin/sh

# get active raid status
# version 1.03 4-18-00
/bin/cat /proc/mdstat | /usr/bin/grep active
########### end

######################################################
The second is the cron task and does the comparison, and 
is called when doing the check with the email address of whom to
notify on the command line
######################################################
#! /bin/sh
#
# Version:      1.02 8-7-99 Michael A. Robinton <
# [EMAIL PROTECTED] >
#
# raidcheck.sh  This file must be executed periodically by cron
#               It will check the raid status and e-mail a message if
#               a status error is detected.
#
# USEAGE:       raidcheck.sh e-mail@addr {where to send error msg}
#
############ check raid status info ##############
MAILTO=$1
SENDMAILCMD="/usr/lib/sendmail -t -oi -O DeliveryMode=background"
RAIDHOST=`/bin/hostname`

# you must have issued
#       raidgetstatus.sh >raidgood
# in the local directory before this routine will work

#       capture raid status
  RAIDSTATUS=`./raidgetstatus.sh`

#       get raid reference
  RAIDREF=`cat ./raidgood`

# Test for a clean shutdown with array matching reference
if [ "${RAIDSTATUS}" != "${RAIDREF}" ]; then
    ${SENDMAILCMD} <<EOF123xxx
From:${RAIDHOST} <root@${RAIDHOST}>
To:${MAILTO}
Reply-To:root@${RAIDHOST}
Errors-To:root@${RAIDHOST}
Sender:root@${RAIDHOST}
Subject:ALERT Raid Device Failure on ${RAIDHOST}

${RAIDHOST} has detected an error in the raid status

The status should be:
${RAIDREF}

The status is:
${RAIDSTATUS}
EOF123xxx
#| ${SENDMAILCMD}

fi
############ end

Reply via email to