Skip to content

Instantly share code, notes, and snippets.

@mrl22
Created January 6, 2017 15:04
Show Gist options
  • Select an option

  • Save mrl22/c4ed01e6c7dcebccd5d86825180bb4ba to your computer and use it in GitHub Desktop.

Select an option

Save mrl22/c4ed01e6c7dcebccd5d86825180bb4ba to your computer and use it in GitHub Desktop.
If something went wrong with the HP SmartArray disks this script will send an error email
#!/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" "[email protected]" < /tmp/hpacucli.log
rm -f /tmp/hpacucli.log
#else
#echo "Everything Good"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment