summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-02-22 08:49:33 -0300
committerRenato Botelho <renato@netgate.com>2016-02-22 08:49:33 -0300
commit2fbac0b2d640eced65d65593e60f473726573349 (patch)
tree3b2cae7df56bb49f9fd80cb56e3d94b17443b7c5 /src
parent89c8934f0218387feb4e2c6ae26ef6d320cce4be (diff)
parente3f1065671b395b96ff92cc25185ac7a29d1b241 (diff)
downloadpfsense-2fbac0b2d640eced65d65593e60f473726573349.zip
pfsense-2fbac0b2d640eced65d65593e60f473726573349.tar.gz
Merge branch 'master' of github.com:dennypage/pfsense
* 'master' of github.com:dennypage/pfsense: Add stddev information to the quality graphs. Update config version to trigger upgrade of rrd files Add standard deviation to quality rrd files
Diffstat (limited to 'src')
-rw-r--r--src/conf.default/config.xml2
-rw-r--r--src/etc/inc/globals.inc2
-rw-r--r--src/etc/inc/rrd.inc12
-rw-r--r--src/etc/inc/upgrade_config.inc70
-rw-r--r--src/usr/local/www/status_rrd_graph_img.php25
5 files changed, 99 insertions, 12 deletions
diff --git a/src/conf.default/config.xml b/src/conf.default/config.xml
index f1bee76..1cc6b92 100644
--- a/src/conf.default/config.xml
+++ b/src/conf.default/config.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<pfsense>
- <version>14.5</version>
+ <version>14.6</version>
<lastchange/>
<system>
<optimization>normal</optimization>
diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc
index 235e14d..fda3529 100644
--- a/src/etc/inc/globals.inc
+++ b/src/etc/inc/globals.inc
@@ -99,7 +99,7 @@ $g = array(
"disablecrashreporter" => false,
"crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php",
"debug" => false,
- "latest_config" => "14.5",
+ "latest_config" => "14.6",
"nopkg_platforms" => array("cdrom"),
"minimum_ram_warning" => "101",
"minimum_ram_warning_text" => "128 MB",
diff --git a/src/etc/inc/rrd.inc b/src/etc/inc/rrd.inc
index 29411aa..690f6cb 100644
--- a/src/etc/inc/rrd.inc
+++ b/src/etc/inc/rrd.inc
@@ -1008,6 +1008,7 @@ for sock in {$g['varrun_path']}/dpinger_*.sock; do
gw=\$(echo "\$t" | awk '{ print \$1 }')
delay=\$(echo "\$t" | awk '{ print \$2 }')
+ stddev=\$(echo "\$t" | awk '{ print \$3 }')
loss=\$(echo "\$t" | awk '{ print \$4 }')
if echo "\$loss" | grep -Eqv '^[0-9]+\$'; then
@@ -1019,20 +1020,27 @@ for sock in {$g['varrun_path']}/dpinger_*.sock; do
# Convert delay to millisecond
delay=\$(echo "scale=7; \$delay / 1000 / 1000" | /usr/bin/bc)
fi
+ if echo "\$stddev" | grep -Eqv '^[0-9]+\$'; then
+ stddev="U"
+ else
+ # Convert stddev to millisecond
+ stddev=\$(echo "scale=7; \$stddev / 1000 / 1000" | /usr/bin/bc)
+ fi
if [ ! -f {$rrddbpath}\$gw-quality.rrd ]; then
{$rrdtool} create {$rrddbpath}\$gw-quality.rrd --step 60 \\
DS:loss:GAUGE:120:0:100 \\
DS:delay:GAUGE:120:0:100000 \\
+ DS:stddev:GAUGE:120:0:100000 \\
RRA:AVERAGE:0.5:1:1200 \\
RRA:AVERAGE:0.5:5:720 \\
RRA:AVERAGE:0.5:60:1860 \\
RRA:AVERAGE:0.5:1440:2284
- {$rrdtool} update {$rrddbpath}\$gw-quality.rrd -t loss:delay N:U:U
+ {$rrdtool} update {$rrddbpath}\$gw-quality.rrd -t loss:delay:stddev N:U:U:U
fi
- {$rrdtool} update {$rrddbpath}\$gw-quality.rrd -t loss:delay N:\$loss:\$delay
+ {$rrdtool} update {$rrddbpath}\$gw-quality.rrd -t loss:delay:stddev N:\$loss:\$delay:\$stddev
done
EOD;
diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc
index fd31a0a..403bc55 100644
--- a/src/etc/inc/upgrade_config.inc
+++ b/src/etc/inc/upgrade_config.inc
@@ -56,6 +56,9 @@
if (!function_exists("dump_rrd_to_xml")) {
require("rrd.inc");
}
+if (!function_exists("read_altq_config")) {
+ require("shaper.inc");
+}
/* Upgrade functions must be named:
* upgrade_XXX_to_YYY
@@ -4588,4 +4591,71 @@ function upgrade_144_to_145() {
}
}
+function upgrade_145_to_146() {
+ // Add standard deviation to the quality rrds
+ global $config, $g;
+
+ $rrddbpath = "/var/db/rrd";
+ $rrdtool = "/usr/local/bin/rrdtool";
+
+ $awkcmd = "/usr/bin/awk '";
+ $awkcmd .= "{\n";
+ $awkcmd .= " if (sub(/<\\/v><\\/row>/, \"</v><v>NaN</v></row>\") == 0)\n";
+ $awkcmd .= " {\n";
+ $awkcmd .= " if (/<\\/cdp_prep>/)\n";
+ $awkcmd .= " {\n";
+ $awkcmd .= " print \" <ds>\"\n";
+ $awkcmd .= " print \" <primary_value> 0.0000000000e+00 </primary_value>\"\n";
+ $awkcmd .= " print \" <secondary_value> 0.0000000000e+00 </secondary_value>\"\n";
+ $awkcmd .= " print \" <value> NaN </value>\"\n";
+ $awkcmd .= " print \" <unknown_datapoints> 0 </unknown_datapoints>\"\n";
+ $awkcmd .= " print \" </ds>\"\n";
+ $awkcmd .= " }\n";
+ $awkcmd .= " else if (/<!-- Round Robin Archives -->/)\n";
+ $awkcmd .= " {\n";
+ $awkcmd .= " print \" <ds>\"\n";
+ $awkcmd .= " print \" <name> stddev </name>\"\n";
+ $awkcmd .= " print \" <type> GAUGE </type>\"\n";
+ $awkcmd .= " print \" <minimal_heartbeat> 120 </minimal_heartbeat>\"\n";
+ $awkcmd .= " print \" <min> 0.0000000000e+00 </min>\"\n";
+ $awkcmd .= " print \" <max> 1.0000000000e+05 </max>\\n\"\n";
+ $awkcmd .= " print \" <!-- PDP Status -->\"\n";
+ $awkcmd .= " print \" <last_ds> 0 </last_ds>\"\n";
+ $awkcmd .= " print \" <value> 0.0000000000e+00 </value>\"\n";
+ $awkcmd .= " print \" <unknown_sec> 0 </unknown_sec>\"\n";
+ $awkcmd .= " print \" </ds>\\n\"\n";
+ $awkcmd .= " }\n";
+ $awkcmd .= " }\n";
+ $awkcmd .= " print;\n";
+ $awkcmd .= "}'";
+
+ if ($g['platform'] != $g['product_name']) {
+ /* restore the databases, if we have one */
+ if (restore_rrd()) {
+ /* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
+ @rename("{$g['cf_conf_path']}/rrd.tgz", "{$g['cf_conf_path']}/backup/rrd.tgz");
+ }
+ }
+
+ $databases = return_dir_as_array($rrddbpath, '/-quality\.rrd$/');
+ foreach ($databases as $database) {
+ $xmldump = "{$g['tmp_path']}/{$database}.xml";
+
+ if (platform_booting()) {
+ echo "Update RRD database {$database}.\n";
+ }
+
+ exec("$rrdtool dump {$rrddbpath}/{$database} | {$awkcmd} > {$xmldump}");
+ exec("$rrdtool restore -f {$xmldump} {$rrddbpath}/{$database}");
+ @unlink("{$xmldump}");
+ }
+
+ if (!platform_booting()) {
+ enable_rrd_graphing();
+ }
+ /* Let's save the RRD graphs after we run enable RRD graphing */
+ /* The function will restore the rrd.tgz so we will save it after */
+ exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='{$g['cf_conf_path']}' /etc/rc.backup_rrd.sh");
+}
+
?>
diff --git a/src/usr/local/www/status_rrd_graph_img.php b/src/usr/local/www/status_rrd_graph_img.php
index df3f3c3..ffb2508 100644
--- a/src/usr/local/www/status_rrd_graph_img.php
+++ b/src/usr/local/www/status_rrd_graph_img.php
@@ -263,6 +263,8 @@ $colorqueuesdropdown = array('000000', '7B7B7B', '999999', 'BBBBBB', 'CCCCCC', '
/* Quality Graph Delay >420, 180-420, 60-180, 20-60, <20, Delay Avg */
$colorqualityrtt = array('990000', 'a83c3c', 'b36666', 'bd9090', 'cccccc', '000000');
+/* Quality Graph Standard Deviation */
+$colorqualitystddev = '55333355';
/* Quality Graph Loss */
$colorqualityloss = 'ee0000';
@@ -1074,29 +1076,36 @@ if ((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdataba
--height 200 --width 620 \\
--lower-limit 0 \\
DEF:delayraw=$rrddbpath$curdatabase:delay:AVERAGE:step=$step \\
+ DEF:stddevraw=$rrddbpath$curdatabase:stddev:AVERAGE:step=$step \\
DEF:loss=$rrddbpath$curdatabase:loss:AVERAGE:step=$step \\
\"CDEF:delay=delayraw,1000,*\" \\
+ \"CDEF:stddev=stddevraw,1000,*\" \\
\"CDEF:loss10=loss,$multiplier,*\" \\
\"CDEF:r0=delay,20,MIN\" \\
\"CDEF:r1=delay,60,MIN\" \\
\"CDEF:r2=delay,180,MIN\" \\
\"CDEF:r3=delay,420,MIN\" \\
- COMMENT:\"\t\t\t\t\tDelay\t\t\t\tPacket loss\\n\" \\
+ COMMENT:\"\t\t\t\t\tDelay\t\t\t\tStddev\t\t\t Loss\\n\" \\
AREA:delay#$colorqualityrtt[0]:\"> 420 ms\" \\
- GPRINT:delay:MIN:\"\t\tMin\\: %7.2lf ms\" \\
- GPRINT:loss:MIN:\"\tMin\\: %3.1lf %%\\n\" \\
+ GPRINT:delay:MIN:\"\t\t Min\\: %7.2lf ms\" \\
+ GPRINT:stddev:MIN:\"\t Min\\: %7.2lf ms\" \\
+ GPRINT:loss:MIN:\"\t Min\\: %4.1lf %%\\n\" \\
AREA:r3#$colorqualityrtt[1]:\"180-420 ms\" \\
- GPRINT:delay:AVERAGE:\"\t\tAvg\\: %7.2lf ms\" \\
- GPRINT:loss:AVERAGE:\"\tAvg\\: %3.1lf %%\\n\" \\
+ GPRINT:delay:AVERAGE:\"\t\t Avg\\: %7.2lf ms\" \\
+ GPRINT:stddev:AVERAGE:\"\t Avg\\: %7.2lf ms\" \\
+ GPRINT:loss:AVERAGE:\"\t Avg\\: %4.1lf %%\\n\" \\
AREA:r2#$colorqualityrtt[2]:\"60-180 ms\" \\
- GPRINT:delay:MAX:\"\t\tMax\\: %7.2lf ms\" \\
- GPRINT:loss:MAX:\"\tMax\\: %3.1lf %%\\n\" \\
+ GPRINT:delay:MAX:\"\t\t Max\\: %7.2lf ms\" \\
+ GPRINT:stddev:MAX:\"\t Max\\: %7.2lf ms\" \\
+ GPRINT:loss:MAX:\"\t Max\\: %4.1lf %%\\n\" \\
AREA:r1#$colorqualityrtt[3]:\"20-60 ms\\n\" \\
AREA:r0#$colorqualityrtt[4]:\"< 20 ms\" \\
GPRINT:delay:LAST:\"\t\tLast\\: %7.2lf ms\" \\
- GPRINT:loss:LAST:\"\tLast\: %3.1lf %%\\n\" \\
+ GPRINT:stddev:LAST:\"\tLast\\: %7.2lf ms\" \\
+ GPRINT:loss:LAST:\"\tLast\: %4.1lf %%\\n\" \\
AREA:loss10#$colorqualityloss:\"Packet loss\\n\" \\
LINE1:delay#$colorqualityrtt[5]:\"Delay average\\n\" \\
+ LINE1:stddev#$colorqualitystddev:\"Stddev average\\n\" \\
COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\"";
} elseif ((strstr($curdatabase, "spamd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* graph a spamd statistics graph */
OpenPOWER on IntegriCloud