raidutils

Scott lists.scott at themagicbox.net
Wed Nov 13 03:54:09 CET 2002


Hi everybody,

I have built a small perl plugin that checks raidutils status on a raid.
it basically checks the status of all drives and reports c for a degraded
disk and w for a rebuilding disk.. This works well with nrpe as I have one
check for the whole raid making it use less recourses on the raided
machine (raidutils is fairly slow to run) if anybody has anything better
than this could they please yell out as I am interested in something a
little more rebust.. C binary is always better imho :)

here is the code for anybody interested..
PS. I am a perl hack not a perl hacker :-) (this basically means if it
breaks your system and blows up your family, I didnt do it)
PPS. If anybody wants to change this to make it work nicer please do so, I
only ask that you give it back to this list.

#!/usr/bin/perl
@RETU = `/usr/dpt/raidutil -L raid`;
if (!@RETU) { die "something broke" }
$switcher = 0;
$warn = 0;
foreach $test (@RETU) {
        ($drive,$state) = $test =~ /^\ (\S+)\s+Disk.*B\s+(.*)$/;
                if ($state != /Optimal/) {
                        if ($state =~ /Reconstruct/) {
                                $warn = 1;
                        }
                        print $drive.":".$state.",";
                        $switcher = 1;
                }
}
if (!$switcher) {
        print "Raid Optimal";
        exit 0;
}
if ($warn) {
        exit 1;
}
exit 2;





-------------------------------------------------------
This sf.net email is sponsored by: 
To learn the basics of securing your web site with SSL, 
click here to get a FREE TRIAL of a Thawte Server Certificate: 
http://www.gothawte.com/rd522.html




More information about the Users mailing list