Platform: Linux (CentOS 4.2 of at this writing)
Card: 3Ware Escalade 7506-x Series ATA RAID Controller
I'm really into piece of mind when it comes to my server. One of the critical peices is the RAID Controller. I wouldn't operate a mission critical solution without it.
This lil piece of code checks the status and alarm history of the RAID controller and emails it to me daily.
create a file in your /etc/cron.daily directory. We'll call it say "raidhealth"
Code:
# 3Ware CLI RAID Report
# Written for my Escalade 7506-4LP
#
# You will need the tw_cli file which you can download free
# from www.3ware.com - save this file in your /sbin directory
#
# File is free for use by all but comes as is with no warranty
#
##################################
# variables that you need to set #
##################################
email='you@yourdomain.com' # email where the reports are sent
##################################
# do not edit below #
##################################
hostname=`/bin/hostname`
# pipe output from the 3Ware CLI to a text file
/sbin/tw_cli info c0 > /tmp/raidhealth.txt
echo "" >> /tmp/raidhealth.txt
echo "" >> /tmp/raidhealth.txt
/sbin/tw_cli alarms > /tmp/raidalarms.txt
# combine that text to one file for reporting
cat /tmp/raidhealth.txt /tmp/raidalarms.txt > /tmp/raidreport.txt
# send me a copy of that output via email
mail $email -s"3Ware RAID health report for $hostname" < /tmp/raidreport.txt
# now clean up the text files we made
rm -rf /tmp/raidhealth.txt
rm -rf /tmp/raidalarms.txt
rm -rf /tmp/raidreport.txt
Save and quit. chmod 755 this file. Now you'll get daily reports from your server about your 3Ware RAID Controller.
Your daily output will look like:
Code:
Controller: c0
-------------
Driver: 1.02.00.036
Model: 7506-4LP
FW: FE7X 1.05.00.056
BIOS: BE7X 1.08.00.046
Monitor: ME7X 1.01.00.038
Serial #: B14001A3380518
PCB: Rev4
PCHIP: 1.30-66
ACHIP: 3.20
# of units: 1
Unit 0: RAID 5 152.66 GB ( 320168960 blocks): OK
# of ports: 4
Port 0: Maxtor 6Y080L0 Y30VFXVE 76.33 GB (160086528 blocks): OK(unit 0)
Port 1: Maxtor 6Y080L0 Y30VH33E 76.33 GB (160086528 blocks): OK(unit 0)
Port 2: Maxtor 6Y080L0 Y30CPLSE 76.33 GB (160086528 blocks): OK(unit 0)
Alarms Report for Controller /c0
Date Severity Alarm Message
-----------------------------------------------------
No Alarms Found.
Nothing fancy, but I like it.