mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix various issues with loading os definitions (#11640)
* Ping only device doesn't display if os was set to something, ping os wasn't loaded and we try to get overview graphs from it. * Fix snmp_disable device page load error When other os is set. * Revamp os setting loading the only safe way to access is Config::getOsSetting() * Remove getOsSetting fallback behavior Most instances don't use it and it can have unexpected results Config::getOsSetting('blah', 'group') == 'librenms' * refactor and remove unneeded load_os/loadOs calls now since getOsSetting automatically loads it. * restore unix overview graphs, they are different small cleanups * fix
This commit is contained in:
@@ -12,6 +12,7 @@ use Gate;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Util\Graph;
|
||||
use LibreNMS\Util\Url;
|
||||
|
||||
class DeviceController extends Controller
|
||||
@@ -130,7 +131,7 @@ class DeviceController extends Controller
|
||||
];
|
||||
|
||||
$graphs = [];
|
||||
foreach ($this->getDeviceGraphs($device) as $graph) {
|
||||
foreach (Graph::getOverviewGraphsForDevice($device) as $graph) {
|
||||
$graph_array['type'] = $graph['graph'];
|
||||
$graph_array['popup_title'] = __($graph['text']);
|
||||
$graphs[] = $graph_array;
|
||||
@@ -139,18 +140,6 @@ class DeviceController extends Controller
|
||||
return $graphs;
|
||||
}
|
||||
|
||||
private function getDeviceGraphs(Device $device)
|
||||
{
|
||||
if ($device->snmp_disable) {
|
||||
return Config::get('os.ping.over');
|
||||
} elseif (Config::has("os.$device->os.over")) {
|
||||
return Config::get("os.$device->os.over");
|
||||
}
|
||||
|
||||
$os_group = Config::getOsSetting($device->os, 'group');
|
||||
return Config::get("os.$os_group.over", Config::get('os.default.over'));
|
||||
}
|
||||
|
||||
private function deviceLinkMenu(Device $device)
|
||||
{
|
||||
$device_links = [];
|
||||
|
Reference in New Issue
Block a user