Created
December 20, 2014 00:44
-
-
Save SharaaEsper/888e225db3db38cb933e to your computer and use it in GitHub Desktop.
Raid Stuff
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 | |
#Get controller number | |
controller=`tw_cli show | tail -2 | head -1 | awk '{print $1}'` | |
#Set Email | |
email='[email protected]' | |
#Get Hostname | |
hostname=`/bin/hostname` | |
#Build Reports | |
/sbin/tw_cli info $controller > /tmp/raidreport | |
/sbin/tw_cli alarms >> /tmp/raidreport | |
#Check Raid Status | |
raidstatus=`/usr/bin/head -n4 /tmp/raidreport | /usr/bin/tail -n 1 | /usr/bin/awk '{print $3}'` | |
#Send email if needed | |
if [ $raidstatus != "OK" ] && [ $raidstatus != "VERIFYING" ] | |
then | |
/usr/bin/mail $email -s"3Ware RAID health report for $hostname: Raid Degraded" < /tmp/raidreport | |
fi | |
#Clean Up | |
/bin/rm -rf /tmp/raidreport |
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 | |
date=`date +%F` | |
for n in {0..7} | |
do | |
echo -e "\n\n Slot $n \n" >> /root/drivelogs/drivelog-short-"$date" | |
echo -e "\n\n Slot $n \n" >> /root/drivelogs/drivelog-full-"$date" | |
/usr/local/sbin/smartctl -d 3ware,$n -a /dev/twa0 | grep -i err >> /root/drivelogs/drivelog-short-"$date" | |
/usr/local/sbin/smartctl -d 3ware,$n -a /dev/twa0 >> /root/drivelogs/drivelog-full-"$date" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment