version 1.39, 2009/11/11 18:14:00 |
version 1.41, 2009/11/12 18:53:52 |
|
|
#!/usr/bin/perl -T |
#!/usr/bin/perl -T |
# $RedRiver: check_hw_sensors,v 1.38 2009/11/11 18:08:41 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 |
# check_hw_sensors *** A nagios check for OpenBSD sysctl hw.sensors |
# |
# |
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
EOL |
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 POSIX; |
use Config; |
use Config; |
my $PREFIX; |
my $PREFIX; |
|
|
BEGIN { |
BEGIN { |
## no critic 'warnings' |
## no critic 'warnings' |
no warnings 'uninitialized'; |
no warnings 'uninitialized'; |
$PREFIX = "${PREFIX}" || '/usr/local'; # Magic for OpenBSD ports tree |
$PREFIX = "${PREFIX}" || '/usr/local'; # Magic for OpenBSD ports tree |
} |
} |
use lib $PREFIX . '/libexec/nagios'; |
use lib $PREFIX . '/libexec/nagios'; |
use utils qw($TIMEOUT %ERRORS &support); |
use utils qw($TIMEOUT %ERRORS &support); |
|
|
|
$SIG{'ALRM'} = sub { |
|
print("ERROR: $PROGNAME timeout\n"); |
|
exit $ERRORS{'UNKNOWN'}; |
|
}; |
|
alarm($TIMEOUT); |
|
|
use Getopt::Long; |
use Getopt::Long; |
Getopt::Long::Configure('bundling'); |
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 $state = 'UNKNOWN'; # tells whether the it is warning, critical, or OK |
my $opt_V; |
my $opt_V; |
my $opt_h; |
my $opt_h; |
|
|
print $error . ' (' . scalar( @{ $STATES{$error} } ) . ')'; |
print $error . ' (' . scalar( @{ $STATES{$error} } ) . ')'; |
if ( $error ne 'OK' ) { |
if ( $error ne 'OK' ) { |
print '<br>'; |
print '<br>'; |
print map { " - $_<br>" } @{ $STATES{$error} }; |
print map {" - $_<br>"} @{ $STATES{$error} }; |
} |
} |
} |
} |
else { |
else { |