diff --git a/html/includes/graphs/port/cbqos_bufferdrops.inc.php b/html/includes/graphs/port/cbqos_bufferdrops.inc.php index 93626bc150..ea33507623 100644 --- a/html/includes/graphs/port/cbqos_bufferdrops.inc.php +++ b/html/includes/graphs/port/cbqos_bufferdrops.inc.php @@ -12,19 +12,19 @@ */ require_once "../includes/component.php"; -$COMPONENT = new component(); +$component = new component(); $options['filter']['type'] = array('=','Cisco-CBQOS'); -$COMPONENTS = $COMPONENT->getComponents($device['device_id'],$options); +$components = $component->getComponents($device['device_id'],$options); // We only care about our device id. -$COMPONENTS = $COMPONENTS[$device['device_id']]; +$components = $components[$device['device_id']]; // Determine a policy to show. if (!isset($vars['policy'])) { - foreach ($COMPONENTS as $ID => $ARRAY) { - if ( ($ARRAY['qos-type'] == 1) && ($ARRAY['ifindex'] == $port['ifIndex']) && ($ARRAY['parent'] == 0) ) { + foreach ($components as $id => $array) { + if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) { // Found the first policy - $vars['policy'] = $ID; + $vars['policy'] = $id; continue; } } @@ -35,34 +35,34 @@ $rrd_options .= " -l 0 -E "; $rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'"; $rrd_additions = ""; -$COUNT = 0; -foreach ($COMPONENTS as $ID => $ARRAY) { - if ( ($ARRAY['qos-type'] == 2) && ($ARRAY['parent'] == $COMPONENTS[$vars['policy']]['sp-obj']) && ($ARRAY['sp-id'] == $COMPONENTS[$vars['policy']]['sp-id'])) { - $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$ARRAY['ifindex']."-cbqos-".$ARRAY['sp-id']."-".$ARRAY['sp-obj'].".rrd"); +$count = 0; +foreach ($components as $id => $array) { + if ( ($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) { + $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd"); if (file_exists($rrd_filename)) { // Stack the area on the second and subsequent DS's - $STACK = ""; - if ($COUNT != 0) { - $STACK = ":STACK "; + $stack = ""; + if ($count != 0) { + $stack = ":STACK "; } // Grab a color from the array. - if ( isset($config['graph_colours']['mixed'][$COUNT]) ) { - $COLOR = $config['graph_colours']['mixed'][$COUNT]; + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; } else { - $COLOR = $config['graph_colours']['oranges'][$COUNT-7]; + $color = $config['graph_colours']['oranges'][$count-7]; } - $rrd_additions .= " DEF:DS" . $COUNT . "=" . $rrd_filename . ":bufferdrops:AVERAGE "; - $rrd_additions .= " CDEF:MOD" . $COUNT . "=DS" . $COUNT . ",8,* "; - $rrd_additions .= " AREA:MOD" . $COUNT . "#" . $COLOR . ":'" . str_pad(substr($COMPONENTS[$ID]['label'],0,15),15) . "'" . $STACK; - $rrd_additions .= " GPRINT:MOD" . $COUNT . ":LAST:%6.2lf%s "; - $rrd_additions .= " GPRINT:MOD" . $COUNT . ":AVERAGE:%6.2lf%s "; - $rrd_additions .= " GPRINT:MOD" . $COUNT . ":MAX:%6.2lf%s\\\l "; + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":bufferdrops:AVERAGE "; + $rrd_additions .= " CDEF:MOD" . $count . "=DS" . $count . ",8,* "; + $rrd_additions .= " AREA:MOD" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:MOD" . $count . ":LAST:%6.2lf%s "; + $rrd_additions .= " GPRINT:MOD" . $count . ":AVERAGE:%6.2lf%s "; + $rrd_additions .= " GPRINT:MOD" . $count . ":MAX:%6.2lf%s\\\l "; - $COUNT++; + $count++; } } } diff --git a/html/includes/graphs/port/cbqos_qosdrops.inc.php b/html/includes/graphs/port/cbqos_qosdrops.inc.php index ea107b3809..36f856eed5 100644 --- a/html/includes/graphs/port/cbqos_qosdrops.inc.php +++ b/html/includes/graphs/port/cbqos_qosdrops.inc.php @@ -12,19 +12,19 @@ */ require_once "../includes/component.php"; -$COMPONENT = new component(); +$component = new component(); $options['filter']['type'] = array('=','Cisco-CBQOS'); -$COMPONENTS = $COMPONENT->getComponents($device['device_id'],$options); +$components = $component->getComponents($device['device_id'],$options); // We only care about our device id. -$COMPONENTS = $COMPONENTS[$device['device_id']]; +$components = $components[$device['device_id']]; // Determine a policy to show. if (!isset($vars['policy'])) { - foreach ($COMPONENTS as $ID => $ARRAY) { - if ( ($ARRAY['qos-type'] == 1) && ($ARRAY['ifindex'] == $port['ifIndex']) && ($ARRAY['parent'] == 0) ) { + foreach ($components as $id => $array) { + if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) { // Found the first policy - $vars['policy'] = $ID; + $vars['policy'] = $id; continue; } } @@ -35,34 +35,34 @@ $rrd_options .= " -l 0 -E "; $rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'"; $rrd_additions = ""; -$COUNT = 0; -foreach ($COMPONENTS as $ID => $ARRAY) { - if ( ($ARRAY['qos-type'] == 2) && ($ARRAY['parent'] == $COMPONENTS[$vars['policy']]['sp-obj']) && ($ARRAY['sp-id'] == $COMPONENTS[$vars['policy']]['sp-id'])) { - $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$ARRAY['ifindex']."-cbqos-".$ARRAY['sp-id']."-".$ARRAY['sp-obj'].".rrd"); +$count = 0; +foreach ($components as $id => $array) { + if ( ($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) { + $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd"); if (file_exists($rrd_filename)) { // Stack the area on the second and subsequent DS's - $STACK = ""; - if ($COUNT != 0) { - $STACK = ":STACK "; + $stack = ""; + if ($count != 0) { + $stack = ":STACK "; } // Grab a color from the array. - if ( isset($config['graph_colours']['mixed'][$COUNT]) ) { - $COLOR = $config['graph_colours']['mixed'][$COUNT]; + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; } else { - $COLOR = $config['graph_colours']['oranges'][$COUNT-7]; + $color = $config['graph_colours']['oranges'][$count-7]; } - $rrd_additions .= " DEF:DS" . $COUNT . "=" . $rrd_filename . ":qosdrops:AVERAGE "; - $rrd_additions .= " CDEF:MOD" . $COUNT . "=DS" . $COUNT . ",8,* "; - $rrd_additions .= " AREA:MOD" . $COUNT . "#" . $COLOR . ":'" . str_pad(substr($COMPONENTS[$ID]['label'],0,15),15) . "'" . $STACK; - $rrd_additions .= " GPRINT:MOD" . $COUNT . ":LAST:%6.2lf%s "; - $rrd_additions .= " GPRINT:MOD" . $COUNT . ":AVERAGE:%6.2lf%s "; - $rrd_additions .= " GPRINT:MOD" . $COUNT . ":MAX:%6.2lf%s\\\l "; + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":qosdrops:AVERAGE "; + $rrd_additions .= " CDEF:MOD" . $count . "=DS" . $count . ",8,* "; + $rrd_additions .= " AREA:MOD" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:MOD" . $count . ":LAST:%6.2lf%s "; + $rrd_additions .= " GPRINT:MOD" . $count . ":AVERAGE:%6.2lf%s "; + $rrd_additions .= " GPRINT:MOD" . $count . ":MAX:%6.2lf%s\\\l "; - $COUNT++; + $count++; } } } diff --git a/html/includes/graphs/port/cbqos_traffic.inc.php b/html/includes/graphs/port/cbqos_traffic.inc.php index 3cf7291fdf..eabd919094 100644 --- a/html/includes/graphs/port/cbqos_traffic.inc.php +++ b/html/includes/graphs/port/cbqos_traffic.inc.php @@ -12,19 +12,19 @@ */ require_once "../includes/component.php"; -$COMPONENT = new component(); +$component = new component(); $options['filter']['type'] = array('=','Cisco-CBQOS'); -$COMPONENTS = $COMPONENT->getComponents($device['device_id'],$options); +$components = $component->getComponents($device['device_id'],$options); // We only care about our device id. -$COMPONENTS = $COMPONENTS[$device['device_id']]; +$components = $components[$device['device_id']]; // Determine a policy to show. if (!isset($vars['policy'])) { - foreach ($COMPONENTS as $ID => $ARRAY) { - if ( ($ARRAY['qos-type'] == 1) && ($ARRAY['ifindex'] == $port['ifIndex']) && ($ARRAY['parent'] == 0) ) { + foreach ($components as $id => $array) { + if ( ($array['qos-type'] == 1) && ($array['ifindex'] == $port['ifIndex']) && ($array['parent'] == 0) ) { // Found the first policy - $vars['policy'] = $ID; + $vars['policy'] = $id; continue; } } @@ -35,34 +35,34 @@ $rrd_options .= " -l 0 -E "; $rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'"; $rrd_additions = ""; -$COUNT = 0; -foreach ($COMPONENTS as $ID => $ARRAY) { - if ( ($ARRAY['qos-type'] == 2) && ($ARRAY['parent'] == $COMPONENTS[$vars['policy']]['sp-obj']) && ($ARRAY['sp-id'] == $COMPONENTS[$vars['policy']]['sp-id'])) { - $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$ARRAY['ifindex']."-cbqos-".$ARRAY['sp-id']."-".$ARRAY['sp-obj'].".rrd"); +$count = 0; +foreach ($components as $id => $array) { + if ( ($array['qos-type'] == 2) && ($array['parent'] == $components[$vars['policy']]['sp-obj']) && ($array['sp-id'] == $components[$vars['policy']]['sp-id'])) { + $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd"); if (file_exists($rrd_filename)) { // Stack the area on the second and subsequent DS's - $STACK = ""; - if ($COUNT != 0) { - $STACK = ":STACK "; + $stack = ""; + if ($count != 0) { + $stack = ":STACK "; } // Grab a color from the array. - if ( isset($config['graph_colours']['mixed'][$COUNT]) ) { - $COLOR = $config['graph_colours']['mixed'][$COUNT]; + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; } else { - $COLOR = $config['graph_colours']['oranges'][$COUNT-7]; + $color = $config['graph_colours']['oranges'][$count-7]; } - $rrd_additions .= " DEF:DS" . $COUNT . "=" . $rrd_filename . ":postbits:AVERAGE "; - $rrd_additions .= " CDEF:MOD" . $COUNT . "=DS" . $COUNT . ",8,* "; - $rrd_additions .= " AREA:MOD" . $COUNT . "#" . $COLOR . ":'" . str_pad(substr($COMPONENTS[$ID]['label'],0,15),15) . "'" . $STACK; - $rrd_additions .= " GPRINT:MOD" . $COUNT . ":LAST:%6.2lf%s "; - $rrd_additions .= " GPRINT:MOD" . $COUNT . ":AVERAGE:%6.2lf%s "; - $rrd_additions .= " GPRINT:MOD" . $COUNT . ":MAX:%6.2lf%s\\\l "; + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":postbits:AVERAGE "; + $rrd_additions .= " CDEF:MOD" . $count . "=DS" . $count . ",8,* "; + $rrd_additions .= " AREA:MOD" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:MOD" . $count . ":LAST:%6.2lf%s "; + $rrd_additions .= " GPRINT:MOD" . $count . ":AVERAGE:%6.2lf%s "; + $rrd_additions .= " GPRINT:MOD" . $count . ":MAX:%6.2lf%s\\\l "; - $COUNT++; + $count++; } } } diff --git a/html/pages/device/port/cbqos.inc.php b/html/pages/device/port/cbqos.inc.php index fbcfafdd0d..e85d3de253 100644 --- a/html/pages/device/port/cbqos.inc.php +++ b/html/pages/device/port/cbqos.inc.php @@ -11,29 +11,29 @@ * the source code distribution for details. */ -function find_child($COMPONENTS,$parent,$level) { +function find_child($components,$parent,$level) { global $vars; - foreach($COMPONENTS as $ID => $ARRAY) { - if ($ARRAY['qos-type'] == 3) { + foreach($components as $id => $array) { + if ($array['qos-type'] == 3) { continue; } - if (($ARRAY['parent'] == $COMPONENTS[$parent]['sp-obj']) && ($ARRAY['sp-id'] == $COMPONENTS[$parent]['sp-id'])) { + if (($array['parent'] == $components[$parent]['sp-obj']) && ($array['sp-id'] == $components[$parent]['sp-id'])) { echo ""; @@ -44,23 +44,19 @@ 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(); + $component = new component(); $options['filter']['type'] = array('=','Cisco-CBQOS'); - $COMPONENTS = $COMPONENT->getComponents($device['device_id'],$options); + $components = $component->getComponents($device['device_id'],$options); // We only care about our device id. - $COMPONENTS = $COMPONENTS[$device['device_id']]; + $components = $components[$device['device_id']]; - if (isset($vars['policy'])) { - // if a policy is set try to use it. - $graph_array['policy'] = $vars['policy']; - } - else { - // if not, find the first parent and use it. - foreach ($COMPONENTS as $ID => $ARRAY) { - if ( ($ARRAY['qos-type'] == 1) && ($ARRAY['ifindex'] == $port['ifIndex']) && ($ARRAY['parent'] == 0) ) { + 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 - $graph_array['policy'] = $ID; + $vars['policy'] = $id; continue; } } @@ -70,17 +66,17 @@ if (!empty($rrdarr)) { // Display the ingress policy at the top of the page. echo "