check_disksuite2 (to 'warewolf')

Alexander Harvey alexh19740110 at gmail.com
Wed Nov 8 02:23:38 CET 2006


Hi Warewolf & All,

After looking at the code carefully, I decided it'd be easier for my
purposes to rewrite:  I only have access to RAID1 to test so the code won't
work if you're using a different RAID level. Feedback is most welcome!

#!/usr/bin/perl

use constant OK => 0;
use constant CRITICAL => 2;

open METASTAT, "-|", "/usr/sbin/metastat" || die "Couldn't run metastat
($!)";

while ( <METASTAT> )
{
  chomp;
  s/^\s+//;
  if ( /^(d\d+): (.+)/ ) # begin new device
  {
    $device = $1;
    $type = $2;
  }
  if ( $type eq "Mirror" ) # begin new device of type "Mirror"
  {
    if ( /^Submirror \d+: (d\d+)/ ) # begin new "Submirror"
    {
      $submirror = $1;
      $submirrors++;
    }
    if ( /^State: (\S+)/ ) # read in new "State"
    {
      $state = $1;
      if ( $state ne "Okay" )
      {
        $message .= " and submirror $submirror of mirror $device is
\"$state\"";
        $exitcode = CRITICAL;
      }
    }
  }
  if ( $_ eq "" ) # finished with device on blank line
  {
    if ( $type eq "Mirror" && $submirrors == 1 )
    {
        $message .= " and $device has only one submirror!";
        $exitcode = CRITICAL;
    }
    undef $submirrors; # clear our flags
    undef $device;
    next;
  }
}
close METASTAT;

$message =~ s/^ and //;

if    ( $exitcode == OK )       { print "OK - No disk failures detected\n" }
elsif ( $exitcode == CRITICAL ) { print "CRITICAL - $message\n";           }
exit $exitcode;

Kind Regards,
Alex Harvey



On 11/7/06, Alexander Harvey <alexh19740110 at gmail.com> wrote:
>
> Hi to Warewolf
>
> --or anyone else using the check_disksuite2 plugin from the
> NagiosExchange--if you're out there!
>
> I have been using your plugin and have discovered a "bug" / feature
> depending on what you intended: in the event that a submirror is detached,
> the plugin returns a value of OK.
>
> Just wondering if you're happy for me to submit a patch for this? Or is it
> something you'd rather look at yourself? Or has someone out there prepared a
> patch already?
>
> Kind Regards,
> Alex Harvey
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20061108/15ec49c8/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list