mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: inconsistent device discovery (#6518)
There were two or more separate $device arrays during discovery. When one was updated, others were not. Combine those all. Make sure the new os is loaded if the os changed.
This commit is contained in:
committed by
Neil Lathwood
parent
0211c5864b
commit
374a4041af
@@ -121,6 +121,7 @@ if (!empty($config['distributed_poller_group'])) {
|
||||
$where .= ' AND poller_group IN('.$config['distributed_poller_group'].')';
|
||||
}
|
||||
|
||||
global $device;
|
||||
foreach (dbFetch("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 $where ORDER BY device_id DESC", $sqlparams) as $device) {
|
||||
discover_device($device, $options);
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ function discover_new_device($hostname, $device = '', $method = '', $interface =
|
||||
|
||||
//end discover_new_device()
|
||||
|
||||
function discover_device($device, $options = null)
|
||||
function discover_device(&$device, $options = null)
|
||||
{
|
||||
global $config, $valid;
|
||||
|
||||
|
@@ -1,10 +1,15 @@
|
||||
<?php
|
||||
|
||||
$os = getHostOS($device);
|
||||
$os = getHostOS($device);
|
||||
if ($os != $device['os']) {
|
||||
log_event('Device OS changed ' . $device['os'] . " => $os", $device, 'system', 3);
|
||||
$device['os'] = $os;
|
||||
$sql = dbUpdate(array('os' => $os), 'devices', 'device_id=?', array($device['device_id']));
|
||||
|
||||
if (!isset($config['os'][$device['os']])) {
|
||||
load_os($device);
|
||||
}
|
||||
|
||||
echo "Changed OS! : $os\n";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user