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 JSON;
|
|
|
|
my $json;
|
|
|
|
|
|
|
|
open SENSORS, ('</etc/zabbix/sensors.conf') ||
|
|
|
|
die "Couldn't open /etc/zabbix/sensors.conf: $!\n";
|
|
|
|
|
|
|
|
|
|
|
|
foreach (<SENSORS>){
|
|
|
|
next unless (/^(\w+)(\s+)?=(\s+)?(.*)!(\-?\d+)!(\-?\d+)$/);
|
|
|
|
my ($sensor,$threshigh,$threslow) = ($1,$5,$6);
|
|
|
|
push @{$json->{data}}, {
|
|
|
|
"{#SENSORNAME}" => $sensor,
|
|
|
|
"{#SENSORTHRESHIGH}" => $threshigh,
|
|
|
|
"{#SENSORTHRESLOW}" => $threslow
|
|
|
|
};
|
|
|
|
}
|
|
|
|
close SENSORS;
|
|
|
|
print to_json($json);
|
|
|
|
exit(0);
|