Need to get an alert if one of the hard drives fail on my PowerEdge 1900 running CentOS 5.1 and Dell's OMSA.
Nagios and ITA seem a little hard to swallow...would like something simple. Some links below talk about this issue with the Perc 5/i.
Discussion on MegaRAID_SAS driver on PowerEdge
http://www.techno-obscura.com/~delgado/weblog/archives/2007/05/sles10_and_mega_1.html
Discussion on Perc 5/i inaudible alarm and possible script to use with omreport
http://msmvps.com/blogs/onq/archive/2007/03/30/on-dell-s-perc-5-i.aspx
Another possible to use to supplement alerts...but probably not storage
http://www.lampdeveloper.co.uk/linux/email-alerts-from-dell-poweredge-using-omreport.html
Ok. End result. Spent a lot time on the script in comments section of the msmvps.com link above. Couldn't get it to work. Bash didn't like the pipe command in the strings. So I brushed up on my VERY minimal perl skills and created the following to run in cron daily:
#!/usr/bin/perl
# A simple perl program to send alerts if problem found with physical disks
# by using OMSA 5.2 for Dell PowerEdge
# I do not provide any guarantee that this script will work. Use at own risk.
#Written: May 2008
#By: Jerod Hammerstein
$controller="0";
$emailaddress="jerod\@yourdomain.com";
$omreport="/usr/bin/omreport";
$mail="/bin/mail";
$servername="yourservername";
# run omreport command and put into olist
open(LS, "$omreport storage pdisk controller=$controller |");
while() {
chomp;
push @olist, $_;
}
close(LS);
# Go through each line in olist to look for "Critical", "Rebuilding", or
# "Failure Predicted : YES"
$email=0;
$subject="";
foreach $line(@olist){
if ($line =~ /Critical$/i) {
$email=1;
$subject="$servername Hard Drive Critical";
}
if ($line =~ /Failure$/i) {
$email=1;
$subject="$servername Hard Drive Rebuilding";
}
if ($line =~ /^Failure\sPredicted(\s)+:\sYes$/i) {
$email=1;
$subject="$servername Hard Drive Predicted to Fail";
}
}
#If something was found email will = 1 so send email
if ($email==1) {
system("$omreport storage pdisk controller=$controller | $mail -s '$subject' $emailaddress");
}
Ran as root
crontab -e
Then put
0 8 * * * /root/checkRAID.pl
in the crontab file.
I'm sure I could have done a better job in the regular expressions (and probably in most of the code), but it's simple and it works. Most of all I think it is very understandable compared to many perl scripts I've seen.
Feel free to use and alter... You will need sendmail installed..you can keep port 25 blocked on your external interface in your firewall as it uses the lo interface. No guarantees it will work for you though.
The dell poweredge list serv had a message that someone uses to have it alert of disk problems:
omconfig system alertaction event=pdiskwarn execappath="(script
to send email)"
I tried this on my Dell PowerEdge 1900 using a simple perl script in the execappath that works otherwise and I got
Error! Hardware subsystem reports command failed.
1 comment:
You got:
"Error! Hardware subsystem reports command failed."
Did your filename have a dot in it? Removing it did the trick for me.
Post a Comment