summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2008-02-21 19:23:55 +0000
committerErmal Luçi <eri@pfsense.org>2008-02-21 19:23:55 +0000
commitfe93b17baff62f8a89bebe1b71ab2369f06d5442 (patch)
tree867cb76267a29c1dbe65b4a211cc18830f1bd19b
parentfce824608bfde0b239e141bb387f98f461c433f4 (diff)
downloadpfsense-fe93b17baff62f8a89bebe1b71ab2369f06d5442.zip
pfsense-fe93b17baff62f8a89bebe1b71ab2369f06d5442.tar.gz
* First attempt at fixing queues rrd graph
-rw-r--r--etc/inc/shaper.inc18
-rw-r--r--usr/local/www/status_rrd_graph_img.php76
2 files changed, 51 insertions, 43 deletions
diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc
index 7c9904a..9c1f721 100644
--- a/etc/inc/shaper.inc
+++ b/etc/inc/shaper.inc
@@ -340,6 +340,16 @@ class altq_root_queue {
}
+ function &get_queue_list($q = null) {
+ $qlist = array();
+
+ $qlist[$this->GetQname()] = & $this;
+ if (is_array($this->queues)) {
+ foreach ($this->queues as $queue)
+ $queue->get_queue_list(&$qlist);
+ }
+ }
+
function &add_queue($interface, &$queue, &$path, &$input_errors) {
if (!is_array($this->queues))
@@ -823,6 +833,14 @@ function GetEcn() {
+ function &get_queue_list(&$qlist) {
+ $qlist[$this->GetQname()] = & $this;
+ if (is_array($this->subqueues)) {
+ foreach ($this->subqueues as $queue)
+ $queue->get_queue_list(&$qlist);
+ }
+ }
+
function delete_queue() {
unref_on_altq_queue_list($this->GetQname());
if ($this->GetDefault())
diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php
index e7a813d..71c9a1d 100644
--- a/usr/local/www/status_rrd_graph_img.php
+++ b/usr/local/www/status_rrd_graph_img.php
@@ -105,12 +105,30 @@ exec("cd $rrddbpath;/usr/bin/find -name *.rrd", $databases);
rsort($databases);
/* compare bytes/sec counters, divide bps by 8 */
-if (isset($config['ezshaper']['step2']['download'])) {
- $downstream = (($config['ezshaper']['step2']['download']*1024)/8);
- $upstream = (($config['ezshaper']['step2']['upload']*1024)/8);
- $upif = $config['ezshaper']['step2']['outside_int'];
- $downif = $config['ezshaper']['step2']['inside_int'];
+read_altq_config();
+if (is_array($altq_list_queues[$curif])) {
+ $altq =& $altq_list_queues[$curif];
+ switch ($altq->GetBwscale()) {
+ case "Gb":
+ $factor = 1000 * 1000 * 1000;
+ break;
+ case "Mb":
+ $factor = 1000 * 1000;
+ break;
+ case "Kb":
+ $factor = 1000;
+ break;
+ case "b":
+ default:
+ $factor = 1;
+ break;
+ }
+ $upstream = (($altq->GetBandwidth()*$factor)/8);
+ $downstream = $upstream; /* XXX: Ugly hack */
+ $upif = $curif;
+ $downif = "lan"; /* XXX should this be set to something else?! */
} else {
+ $altq = array();
$downstream = 12500000;
$upstream = 12500000;
$upif = "wan";
@@ -488,12 +506,14 @@ elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdata
if (!is_array($config['shaper']['queue'])) {
$config['shaper']['queue'] = array();
}
- $a_queues = &$config['shaper']['queue'];
+ if (count($altq) > 0)
+ $a_queue =& $altq->get_queue_list($notused);
+ else
+ $a_queues = array();
$i = 0;
$t = 0;
foreach ($a_queues as $queue) {
- $name = $queue['name'];
- if((stristr($name, "$upif")) || (stristr($name, "up"))) {
+ $name = $queue->GetQname();
$color = "$colorqueuesup[$t]";
if($t > 0) { $stack = ":STACK"; }
$graphcmd .= "DEF:$name=$rrddbpath$curdatabase:$name:AVERAGE \\
@@ -503,22 +523,6 @@ elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdata
$AREA:$name-bits_out_neg#${color}:$name$stack \\";
$t++;
if($t > 7) { $t = 0; }
- }
- }
- $graphcmd .= "COMMENT:\"\\n\" \\";
- $stack = "";
- foreach ($a_queues as $queue) {
- $name = $queue['name'];
- if((stristr($name, "$downif")) || (stristr($name, "down"))) {
- $color = "$colorqueuesdown[$i]";
- if($i > 0) { $stack = ":STACK"; }
- $graphcmd .= "DEF:$name=$rrddbpath$curdatabase:$name:AVERAGE \\
- \"CDEF:$name-bytes_in=$name,0,$downstream,LIMIT,UN,0,$name,IF\" \\
- \"CDEF:$name-bits_in=$name-bytes_in,8,*\" \\
- $AREA:$name-bits_in#${color}:$name$stack \\";
- $i++;
- if($i > 7) { $i = 0; }
- }
}
$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\"`\"";
@@ -534,12 +538,14 @@ elseif((strstr($curdatabase, "-queuesdrop.rrd")) && (file_exists("$rrddbpath$cur
if (!is_array($config['shaper']['queue'])) {
$config['shaper']['queue'] = array();
}
- $a_queues = &$config['shaper']['queue'];
+ if (count($altq) > 0)
+ $a_queue =& $altq->get_queue_list($notused);
+ else
+ $a_queues = array();
$i = 0;
$t = 0;
foreach ($a_queues as $queue) {
- $name = $queue['name'];
- if((stristr($name, "$upif")) || (stristr($name, "up"))) {
+ $name = $queue->GetQname();
$color = "$colorqueuesdropup[$t]";
if($t > 0) { $stack = ":STACK"; }
$graphcmd .= "DEF:$name=$rrddbpath$curdatabase:$name:AVERAGE \\
@@ -549,22 +555,6 @@ elseif((strstr($curdatabase, "-queuesdrop.rrd")) && (file_exists("$rrddbpath$cur
$AREA:$name-bits_out_neg#${color}:$name \\";
$t++;
if($t > 7) { $t = 0; }
- }
- }
- $graphcmd .= "COMMENT:\"\\n\" \\";
- $stack = "";
- foreach ($a_queues as $queue) {
- $name = $queue['name'];
- if((stristr($name, "$downif")) || (stristr($name, "down"))) {
- $color = "$colorqueuesdropdown[$i]";
- if($i > 0) { $stack = ":STACK"; }
- $graphcmd .= "DEF:$name=$rrddbpath$curdatabase:$name:AVERAGE \\
- \"CDEF:$name-bytes_in=$name,0,$downstream,LIMIT,UN,0,$name,IF\" \\
- \"CDEF:$name-bits_in=$name-bytes_in,8,*\" \\
- LINE1:$name-bits_in#${color}:$name \\";
- $i++;
- if($i > 7) { $i = 0; }
- }
}
$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\"`\"";
OpenPOWER on IntegriCloud