zabbix-agent-addons/zabbix_scripts/check_sensors_sudo

33 lines
422 B
Plaintext
Raw Normal View History

2013-04-15 18:43:43 +02:00
#!/usr/bin/perl -w
use strict;
use warnings;
use Config::Simple;
2013-04-15 18:43:43 +02:00
my $what = $ARGV[0];
unless (defined $what){
usage();
exit(1);
2013-04-15 18:43:43 +02:00
}
my $cfg = new Config::Simple;
$cfg->read('/etc/zabbix/sensors.ini');
2013-04-15 18:43:43 +02:00
my $ret = 'ZBX_NOTSUPPORTED';
my $sensor = $cfg->get_block($what);
if ($sensor && $sensor->{cmd}){
$ret = qx($sensor->{cmd});
2013-04-15 18:43:43 +02:00
}
2013-04-15 18:43:43 +02:00
print $ret;
exit(0);
sub usage {
print <<"EOF";
Usage: $0 sensor_name
EOF
}