Created
January 6, 2017 15:04
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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