=================================================================== RCS file: /cvs/nagios/check_hw_sensors/check_hw_sensors,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- nagios/check_hw_sensors/check_hw_sensors 2009/11/11 18:14:40 1.40 +++ nagios/check_hw_sensors/check_hw_sensors 2009/11/12 18:53:52 1.41 @@ -1,5 +1,5 @@ #!/usr/bin/perl -T -# $RedRiver: check_hw_sensors,v 1.39 2009/11/11 18:14:00 andrew Exp $ +# $RedRiver: check_hw_sensors,v 1.40 2009/11/11 18:14:40 andrew Exp $ ######################################################################## # check_hw_sensors *** A nagios check for OpenBSD sysctl hw.sensors # @@ -27,6 +27,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. EOL +my $PROGNAME = 'check_hw_sensors'; +my $SYSCTL = '/sbin/sysctl'; +my $GETCAP = '/usr/bin/getcap'; +my $BASE = 'hw.sensors'; +my $DEFAULT_CONFIG = '/etc/sensorsd.conf'; + use POSIX; use Config; my $PREFIX; @@ -39,17 +45,17 @@ use lib $PREFIX . '/libexec/nagios'; use utils qw($TIMEOUT %ERRORS &support); +$SIG{'ALRM'} = sub { + print("ERROR: $PROGNAME timeout\n"); + exit $ERRORS{'UNKNOWN'}; +}; +alarm($TIMEOUT); + use Getopt::Long; Getopt::Long::Configure('bundling'); -my $PROGNAME = 'check_hw_sensors'; +my $OSVer = $Config{'osvers'} || 0; -my $SYSCTL = '/sbin/sysctl'; -my $GETCAP = '/usr/bin/getcap'; -my $BASE = 'hw.sensors'; -my $DEFAULT_CONFIG = '/etc/sensorsd.conf'; -my $OSVer = $Config{'osvers'} || 0; - my $state = 'UNKNOWN'; # tells whether the it is warning, critical, or OK my $opt_V; my $opt_h; @@ -76,7 +82,7 @@ } if ($opt_V) { - print_revision( $PROGNAME, '$Revision: 1.40 $ ' ); + print_revision( $PROGNAME, '$Revision: 1.41 $ ' ); exit $ERRORS{'OK'}; } @@ -536,7 +542,7 @@ EOL - print_revision( $PROGNAME, '$Revision: 1.40 $' ); + print_revision( $PROGNAME, '$Revision: 1.41 $' ); print $LICENSE;