Perc 5i Raid Controller

I have 2 DELL 1950 servers.

I needed to monitor the raid controller on them and see if the array is failing.

I've found 2 ways to accomplish this task:

- Using the MegaCLI utility (MegaRAID SAS 84016E) from LSI web site.
Check this link

- Using the DELL OMSA utility.
Check this link

For installing and using the MegaCLI utiliy.

Download the latest utility from LSI's website and place the download into /usr/local/src

In my case the download is called: 1.01.39_Linux_Cli.zip

# unzip 1.01.39_Linux_Cli.zip

This creates 2 new files:

-rw-rw-rw-  1 root   root     37954 Oct  2  2007 1.01.39_Linux_Cli.txt
-rw-rw-rw-  1 root   root   1322998 Aug  2  2007 MegaCli-1.01.39-0.i386.rpm

Since I'm using Ubuntu on these machines, I need to convert the rpm into deb.

In order to do this, I need to install alien:

# apt-get install alien debhelper gettext html2text intltool-debian libbeecrypt6 libneon27 librpm4.4 libxml2 po-debconf rpm lsb-rpm lintian dh-make xml-core libmail-sendmail-perl libcompress-zlib-perl libmail-box-perl libhtml-template-perl libxml-simple-perl build-essential debian-keyring
# apt-get clean
# alien --scripts MegaCli-1.01.39-0.i386.rpm 
# dpkg -i megacli_1.01.39-1_i386.deb
# dpkg -L megacli

The following set of commands are enough for me to create a script and send alerts in case the controller fails.

/opt/MegaRAID/MegaCli/MegaCli -LDInfo -Lall -aALL
/opt/MegaRAID/MegaCli/MegaCli -PDList -aALL
/opt/MegaRAID/MegaCli/MegaCli -CfgDsply -aAll
/opt/MegaRAID/MegaCli/MegaCli -PDList -aALL | egrep 'Adapter|Enclosure|Slot|Inquiry'
/opt/MegaRAID/MegaCli/MegaCli -CfgDsply -aAll | egrep 'Reference|RAID|Slot|Data|^$'

The second method for monitoring the raid controller is using the DELL OMSA application, which actually monitors a lot more than just disks.

We have to edit /etc/apt/sources.list and add the following lines at the end:

#DELL Open Manage
deb http://ftp.sara.nl/pub/sara-omsa dell sara

Update the available packages:

apt-get update

Install IPMI packages:

apt-get install libopenipmi-dev libopenipmi0 openipmi openhpi-plugin-ipmi lm-sensors libglib2.0-data
apt-get install ipmitool
apt-get install dellomsa
ldconfig
/etc/init.d/dataeng restart
/etc/init.d/dsm_om_connsvc start
/etc/init.d/dsm_om_shrsvc start
/etc/init.d/dsm_sa_ipmi start

netstat -ln will output something like this:
tcp6 0 0 :::1311 :::* LISTEN

We can now log into the web interface using the following address:

https://IPADDRESS:1311

The scripts I use to check the PERC 5/i raid controller are the following:

root@ned:~# ls -l /home/mario/scripts/admin/
total 8
-rwxr-x--- 1 root root  168 2009-04-22 23:06 checkRaid.sh
-rwxr-x--- 1 root root 2296 2009-04-22 23:00 filecomp.sh

root@ned:~# cat /home/mario/scripts/admin/checkRaid.sh

#!/bin/bash

cd /var/log

#The following command creates the file MegaSAS.log wherever it is executed
/opt/MegaRAID/MegaCli/MegaCli -LDInfo -Lall -aALL > /dev/null

#Rename so next time the log is recreated instead of appended
mv /var/log/MegaSAS.log /var/log/MegaSASRaid.log

#Compare old file and new one
/home/ulysse/scripts/admin/filecomp.sh /var/log/MegaSASRaid.log

root@ned:~# cat /home/mario/scripts/admin/filecomp.sh

#!/bin/bash

FILE2CHECK=$1
DIR=/var/log
PREFIX=`basename $0`
OLDFILE=$DIR/$PREFIX.`basename $FILE2CHECK`.old
NEWFILE=$DIR/$PREFIX.`basename $FILE2CHECK`.cur
EMAILTMP=$DIR/$PREFIX.`basename $FILE2CHECK`.email.tmp
SUBJECT="[filecomp] file $FILE2CHECK changed on `hostname` "
RECIPIENT=mario@hummy.org
CC=otheraccount@hummy.org

if [ "$1" == "" ]
then
        echo "usage:  filecomp.sh [Full path to file] "
        exit
fi

if [ ! -f $OLDFILE ];
then
touch $OLDFILE
fi

if [ ! -f $NEWFILE ];
then
touch $NEWFILE
fi

if [ -f $FILE2CHECK ];
        then
        # 1. rotate
        # 2. create new
        # 3. compare and notif if app
        rm $OLDFILE 2>/dev/null
        cp -f $NEWFILE $OLDFILE
        cat $FILE2CHECK > $NEWFILE
        S22="`diff -q $NEWFILE $OLDFILE`"

#        echo "diff $NEWFILE $OLDFILE"
        if [ "$S22" != "" ]
                then
                echo > $EMAILTMP
                echo "DIFF BETWEEN OLD FILE AND NEW FILE" >> $EMAILTMP
                echo "---------------------------------------------------------------------------------" >> $EMAILTMP
         diff $NEWFILE $OLDFILE >> $EMAILTMP
                #echo $S22 >> $EMAILTMP
                echo >> $EMAILTMP
                echo >> $EMAILTMP
                echo "OLD FILE" >> $EMAILTMP
                echo "---------------------------------------------------------------------------------" >> $EMAILTMP
                echo  >> $EMAILTMP
                echo  >> $EMAILTMP
                cat $OLDFILE >> $EMAILTMP
                echo  >> $EMAILTMP
                echo  >> $EMAILTMP
                echo "NEW FILE" >> $EMAILTMP
                echo "---------------------------------------------------------------------------------" >> $EMAILTMP
                cat $NEWFILE >> $EMAILTMP
                echo  >> $EMAILTMP
                echo  >> $EMAILTMP
                echo "---------------------------------------------------------------------------------" >> $EMAILTMP
         #diff $NEWFILE $OLDFILE >> $EMAILTMP
                #cat $EMAILTMP  | mail -s "$SUBJECT" -c $CC $RECIPIENT
                cat $EMAILTMP  | mail -s "$SUBJECT" $RECIPIENT
                #rm $EMAILTMP
        fi
        else
                echo "ERROR: $FILE2CHECK is not accesible"
                exit
fi

The scripts ara invoked from the crontab hourly with the following line:

root@ned:~# crontab -l

# m h  dom mon dow   command
22 * * * * /home/mario/scripts/admin/checkRaid.sh

The first time you use this method, you should get an alert, that's normal.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License