I added a unified RAID monitor; it does Linux software RAID, and
handles hardware RAID controllers from 3ware and Areca; it should run
on the box you want to monitor and you can get at via SNMP easily
enough.

--Augie

On Fri, Nov 14, 2008 at 1:31 PM, Augie Schwer
<[EMAIL PROTECTED]> wrote:
> Update of /cvsroot/mon/mon/mon.d
> In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv25390
>
> Added Files:
>        raid.monitor
> Log Message:
> Adding raid.monitor the unified software/hardware RAID monitor.
>
> --- NEW FILE: raid.monitor ---
> #!/usr/bin/perl
>
> # raid.monitor
> # A unified RAID monitor to monitor both software and hardware RAID.
> # Works with Linux software RAID, 3ware's tw_cli tool, and Areca's areca_cli 
> tool.
> # Augie Schwer <[EMAIL PROTECTED]>
>
> use strict;
> use warnings;
>
> my $MDSTAT= '/proc/mdstat';
> my $TWCLI = `which tw_cli 2> /dev/null`;
> my $ARCCLI= `which areca_cli 2> /dev/null`;
>
> chomp $TWCLI;
> chomp $ARCCLI;
>
> my $mdstat = '';
>
> # Check for any failed software RAID.
> if ( -f $MDSTAT )
> {
>        $mdstat = `egrep "\[.*_.*\]" $MDSTAT`;
>        $mdstat = '' if $mdstat =~ 'read_ahead not set'; # Fix for Red Hat 7.3 
> boxes.
> }
> if ( $mdstat )
> {
>        print "Failure of one or more software RAID devices\n";
>        exit 1;
> }
>
> # Check for any 3ware RAID failures.
> if ( -x $TWCLI )
> {
>        my %controllers = ();
>        # Handle multiple controllers.
>        my @controllers = `$TWCLI info | grep '^c' | awk {'print \$1'}`;
>        my (@units,@ports);
>
>        # Iterate through controllers and find broken ports and units.
>        for my $controller (@controllers)
>        {
>                chomp $controller;
>                @{$controllers{$controller}->{'failed_units'}} = `$TWCLI info 
> $controller | grep -v 'NOT-PRESENT' | grep '^u' | awk {'print \$3'} | grep -v 
> 'OK' | grep -v 'VERIFYING'`;
>                @{$controllers{$controller}->{'failed_ports'}} = `$TWCLI info 
> $controller | grep -v 'NOT-PRESENT' | grep '^p' | awk {'print \$2'} | grep -v 
> 'OK' | grep -v 'VERIFYING'`;
>        }
>
>        # Display failure and exit with an error if there are any failed ports 
> or units.
>        for my $controller (@controllers)
>        {
>                if ( @{$controllers{$controller}->{'failed_units'}} or 
> @{$controllers{$controller}->{'failed_ports'}} )
>                {
>                        print "Failure of one or more of the hardware RAID 
> devices.\n";
>                        exit 1;
>                }
>        }
> }
>
> # Check for any Areca RAID failures.
> if ( -x $ARCCLI )
> {
>        my @failed_raid_sets = `$ARCCLI rsf info | grep 'Raid Set' | grep -v 
> 'Normal'`;
>        # Display failure and exit with an error if there were any failed Raid 
> Sets.
>        if ( @failed_raid_sets )
>        {
>                        print "Failure of one or more of the hardware RAID 
> devices.\n";
>                        exit 1;
>        }
> }
>
> # Otherwise everything was OK.
> print "Success\n";
> exit 0;
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Mon-commit mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/mon-commit
>



-- 
Augie Schwer    -    [EMAIL PROTECTED]    -    http://schwer.us
Key fingerprint = 9815 AE19 AFD1 1FE7 5DEE 2AC3 CB99 2784 27B0 C072

_______________________________________________
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to