Dell Perc6/i RAID Monitoring Script using MegaCli (LSI) on CentOS 5.2 - 64 bits
Category:
I got a Dell Perc6/i Integrated RAID card a few days ago. By using it with CentOS 5.2 64 bits without GUI, I'm looking the way to monitor RAID status. I then, found that I can use MegaCLI from LSI to do the task. (Dell Perc6/i uses LSI Chip)
First, get MegaCLI from LSI website -> MegaCLI 2.00.11 for Linux
Unzip it, and install it by RPM. Files will place at /opt/MegaRAID/MegaCli. However, since I use 64 bits version, the file I got is MegaCli64. (32 bits OS will get MegaCli instead.
I, then, followed what said on this website (Most information came from that website.)
1. Created a file called "analysis.awk" in the /opt/MegaRAID/MegaCli directory with the following contents:
# This is a little AWK program that interprets MegaCLI output
/Device Id/ { counter += 1; device[counter] = $3 }
/Firmware state/ { state_drive[counter] = $3 }
/Inquiry/ { name_drive[counter] = $3 " " $4 " " $5 " " $6 }
END {
for (i=1; i<=counter; i+=1) printf ( "Device %02d (%s) status is: %s <br/>\n", device[i], name_drive[i], state_drive[i]); }
2. Tested by run the command : ./MegaCli64 -PDList -aALL | awk -f analysis.awk
[root@xxxxx MegaCli]# ./MegaCli64 -PDList -aALL | awk -f analysis.awk
Device 00 (ATA ST3xxxxxxxx Sxxx 5xxxxx) status is: Online
Device 01 (ATA ST3xxxxxxxx Sxxx 5xxxxx) status is: Online3. Create a file raidstatus in /etc/cron.hourly. Put below script in it :
/opt/MegaRAID/MegaCli/MegaCli64 -PdList -aALL | awk -f /opt/MegaRAID/MegaCli/analysis.awk | grep -qEv "*: Online" > /dev/null && echo "Warning: RAID status no longer optimal"4. Run below command to make the file executable by all users.
chmod a+x /etc/cron.hourly/raidstatus5. Check where the e-mail notification goes to in CRONTAB. Check this file -> /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
I didn't change anything in CRONTAB. Instead, I changed that in /etc/aliases file. Specify root : aaa@bbb.com in there. So, that all mail to root will go to aaa@bbb.com
There is no e-mail notification if you run cron task (run-parts /etc/cron.hourly) by yourself. So, you need to wait for CRON to run automatically and you will get an E-mail.
Command to list Adapter Information :
/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aAllCommand to List all Logical Drives :
/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aAllCommand to list all Physical Information :
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAllTo check if cron works, run command :
run-parts /etc/cron.hourly
Comments
Anonymous
Tue, 03/24/2009 - 04:35
Permalink
thy
thanks for your good article!
Anonymous
Sat, 03/28/2009 - 18:06
Permalink
Merci !
As I said in French, Thank You, very usefull.
Anonymous
Thu, 05/07/2009 - 08:57
Permalink
NEW LINK for the latest MegaCLI tool
Many thanks to the original poster... you are a lifesaver
The link to MegaCLI is dead, but you can find old versions of MegaCLI on LSI's US website... but even better... you can find newest versions of MegaCLI on the Japanese website:
http://www.lsi.jp/storage_home/products_home/internal_raid/megaraid_sas/...
Anonymous
Fri, 05/08/2009 - 14:02
Permalink
For OpenFiler Users on Dell2950 with Perc6/i
since the MegaCLI at LSI only comes as an .rpm... this is tough for OpenFiler users (with no rpm or alien on the system).. and for some reason the 2.00 version wouldnt work for me.. but 4.00.11 did!
Install Alien:
wget http://ftp.de.debian.org/debian/pool/main/a/alien/alien_8.72.tar.gz
tar vzxf alien_8.72.tar.gz
cd alien
perl Makefile.PL
make
make install
Convert the .rpm:
/usr/bin/alien --to-tgz /tmp/MegaCli-4.00.11-1.i386.rpm
Warning: Skipping conversion of scripts in package MegaCli: postinst postrm
Warning: Use the --scripts parameter to include the scripts.
cpio: warning: skipped 2167399 bytes of junk
MegaCli-4.00.11.tgz generated
Extract the *single* MegaCli file (you dont need all the /opt/Mega..blah blah directory structure).. I ran it from my home directory
Note: I was NOT able to use MegaCLI64 even though Im on a 64-bit system with 64-bit flavor of openfiler... it generated segmentation faults everytime
chmod 755 MegaCli
./MegaCli -h
Enjoy! This burned up 1 1/2 days for me... so thought I would pass it along!
Anonymous
Fri, 10/30/2009 - 01:30
Permalink
Thanks!!
It's very helpful to me.
Thanks again!! :)
dave
Mon, 04/25/2011 - 11:11
Permalink
thanks!
I loved it. Thanks a much!
Ciprian Pantea
Mon, 06/27/2011 - 13:08
Permalink
Thanks!
Lovely, with a little bit of tweaking I made it to do what I want, thanks!!!
Add new comment