diff --git a/html/pages/device/port.inc.php b/html/pages/device/port.inc.php
index d1682ee56..ae6668f55 100644
--- a/html/pages/device/port.inc.php
+++ b/html/pages/device/port.inc.php
@@ -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';
}
diff --git a/html/pages/device/port/cbqos.inc.php b/html/pages/device/port/cbqos.inc.php
index e85d3de25..5db763cfe 100644
--- a/html/pages/device/port/cbqos.inc.php
+++ b/html/pages/device/port/cbqos.inc.php
@@ -41,90 +41,79 @@ 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) {
- if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
- // Found the first policy
- $vars['policy'] = $id;
- continue;
- }
- }
- }
- echo "\n\n";
-
- // Display the ingress policy at the top of the page.
- echo "
";
- echo ' Ingress Policy:
';
- $found = false;
+if (!isset($vars['policy'])) {
+ // not set, find the first parent and use it.
foreach ($components as $id => $array) {
- if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 1) && ($array['parent'] == 0) ) {
- echo "- ";
- echo('' . $array['label'] . '');
- find_child($components,$id,1);
- echo "
";
- $found = true;
- }
- }
- if (!$found) {
- // No Ingress policies
- echo 'No Policies
';
- }
- echo '
';
-
- // Display the egress policy at the top of the page.
- echo "";
- echo ' Egress Policy:
';
- $found = false;
- foreach ($components as $id => $array) {
- if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 2) && ($array['parent'] == 0) ) {
- echo "- ";
- echo('' . $array['label'] . '');
- find_child($components,$id,1);
- echo "
";
- $found = true;
- }
- }
- if (!$found) {
- // No Egress policies
- echo 'No Policies
';
- }
- echo "
\n\n";
-
- // Let's make sure the policy we are trying to access actually exists.
- foreach ($components as $id => $array) {
- if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($id == $vars['policy']) ) {
- // The policy exists.
-
- echo "
\n\n";
-
- // Display each graph row.
- echo "";
- echo "
Traffic by CBQoS Class - ".$components[$vars['policy']]['label']."
";
- $graph_array['policy'] = $vars['policy'];
- $graph_type = 'port_cbqos_traffic';
- include 'includes/print-interface-graphs.inc.php';
-
- echo "
QoS Drops by CBQoS Class - ".$components[$vars['policy']]['label']."
";
- $graph_array['policy'] = $vars['policy'];
- $graph_type = 'port_cbqos_bufferdrops';
- include 'includes/print-interface-graphs.inc.php';
-
- echo "
Buffer Drops by CBQoS Class - ".$components[$vars['policy']]['label']."
";
- $graph_array['policy'] = $vars['policy'];
- $graph_type = 'port_cbqos_qosdrops';
- include 'includes/print-interface-graphs.inc.php';
- echo "
\n\n";
+ if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) {
+ // Found the first policy
+ $vars['policy'] = $id;
+ continue;
}
}
}
+echo "\n\n";
+
+// Display the ingress policy at the top of the page.
+echo "";
+echo ' Ingress Policy:
';
+$found = false;
+foreach ($components as $id => $array) {
+ if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 1) && ($array['parent'] == 0) ) {
+ echo "- ";
+ echo('' . $array['label'] . '');
+ find_child($components,$id,1);
+ echo "
";
+ $found = true;
+ }
+}
+if (!$found) {
+ // No Ingress policies
+ echo 'No Policies
';
+}
+echo '
';
+
+// Display the egress policy at the top of the page.
+echo "";
+echo ' Egress Policy:
';
+$found = false;
+foreach ($components as $id => $array) {
+ if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['direction'] == 2) && ($array['parent'] == 0) ) {
+ echo "- ";
+ echo('' . $array['label'] . '');
+ find_child($components,$id,1);
+ echo "
";
+ $found = true;
+ }
+}
+if (!$found) {
+ // No Egress policies
+ echo 'No Policies
';
+}
+echo "
\n\n";
+
+// Let's make sure the policy we are trying to access actually exists.
+foreach ($components as $id => $array) {
+ if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($id == $vars['policy']) ) {
+ // The policy exists.
+
+ echo "
\n\n";
+
+ // Display each graph row.
+ echo "";
+ echo "
Traffic by CBQoS Class - ".$components[$vars['policy']]['label']."
";
+ $graph_array['policy'] = $vars['policy'];
+ $graph_type = 'port_cbqos_traffic';
+ include 'includes/print-interface-graphs.inc.php';
+
+ echo "
QoS Drops by CBQoS Class - ".$components[$vars['policy']]['label']."
";
+ $graph_array['policy'] = $vars['policy'];
+ $graph_type = 'port_cbqos_bufferdrops';
+ include 'includes/print-interface-graphs.inc.php';
+
+ echo "
Buffer Drops by CBQoS Class - ".$components[$vars['policy']]['label']."
";
+ $graph_array['policy'] = $vars['policy'];
+ $graph_type = 'port_cbqos_qosdrops';
+ include 'includes/print-interface-graphs.inc.php';
+ echo "
\n\n";
+ }
+}