mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Dynamic use of nagios-service checks
This commit is contained in:
@@ -31,8 +31,16 @@ foreach (dbFetchRows('SELECT * FROM `devices` AS D, `services` AS S WHERE S.devi
|
||||
include $checker_script;
|
||||
}
|
||||
else {
|
||||
$status = '2';
|
||||
$check = "Error : Script not found ($checker_script)";
|
||||
$cmd = $config['nagios_plugins'] . "/check_" . $service['service_type'] . " -H " . ($service['service_ip'] ? $service['service_ip'] : $service['hostname']);
|
||||
$cmd .= " ".$service['service_param'];
|
||||
$check = shell_exec($cmd);
|
||||
list($check, $time) = split("\|", $check);
|
||||
if(stristr($check, "ok -")) {
|
||||
$status = 1;
|
||||
}
|
||||
else {
|
||||
$status = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$update = array();
|
||||
|
||||
Reference in New Issue
Block a user