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

Diff for /nagios/check_hw_sensors/check_hw_sensors between version 1.35 and 1.36

version 1.35, 2009/11/10 23:15:15 version 1.36, 2009/11/10 23:26:13
Line 1 
Line 1 
 #!/usr/bin/perl -T  #!/usr/bin/perl -T
 # $RedRiver: check_hw_sensors,v 1.34 2009/11/10 23:12:49 andrew Exp $  # $RedRiver: check_hw_sensors,v 1.35 2009/11/10 23:15:15 andrew Exp $
 ########################################################################  ########################################################################
 # check_hw_sensors *** A nagios check for OpenBSD sysctl hw.sensors  # check_hw_sensors *** A nagios check for OpenBSD sysctl hw.sensors
 #  #
Line 144 
Line 144 
   
 my $have_results = 0;  my $have_results = 0;
 $state = 'OK';  $state = 'OK';
 foreach my $error ( sort { $ERRORS{$b} <=> $ERRORS{$a} } keys %ERRORS ) {  foreach my $error ( reverse sort { $ERRORS{$a} <=> $ERRORS{$b} } keys %ERRORS ) {
     if ( exists $STATES{$error} ) {      if ( exists $STATES{$error} ) {
         $have_results++;          $have_results++;
         $state = $error if $ERRORS{$state} < $ERRORS{$error};          $state = $error if $ERRORS{$state} < $ERRORS{$error};
   
         if ($NAGIOS_OUTPUT) {          if ($NAGIOS_OUTPUT) {
             print "$error (" . scalar( @{ $STATES{$error} } ) . ")";              print $error . ' (' . scalar( @{ $STATES{$error} } ) . ')';
             if ( $error ne 'OK' ) {              if ( $error ne 'OK' ) {
                 s/\s+/ /gxms;                  s/\s+/ /gxms;
                 print '<br>';                  print '<br>';
Line 158 
Line 158 
             }              }
         }          }
         else {          else {
             print "$error (" . scalar( @{ $STATES{$error} } ) . "):\n";              print $error . ' (' . scalar( @{ $STATES{$error} } ) . "):\n";
             foreach ( @{ $STATES{$error} } ) {              foreach ( @{ $STATES{$error} } ) {
                 print "   $_\n";                  print "   $_\n";
             }              }
Line 398 
Line 398 
     }      }
   
     foreach my $code ( 'warn', 'crit' ) {      foreach my $code ( 'warn', 'crit' ) {
         if (   defined $check->{ $code . ".low" }          if (   defined $check->{ $code . '.low' }
             || defined $check->{ $code . ".high" } )              || defined $check->{ $code . '.high' } )
         {          {
             if ((   defined $check->{ $code . ".low" }              if ((   defined $check->{ $code . '.low' }
                     && $check->{ $code . ".low" } >= $data                      && $check->{ $code . '.low' } >= $data
                 )                  )
                 || ( defined $check->{ $code . ".high" }                  || ( defined $check->{ $code . '.high' }
                     && $check->{ $code . ".high" } <= $data )                      && $check->{ $code . '.high' } <= $data )
                 )                  )
             {              {
                 $result = $errors{$code};                  $result = $errors{$code};
Line 418 
Line 418 
                 my $c = $_;                  my $c = $_;
                 $c =~ s/[^\d\.]//gxms;                  $c =~ s/[^\d\.]//gxms;
                 if ( !length $c ) {                  if ( !length $c ) {
                     warn "INVALID CHECK (" . $_ . ") for '$code'\n";                      warn "INVALID CHECK ($_) for '$code'\n";
                     next;                      next;
                 }                  }
   

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

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