Saturday, 25 October 2014

LSI MegaRAID Email Alerts

To start, the server needs to have either postfix or sendmail installed


Check
====

ls /etc/init.d | grep postfix   (defaults)

ls /etc/init.d | grep sendmail
===========
if not installed

yum install postfix -y 
yum install sendmail -y
======
chkconfig postfix on 
chkconfig sendmail on

======================

Set cronjob for mail aleart

=========== 

cd /etc/cron.hourly
vi MegaRAIDcron

#!/bin/bash
cd /opt/MegaRAID/MegaCli
./MegaCli64 -AdpAllInfo -aALL | grep "Degraded" > degraded.txt
./MegaCli64 -AdpAllInfo -aALL | grep "Failed" >> degraded.txt
cat degraded.txt | grep "1" > /dev/null
if [[ $? -eq 0 ]];
then
cat degraded.txt | mailx -s 'Degraded RAID on '$HOSTNAME <testgmla@gmail.com> 

fi       

==============
To test cron, we need to make one small change to the file. Change the following:

From
cat degraded.txt | grep "1" > /dev/null

To
cat degraded.txt | grep "0" > /dev/null

Save the changes and run the cron manually:

/etc/cron.hourly/MegaRAIDcron

If you have installed everything correctly, you should receive an email which shows the following:

Degraded : 0
Security Key Failed : No
Failed Disks : 0
Deny Force Failed : No





Sree

No comments:

Post a Comment