#!/bin/bash
###
#If something went wrong with the HP SmartArray disks this script will send an error email
###
if [ `/usr/sbin/hpacucli controller slot=2 physicaldrive all show | grep -E '(Failed|Rebuilding)'| wc -l` -gt 0 ]
then
msg="RAID Controller Errors"
#echo $msg
/usr/sbin/hpacucli controller slot=2 ld all show detail > /tmp/hpacucli.log
mail -s "$HOSTNAME [ERROR] - $msg" "some-email@addrss.com" < /tmp/hpacucli.log
rm -f /tmp/hpacucli.log
#else
#echo "Everything Good"
fi