summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-03-05 22:54:30 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-03-05 22:54:30 +0000
commitfccb044c4d955c61dc61d7627865f0e3cd089668 (patch)
treed3eb21ab20c17888b323489f8a6b1dc468e54d44
parentb45ea70973d1c11cbc347aacf839f55a6d3694f5 (diff)
downloadpfsense-fccb044c4d955c61dc61d7627865f0e3cd089668.zip
pfsense-fccb044c4d955c61dc61d7627865f0e3cd089668.tar.gz
* Modify queue graph to show the amount of bandwidth going through each queue compared to total bandwidth
* Add current queue traffic speed
-rw-r--r--etc/inc/pfsense-utils.inc7
-rwxr-xr-xusr/local/www/firewall_shaper_queues.php30
2 files changed, 26 insertions, 11 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index a2730e7..0a66d6e 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -566,13 +566,12 @@ function gather_altq_queue_stats() {
foreach ($stats_array as $stats_line) {
if (preg_match_all("/queue\s+(\w+)\s+/",$stats_line,$match_array))
$queue_name = $match_array[1][0];
- #\n+\/\n+
- if (preg_match_all("/qlength:\s+([0-99999]\/\s+[0-99999])\s+]/",$stats_line,$match_array))
- $qlength = $match_array[1][0];
+ if (preg_match_all("/measured:\s+.*packets\/s\,\s(.*)\s+\]/",$stats_line,$match_array))
+ $speed = $match_array[1][0];
if (preg_match_all("/measured:\s+(.*)packets/",$stats_line,$match_array)) {
$measured = $match_array[1][0];
if(stristr($queue_name,"root_") == false)
- array_push($queue_stats, "{$queue_name}|{$qlength}|{$measured}");
+ array_push($queue_stats, "{$queue_name}|{$speed}|{$measured}");
}
}
return $queue_stats;
diff --git a/usr/local/www/firewall_shaper_queues.php b/usr/local/www/firewall_shaper_queues.php
index 22e0d08..800e41a 100755
--- a/usr/local/www/firewall_shaper_queues.php
+++ b/usr/local/www/firewall_shaper_queues.php
@@ -131,8 +131,8 @@ if ($_GET['act'] == "del") {
<tr>
<td width="10%" class="listhdrr">No.</td>
<td width="20%" class="listhdrr">Priority</td>
- <td width="20%" class="listhdr">Default</td>
- <td width="40%" class="listhdr">Name</td>
+ <td width="10%" class="listhdr">Default</td>
+ <td width="50%" class="listhdr">Name</td>
<td width="10%" class="list"></td>
</tr>
<?php $i = 0; foreach ($a_queues as $queue): ?>
@@ -161,7 +161,7 @@ if ($_GET['act'] == "del") {
echo "<img src='bar_blue.gif' height='15' name='queue{$i}widtha' id='queue{$i}widtha' width='" . $cpuUsage . "' border='0' align='absmiddle'>";
echo "<img src='bar_gray.gif' height='15' name='queue{$i}widthb' id='queue{$i}widthb' width='" . (100 - $cpuUsage) . "' border='0' align='absmiddle'>";
echo "<img src='bar_right.gif' height='15' width='5' border='0' align='absmiddle'> ";
- echo "<input style='border: 0px solid white; background-color:#990000; color:#FFFFFF;' size='10' name='queue{$i}meter' id='queue{$i}meter' value='{$cpuUsage}'>";
+ echo "<input style='border: 0px solid white; background-color:#990000; color:#FFFFFF;' size='15' name='queue{$i}meter' id='queue{$i}meter' value='{$cpuUsage}'>";
?>
</td>
@@ -190,6 +190,7 @@ if ($_GET['act'] == "del") {
<?php
+$counter = 0;
While(!Connection_Aborted()) {
$stats_array = gather_altq_queue_stats();
@@ -204,15 +205,30 @@ While(!Connection_Aborted()) {
$i = 0;
foreach($stats_array as $stats_line) {
$stat_line_split = split("\|", $stats_line);
- $packet_s = intval($stat_line_split[2]);
+ $packet_sampled = intval($stat_line_split[2]);
+ $speed = $stat_line_split[1];
echo "<script language='javascript'>\n";
- echo "document.queue{$i}widtha.style.width='{$packet_s}';\n";
- echo "document.queue{$i}widthb.style.width='" . (100 - $packet_s) . "';\n";
- echo "document.forms[0].queue{$i}meter.value = '" . $packet_s . "/s';\n";
+
+ $packet_s = round(100 * (1 - $packet_sampled / $total_packets_s), 0);
+
+ echo "document.queue{$i}widthb.style.width='{$packet_s}';\n";
+ echo "document.queue{$i}widtha.style.width='" . (100 - $packet_s) . "';\n";
+ echo "document.forms[0].queue{$i}meter.value = '" . $packet_sampled . " - " . $speed . "';\n";
echo "</script>\n";
$i++;
}
+ /*
+ * prevent user from running out of ram.
+ * firefox and ie can be a bear on ram usage!
+ */
+ $counter++;
+ if($counter > 10000) {
+ echo "Redirecting to <a href=\"firewall_shaper_queues.php\">Firewall Shaper Queues</a>.<p>";
+ echo "<meta http-equiv=\"refresh\" content=\"1;url=firewall_shaper_queues.php\">";
+ exit;
+ }
+
}
?> \ No newline at end of file
OpenPOWER on IntegriCloud