mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix smokeping slave not found causing error (#11799)
This commit is contained in:
+20
-14
@@ -86,21 +86,27 @@ class Smokeping
|
||||
public function otherGraphs($direction)
|
||||
{
|
||||
$remote = $direction == 'in' ? 'src' : 'dest';
|
||||
$data = array_keys(array_filter($this->getFiles()[$direction][$this->device->hostname], function ($file) {
|
||||
return Str::contains($file, '~');
|
||||
}));
|
||||
$data = [];
|
||||
foreach ($this->getFiles()[$direction][$this->device->hostname] as $remote_host => $file) {
|
||||
if (Str::contains($file, '~')) {
|
||||
$device = \DeviceCache::getByHostname($remote_host);
|
||||
if (empty($device->device_id)) {
|
||||
\Log::debug('Could not find smokeping slave device in LibreNMS', ['slave' => $remote_host]);
|
||||
continue;
|
||||
}
|
||||
|
||||
return array_map(function ($other) use ($direction, $remote) {
|
||||
$device = \DeviceCache::getByHostname($other);
|
||||
return [
|
||||
'device' => $device,
|
||||
'graph' => [
|
||||
'type' => 'smokeping_' . $direction,
|
||||
'device' => $this->device->device_id,
|
||||
$remote => $device->device_id,
|
||||
]
|
||||
];
|
||||
}, $data);
|
||||
$data[] = [
|
||||
'device' => $device,
|
||||
'graph' => [
|
||||
'type' => 'smokeping_' . $direction,
|
||||
'device' => $this->device->device_id,
|
||||
$remote => $device->device_id,
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function hasGraphs()
|
||||
|
||||
Reference in New Issue
Block a user