summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2008-12-17 08:05:34 +0000
committerSeth Mos <seth.mos@xs4all.nl>2008-12-17 08:05:34 +0000
commit2089adae758eb7cde04798977480a15580dbf20f (patch)
tree905bd35fc17b307f6ed89bedb03c4e42c59c9a25 /etc
parent74b5a9ed8616c19f728c2b677c4e95680ce6ded6 (diff)
downloadpfsense-2089adae758eb7cde04798977480a15580dbf20f.zip
pfsense-2089adae758eb7cde04798977480a15580dbf20f.tar.gz
untested rrd upgrade code
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/config.inc48
1 files changed, 44 insertions, 4 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index dbcb8c1..c304b16 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -2063,10 +2063,50 @@ endif;
/* Convert 5.4 -> 5.5 */
if ($config['version'] <= 5.4) {
- /* RRD files changed for quality, traffic and packets graphs */
- mwexec("/bin/rm -f /var/db/rrd/*-quality.rrd");
- mwexec("/bin/rm -f /var/db/rrd/*-packets.rrd");
- mwexec("/bin/rm -f /var/db/rrd/*-traffic.rrd");
+ /* RRD files changed for quality, traffic and packets graphs */
+ $rrddbpath = "/var/db/rrd/";
+ $rrdtool = "/usr/local/bin/rrdtool";
+
+ /* build a list of quality databases */
+ /* roundtrip has become delay */
+ /* the roundtrip times need to be divided by 1000 to get seconds, really */
+ exec("cd $rrddbpath;/usr/bin/find -name *-quality.rrd", $databases);
+ rsort($databases);
+ foreach($databases as $database) {
+ mwexec("$rrdtool tune {$database} -r roundtrip:delay");
+ }
+
+ /* build a list of traffic databases */
+ exec("cd $rrddbpath;/usr/bin/find -name *-traffic.rrd", $databases);
+ rsort($databases);
+ foreach($databases as $database) {
+ /* rename DS source */
+ mwexec("$rrdtool tune {$database} -r in:inpass");
+ mwexec("$rrdtool tune {$database} -r out:outpass");
+ /* dump contents to xml and move database out of the way */
+ mwexec("$rrdtool dump {$database} > {$g['tmp_path']}/{$database}.xml");
+ mwexec("mv $database {$g['tmp_path']}/$databases.backup");
+ /* let enable_rrd_graphing recreate the database and restore the contents
+ enable_rrd_graphing();
+ mwexec("$rrdtool restore {$g['tmp_path']}/{$database}.xml $database");
+ }
+
+ /* build a list of packets databases */
+ exec("cd $rrddbpath;/usr/bin/find -name *-packets.rrd", $databases);
+ rsort($databases);
+ foreach($databases as $database) {
+ /* rename DS source */
+ mwexec("$rrdtool tune {$database} -r in:inpass");
+ mwexec("$rrdtool tune {$database} -r out:outpass");
+ /* dump contents to xml and move database out of the way */
+ mwexec("$rrdtool dump {$database} > {$g['tmp_path']}/{$database}.xml");
+ mwexec("mv $database {$g['tmp_path']}/$databases.backup");
+ /* let enable_rrd_graphing recreate the database and restore the contents
+ enable_rrd_graphing();
+ mwexec("$rrdtool restore {$g['tmp_path']}/{$database}.xml $database");
+ }
+
+
}
$now = date("H:i:s");
OpenPOWER on IntegriCloud