Alternate Poller IP instead of Hostname (#10981)

* optional alternative poller ip

* add missing schema update

* .

* enhance API Call 'add_device' with overwrite_ip key

* .

* .

* updating docs
This commit is contained in:
SourceDoctor
2020-01-30 13:20:30 +01:00
committed by GitHub
parent dc60edd8bf
commit 7950893cd1
14 changed files with 103 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
<?php
use App\Models\Device;
use LibreNMS\Config;
use LibreNMS\RRD\RrdDefinition;
@@ -43,7 +44,7 @@ function add_service($device, $type, $desc, $ip = 'localhost', $param = "", $ign
}
if (empty($ip)) {
$ip = $device['hostname'];
$ip = Device::pollerTarget($device['hostname']);
}
$insert = array('device_id' => $device['device_id'], 'service_ip' => $ip, 'service_type' => $type, 'service_changed' => array('UNIX_TIMESTAMP(NOW())'), 'service_desc' => $desc, 'service_param' => $param, 'service_ignore' => $ignore, 'service_status' => 3, 'service_message' => 'Service not yet checked', 'service_ds' => '{}', 'service_disabled' => $disabled);