Additional scripts for Zabbix agent on Linux to discover and monitor several services
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Config::Simple;
|
|
|
|
|
|
|
|
my $what = $ARGV[0];
|
|
|
|
|
|
|
|
unless (defined $what){
|
|
|
|
usage();
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
my $cfg = new Config::Simple;
|
|
|
|
$cfg->read('/etc/zabbix/sensors.ini');
|
|
|
|
|
|
|
|
my $ret = 'ZBX_NOTSUPPORTED';
|
|
|
|
my $sensor = $cfg->get_block($what);
|
|
|
|
if ($sensor && $sensor->{cmd}){
|
|
|
|
$ret = qx($sensor->{cmd});
|
|
|
|
}
|
|
|
|
|
|
|
|
print $ret;
|
|
|
|
exit(0);
|
|
|
|
|
|
|
|
sub usage {
|
|
|
|
print <<"EOF";
|
|
|
|
|
|
|
|
Usage: $0 sensor_name
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|