MegaRAID
Monitoring
There are two separate monitoring tools for MegaRAID setups in linux. One is for older cards and the other is for newer SAS cards.
Older non-SAS cards
Get the MegaMon tool from Dell here. Put your email address in /etc/megamon.conf. Make /etc/rc.d/init.d/raidmon start on boot.
This sends you email when ever something happens, including regular self-checks and if a drive is rebuilding, you get an email every time the percentage changes... oh joy!
I have these emails sent to my google mail accnt where they are filtered. Ones containing the string 'DEGRADED' are forwarded to my pager.
Newer SAS cards
Get MegaCli from LSI. here
Once you install it, it will be in /opt/MegaRAID/MegaCli/MegaCli64 (or /opt/MegaRAID/MegaCli/MegaCli if you're on 32 bit). I just made a symlink from there to /usr/local/sbin/MegaCli.
MegaCli is a stand-out example of the obscure and undocumented. I found a discussion about it here. The most important thing is -h gives you the command switches. Anything ending in 'info' is probably safe. Since I'm only interested in monitoring at this point, I like MegaCli -LDInfo -Lall -Aall. Here's a script I run from cron every 5 minutes.
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
CMD="MegaCli -ldinfo -l0 -a0"
LOG="MegaSAS.log"
OPTIMAL='State: Optimal'
if $CMD | grep -q "$OPTIMAL" ; then
rm -f $LOG
exit 0
fi
echo "Problems with Megaraid!";
if test -f $LOG ; then
cat $LOG
else
$CMD
fi
rm -f $LOG
exit 1
Note that the command line args are case insensitive. I just grep for 'State: Optimal' and exit if found. Otherwise, print the status. Notice the $LOG stuff? Stupid MegaCli will create that log file in the CWD without asking you if it's OK. It contains the same stuff as was printed to stdout.
