[BACK]Return to check_bioctl CVS log [TXT][DIR] Up to [local] / nagios / check_bioctl

Diff for /nagios/check_bioctl/check_bioctl between version 1.18 and 1.19

version 1.18, 2011/12/27 02:12:38 version 1.19, 2011/12/27 02:23:57
Line 1 
Line 1 
 #!/usr/bin/perl -T  #!/usr/bin/perl -T
 # $RedRiver: check_bioctl,v 1.15 2009/11/23 22:24:45 andrew Exp $  # $AFresh1$
 ########################################################################  ########################################################################
 # check_bioctl *** A nagios check for OpenBSD bioctl  # check_bioctl *** A nagios check for OpenBSD bioctl
 #  #
Line 7 
Line 7 
 ########################################################################  ########################################################################
 use strict;  use strict;
 use warnings;  use warnings;
   use 5.010;
   
 local %ENV = ();  local %ENV = ();
   
Line 42 
Line 43 
 use utils qw($TIMEOUT %ERRORS &support);  use utils qw($TIMEOUT %ERRORS &support);
   
 $SIG{'ALRM'} = sub {  $SIG{'ALRM'} = sub {
     print "ERROR: $PROGNAME timeout\n";      say "ERROR: $PROGNAME timeout";
     exit $ERRORS{'UNKNOWN'};      exit $ERRORS{'UNKNOWN'};
 };  };
 alarm($TIMEOUT);  alarm($TIMEOUT);
Line 81 
Line 82 
 }  }
   
 if ($opt_V) {  if ($opt_V) {
     print_revision( $PROGNAME, '$Revision$ ' );      print_revision();
     exit $ERRORS{'OK'};      exit $ERRORS{'OK'};
 }  }
   
Line 114 
Line 115 
     }      }
 }  }
 if ( $have_results == 0 ) {  if ( $have_results == 0 ) {
     print "No results found\n";      say 'No results found';
 }  }
 exit $ERRORS{$state};  exit $ERRORS{$state};
   
Line 149 
Line 150 
     return %volumes;      return %volumes;
 }  }
   
 {  sub parse_bioctl_line {
     my $vid;      ($_) = @_;
     my $controller;      chomp;
   
     sub parse_bioctl_line {      my @o = map { s/^\s+|\s+$//g; $_ } split;
         ($_) = @_;      return if $o[0] eq 'Volume';
         chomp;  
   
         my @o = map { s/^\s+|\s+$//g; $_ } split;      state $vid = '';
         return if $o[0] eq 'Volume';      state $controller;
   
         $vid ||= '';      my $index = "$vid.$o[0]";
       if ( $o[0] !~ /^\d+$/ ) {
         my $index = "$vid.$o[0]";          $controller = shift @o;
         if ( $o[0] !~ /^\d+$/ ) {          $vid        = $o[0];
             $controller = shift @o;          $index      = $vid;
             $vid        = $o[0];  
             $index      = $vid;  
         }  
   
         return $index,  
             {  
             controller  => $controller,  
             volume_id   => $vid,  
             id          => shift @o,  
             status      => shift @o,  
             size        => shift @o,  
             device      => shift @o,  
             name        => shift @o,  
             description => join ' ',  
             @o,  
             };  
     }      }
   
       return $index, {
           controller  => $controller,
           volume_id   => $vid,
           id          => shift @o,
           status      => shift @o,
           size        => shift @o,
           device      => shift @o,
           name        => shift @o,
           description => join ' ', @o,
       };
 }  }
   
 sub check_status {  sub check_status {
Line 217 
Line 212 
   
 EOL  EOL
   
     print_revision( $PROGNAME, '$Revision$' );      print_revision();
   
     print $License;      print $License;
   
Line 225 
Line 220 
 }  }
   
 sub print_revision {  sub print_revision {
     my ( $prog, $rev ) = @_;      my $rev = '$Revision$';
     $rev =~ s/^\D+([\d\.]+)\D+$/v$1/xms;      $rev =~ s/^\D+([\d\.]+)\D+$/v$1/xms;
   
     print "$prog $rev\n";      say "$PROGNAME $rev";
   
     return 1;      return 1;
 }  }

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>