diff options
author | Renato Botelho <renato@netgate.com> | 2016-02-22 08:49:33 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-02-22 08:49:33 -0300 |
commit | 2fbac0b2d640eced65d65593e60f473726573349 (patch) | |
tree | 3b2cae7df56bb49f9fd80cb56e3d94b17443b7c5 /src/etc/inc | |
parent | 89c8934f0218387feb4e2c6ae26ef6d320cce4be (diff) | |
parent | e3f1065671b395b96ff92cc25185ac7a29d1b241 (diff) | |
download | pfsense-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/etc/inc')
-rw-r--r-- | src/etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | src/etc/inc/rrd.inc | 12 | ||||
-rw-r--r-- | src/etc/inc/upgrade_config.inc | 70 |
3 files changed, 81 insertions, 3 deletions
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"); +} + ?> |