How to monitor Hardware RAID in Vyatta routers  

For RAID cards that their utility is “lsiutil”  (Such as SAS 6/iR), we use the following method.

We assume that we have logged into the server as user “vyatta”

Assuming that we download the lsiutil to /home/vyatta/ and sendEmail to /home/vyatta/Scripts/

vyatta@router0:~$ sudo nano  /home/vyatta/Scripts/Router-RAIDalert-lsiutil.sh

sudo /home/vyatta/lsiutil.x86_64 -p1 -a 1,0,0,0  21  | grep  “State”   >  Tempo

x=$(awk ‘{ print $3 }’ Tempo)

y=’optimal,’

if [[ $x != $y ]]

then

sudo /home/vyatta/lsiutil.x86_64 -p1 -a 1,2,0,0,0  21 > /tmp/RAIDlog

sudo /home/vyatta/Scripts/sendEmail -f RAIDmonitor@example.com  -t alerts@example.com, pxxxxx@example.ca  -s mail.example.com  -xu alerts@example.com -xp xxxxx -u “Router0 RAID Failure” -o message-file=/tmp/RAIDlog  > /dev/null

sudo rm -f /tmp/RAIDlog

fi

sudo rm -f Tempo

Add the following line to cron jobs for user vyatta

vyatta@router0:~$ crontab –e

…..

45 10 * * * sudo /home/vyatta/Scripts/Router-RAIDalert-lsiutil.sh

For servers that need Megacli (such as PERC 5) we need to first install the Megacli

Vyatta 6.2 and 6.4 are Built on Debian Squeeze so we download and install the proper package

# wget  http://hwraid.le-vert.net/debian/pool-squeeze/megacli_8.07.14-1_amd64.deb

# sudo dpkg –install megacli_8.07.14-1_amd64.deb

# sudo /usr/sbin/megacli -h

 

After downloading sendEmail to /home/vyatta/Scripts we create the following script

vyatta@router1:~$ sudo nano  /home/vyatta/Scripts/Router-RAIDalert-Megacli.sh

sudo /usr/sbin/megacli  -LDInfo -Lall -aALL | grep “State”   >  Tempo

x=$(awk ‘{ print $3 }’ Tempo)

y=’Optimal’

if [[ $x != $y ]]

then

sudo /usr/sbin/megacli -LDInfo -Lall -aALL > /tmp/RAIDlog

sudo /home/vyatta/Scripts/sendEmail -f RAIDmonitor@example.com  -t alerts@example.com, pxxxxx@example.ca  -s mail.example.com  -xu alerts@example.com -xp xxxxx -u “Router1 RAID Failure” -o message-file=/tmp/RAIDlog  > /dev/null

sudo rm -f /tmp/RAIDlog

fi

sudo rm -f Tempo

And then we add it to cron jobs

vyatta@router1:~$ crontab –e

…..

45 10 * * * sudo /home/vyatta/Scripts/Router-RAIDalert-Megacli.sh



How to install Debian packages on Vyatta

http://xmodulo.com/how-to-install-debian-packages-on-vyatta.html

Vyatta 6.2 Build on Debian Squeeze (and the same for Vyatta 6.4)

http://hwraid.le-vert.net/debian/pool-squeeze/

http://hwraid.le-vert.net/wiki/DebianPackages