mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
- Pre-Init the $options array.
In some scenarios $options was already set with a previous filter. - Remove RRD file checking, test for existance of components instead.
This commit is contained in:
@@ -87,9 +87,14 @@ if (dbFetchCell("SELECT COUNT(*) FROM `ports_vlans` WHERE `port_id` = '".$port['
|
||||
$menu_options['vlans'] = 'VLANs';
|
||||
}
|
||||
|
||||
// Are there any CBQoS rrd's for this ifIndex?
|
||||
$cbqos = glob($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-cbqos-*.rrd');
|
||||
if (!empty($cbqos)) {
|
||||
// Are there any CBQoS components for this device?
|
||||
require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options = array(); // Re-init array in case it has been declared previously.
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
$components = $components[$device['device_id']]; // We only care about our device id.
|
||||
if (count($components) > 0) {
|
||||
$menu_options['cbqos'] = 'CBQoS';
|
||||
}
|
||||
|
||||
|
@@ -41,16 +41,6 @@ function find_child($components,$parent,$level) {
|
||||
}
|
||||
}
|
||||
|
||||
$rrdarr = glob($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-cbqos-*.rrd');
|
||||
if (!empty($rrdarr)) {
|
||||
require_once "../includes/component.php";
|
||||
$component = new component();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$components = $component->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$components = $components[$device['device_id']];
|
||||
|
||||
if (!isset($vars['policy'])) {
|
||||
// not set, find the first parent and use it.
|
||||
foreach ($components as $id => $array) {
|
||||
@@ -127,4 +117,3 @@ if (!empty($rrdarr)) {
|
||||
echo "</div>\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user