=================================================================== RCS file: /cvs/nagios/check_hw_sensors/check_hw_sensors,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- nagios/check_hw_sensors/check_hw_sensors 2009/11/10 23:15:15 1.35 +++ nagios/check_hw_sensors/check_hw_sensors 2009/11/10 23:26:13 1.36 @@ -1,5 +1,5 @@ #!/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 # @@ -69,7 +69,7 @@ } if ($opt_V) { - print_revision( $PROGNAME, '$Revision: 1.35 $ ' ); + print_revision( $PROGNAME, '$Revision: 1.36 $ ' ); exit $ERRORS{'OK'}; } @@ -144,13 +144,13 @@ my $have_results = 0; $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} ) { $have_results++; $state = $error if $ERRORS{$state} < $ERRORS{$error}; if ($NAGIOS_OUTPUT) { - print "$error (" . scalar( @{ $STATES{$error} } ) . ")"; + print $error . ' (' . scalar( @{ $STATES{$error} } ) . ')'; if ( $error ne 'OK' ) { s/\s+/ /gxms; print '
'; @@ -158,7 +158,7 @@ } } else { - print "$error (" . scalar( @{ $STATES{$error} } ) . "):\n"; + print $error . ' (' . scalar( @{ $STATES{$error} } ) . "):\n"; foreach ( @{ $STATES{$error} } ) { print " $_\n"; } @@ -398,14 +398,14 @@ } foreach my $code ( 'warn', 'crit' ) { - if ( defined $check->{ $code . ".low" } - || defined $check->{ $code . ".high" } ) + if ( defined $check->{ $code . '.low' } + || defined $check->{ $code . '.high' } ) { - if (( defined $check->{ $code . ".low" } - && $check->{ $code . ".low" } >= $data + if (( defined $check->{ $code . '.low' } + && $check->{ $code . '.low' } >= $data ) - || ( defined $check->{ $code . ".high" } - && $check->{ $code . ".high" } <= $data ) + || ( defined $check->{ $code . '.high' } + && $check->{ $code . '.high' } <= $data ) ) { $result = $errors{$code}; @@ -418,7 +418,7 @@ my $c = $_; $c =~ s/[^\d\.]//gxms; if ( !length $c ) { - warn "INVALID CHECK (" . $_ . ") for '$code'\n"; + warn "INVALID CHECK ($_) for '$code'\n"; next; } @@ -529,7 +529,7 @@ EOL - print_revision( $PROGNAME, '$Revision: 1.35 $' ); + print_revision( $PROGNAME, '$Revision: 1.36 $' ); print $LICENSE;