mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
|
||||
function get_service_status($device = null)
|
||||
@@ -115,21 +116,19 @@ function discover_service($device, $service)
|
||||
|
||||
function poll_service($service)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$update = array();
|
||||
$old_status = $service['service_status'];
|
||||
$check_cmd = "";
|
||||
|
||||
// if we have a script for this check, use it.
|
||||
$check_script = $config['install_dir'].'/includes/services/check_'.strtolower($service['service_type']).'.inc.php';
|
||||
$check_script = Config::get('install_dir') . '/includes/services/check_' . strtolower($service['service_type']) . '.inc.php';
|
||||
if (is_file($check_script)) {
|
||||
include $check_script;
|
||||
}
|
||||
|
||||
// If we do not have a cmd from the check script, build one.
|
||||
if ($check_cmd == "") {
|
||||
$check_cmd = $config['nagios_plugins'] . "/check_" . $service['service_type'] . " -H " . ($service['service_ip'] ? $service['service_ip'] : $service['hostname']);
|
||||
$check_cmd = Config::get('nagios_plugins') . "/check_" . $service['service_type'] . " -H " . ($service['service_ip'] ? $service['service_ip'] : $service['hostname']);
|
||||
$check_cmd .= " " . $service['service_param'];
|
||||
}
|
||||
|
||||
@@ -325,9 +324,8 @@ function check_service($command)
|
||||
*/
|
||||
function list_available_services()
|
||||
{
|
||||
global $config;
|
||||
$services = array();
|
||||
foreach (scandir($config['nagios_plugins']) as $file) {
|
||||
foreach (scandir(Config::get('nagios_plugins')) as $file) {
|
||||
if (substr($file, 0, 6) === 'check_') {
|
||||
$services[] = substr($file, 6);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user