From 21a0464c1a66792acd91e852c47d7838c49df303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=C3=A7i?= Date: Sat, 23 Feb 2008 02:22:30 +0000 Subject: * Unbreak rrd graphs for queues and make them multiinterface aware * Add a new tab for queuedrops with multiinterface there is no way to have them in the same tab * Remove $GLOBAL where used and use proper accessor functions * Remove Manuel from copyright this file has been rewritten * Some bugs fixes in general --- usr/local/www/status_rrd_graph_img.php | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'usr/local/www/status_rrd_graph_img.php') diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index 71c9a1d..77b9c1c 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -106,7 +106,7 @@ rsort($databases); /* compare bytes/sec counters, divide bps by 8 */ read_altq_config(); -if (is_array($altq_list_queues[$curif])) { +if ($altq_list_queues[$curif]) { $altq =& $altq_list_queues[$curif]; switch ($altq->GetBwscale()) { case "Gb": @@ -128,7 +128,7 @@ if (is_array($altq_list_queues[$curif])) { $upif = $curif; $downif = "lan"; /* XXX should this be set to something else?! */ } else { - $altq = array(); + $altq = null; $downstream = 12500000; $upstream = 12500000; $upif = "wan"; @@ -503,17 +503,13 @@ elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdata --color SHADEA#eeeeee --color SHADEB#eeeeee \\ --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\ --height 200 --width 620 -x \"$scale\" \\"; - if (!is_array($config['shaper']['queue'])) { - $config['shaper']['queue'] = array(); - } - if (count($altq) > 0) - $a_queue =& $altq->get_queue_list($notused); + if ($altq) + $a_queues =& $altq->get_queue_list(); else $a_queues = array(); $i = 0; $t = 0; - foreach ($a_queues as $queue) { - $name = $queue->GetQname(); + foreach ($a_queues as $name => $q) { $color = "$colorqueuesup[$t]"; if($t > 0) { $stack = ":STACK"; } $graphcmd .= "DEF:$name=$rrddbpath$curdatabase:$name:AVERAGE \\ @@ -527,7 +523,7 @@ elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdata $graphcmd .= "COMMENT:\"\\n\" \\"; $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\""; } -elseif((strstr($curdatabase, "-queuesdrop.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { +elseif((strstr($curdatabase, "-queuedrops.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { /* define graphcmd for queuedrop stats */ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\ --start -$seconds -e -$average \\ @@ -535,17 +531,13 @@ elseif((strstr($curdatabase, "-queuesdrop.rrd")) && (file_exists("$rrddbpath$cur --color SHADEA#eeeeee --color SHADEB#eeeeee \\ --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\ --height 200 --width 620 -x \"$scale\" \\"; - if (!is_array($config['shaper']['queue'])) { - $config['shaper']['queue'] = array(); - } - if (count($altq) > 0) - $a_queue =& $altq->get_queue_list($notused); + if ($altq) + $a_queues =& $altq->get_queue_list(); else $a_queues = array(); $i = 0; $t = 0; - foreach ($a_queues as $queue) { - $name = $queue->GetQname(); + foreach ($a_queues as $name => $q) { $color = "$colorqueuesdropup[$t]"; if($t > 0) { $stack = ":STACK"; } $graphcmd .= "DEF:$name=$rrddbpath$curdatabase:$name:AVERAGE \\ -- cgit v1.1