summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2008-12-23 10:09:27 +0000
committerSeth Mos <seth.mos@xs4all.nl>2008-12-23 10:09:27 +0000
commit57dae4f88fc7f57b0d1b48619930ff65dbb0487c (patch)
treef07e16e5cc95b4fd9bc20c6104f1485f9840035c /etc
parent69b27c16e5abf4d3bb1fa478bc615162e2e7ea3f (diff)
downloadpfsense-57dae4f88fc7f57b0d1b48619930ff65dbb0487c.zip
pfsense-57dae4f88fc7f57b0d1b48619930ff65dbb0487c.tar.gz
Also convert quality databases. The delay value needs to be divided by 1000.
This because apinger logs in seconds, not in milliseconds.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/config.inc25
1 files changed, 25 insertions, 0 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index d5fc670..6f9a990 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -2081,6 +2081,12 @@ endif;
/* build a list of quality databases */
/* roundtrip has become delay */
+ function divide_delay($delayval) {
+ $delayval = floatval($delayval);
+ $delayval = ($delayval / 1000);
+ $delayval = " ". sprintf("%1.10e", $delayval) ." ";
+ return $delayval;
+ }
/* the roundtrip times need to be divided by 1000 to get seconds, really */
$databases = array();
exec("cd $rrddbpath;/usr/bin/find *-quality.rrd", $databases);
@@ -2089,6 +2095,25 @@ endif;
log_error("Migrate RRD database {$rrddbpath}/{$database} to new format");
echo "Migrate RRD database {$rrddbpath}/{$database} to new format \n";
mwexec("$rrdtool tune {$rrddbpath}{$database} -r roundtrip:delay 2>&1");
+
+ dump_rrd_to_xml("{$rrddbpath}/{$database}", "{$g['tmp_path']}/{$xmldump}");
+ $rrdold = parse_xml_config_raw("{$g['tmp_path']}/{$xmldump}", "rrd");
+
+ $i = 0;
+ foreach($rrdold['rra'] as $rra) {
+ $l = 0;
+ foreach($rra['database']['row'] as $row) {
+ $vnew = divide_delay($row['v'][1]);
+ $rrdold['rra'][$i]['database']['row'][$l]['v'][1] = $vnew;
+ $l++;
+ }
+ $i++;
+ }
+
+ $rrdxml = dump_xml_config_raw($rrdold, "rrd");
+ file_put_contents("{$g['tmp_path']}/{$xmldumpnew}", $rrdxml);
+ mwexec("$rrdtool restore -f {$g['tmp_path']}/{$xmldumpnew} {$rrddbpath}/{$database} 2>&1");
+
}
/* let apinger recreate required files */
setup_gateways_monitor();
OpenPOWER on IntegriCloud