summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/rrd.inc
diff options
context:
space:
mode:
authorNOYB <Al_Stu@Frontier.com>2016-04-23 00:03:34 -0700
committerNOYB <Al_Stu@Frontier.com>2017-01-08 19:14:16 -0800
commit257d2fd6750185a52b703cffd9419737f83777ee (patch)
treea8bace8b55ed2b422243cc499726b88d8d33b2b3 /src/etc/inc/rrd.inc
parent286ed246df8bc25df436fd6a5cbc66e38fe5a06a (diff)
downloadpfsense-257d2fd6750185a52b703cffd9419737f83777ee.zip
pfsense-257d2fd6750185a52b703cffd9419737f83777ee.tar.gz
RAM Disk Management
1) Treat the RAM disk more like a permanent storage device with content managed/restored by the system and made available at boot up, before needed by any services. a) Handle saving and restoring RAM disk content at reboot/shutdown/boot centrally in more of a system manged fashion. b) If it's in the RAM disk store it gets restored early in the pfSense startup so it's available for whatever needs to use it. c) Services utilizing RAM disk don't need to be aware that their content is on a RAM disk, and handling content restore individually. 2) Has the benefit of eliminating some issues with the previous code as well. Such as... a) Restoring RRD multiple times during boot, potentially at least 3 times, by rc.newwanip, rc.newwanipv6, and rc.boot. Some even overlapping. b) Not removing the backups if/when not being utilized. Such as on a full install with the RAM disk option not enabled. c) Eliminate some duplicate code. 3) Looking forward. a) The more centrally system managed approach may crack the door open to making it easier to include some of the logs in the RAM disk store. As well as anything else that may be useful/desirable to retain in the RAM disk across reboots.
Diffstat (limited to 'src/etc/inc/rrd.inc')
-rw-r--r--src/etc/inc/rrd.inc60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/etc/inc/rrd.inc b/src/etc/inc/rrd.inc
index 183f84a..cf3a1a9 100644
--- a/src/etc/inc/rrd.inc
+++ b/src/etc/inc/rrd.inc
@@ -34,54 +34,6 @@ function dump_rrd_to_xml($rrddatabase, $xmldumpfile) {
return($dumpret);
}
-function restore_rrd() {
- global $g, $config;
-
- $rrddbpath = "{$g['vardb_path']}/rrd/";
- $rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
-
- $rrdrestore = "";
- $rrdreturn = "";
- if (file_exists("{$g['cf_conf_path']}/rrd.tgz") && isset($config['system']['use_mfs_tmpvar'])) {
- foreach (glob("{$rrddbpath}/*.xml") as $xml_file) {
- @unlink($xml_file);
- }
- unset($rrdrestore);
- $_gb = exec("cd /;LANG=C /usr/bin/tar -tf {$g['cf_conf_path']}/rrd.tgz", $rrdrestore, $rrdreturn);
- if ($rrdreturn != 0) {
- log_error(sprintf(gettext('RRD restore failed exited with %1$s, the error is: %2$s'), $rrdreturn, $rrdrestore));
- return;
- }
- foreach ($rrdrestore as $xml_file) {
- $rrd_file = '/' . substr($xml_file, 0, -4) . '.rrd';
- if (file_exists("{$rrd_file}")) {
- @unlink($rrd_file);
- }
- file_put_contents("{$g['tmp_path']}/rrd_restore", $xml_file);
- $_gb = exec("cd /;LANG=C /usr/bin/tar -xf {$g['cf_conf_path']}/rrd.tgz -T {$g['tmp_path']}/rrd_restore");
- if (!file_exists("/{$xml_file}")) {
- log_error(sprintf(gettext("Could not extract %s RRD xml file from archive!"), $xml_file));
- continue;
- }
- $_gb = exec("$rrdtool restore -f '/{$xml_file}' '{$rrd_file}'", $output, $status);
- if ($status) {
- log_error(sprintf(gettext("rrdtool restore -f '%1\$s' '%2\$s' failed returning %3\$s."), $xml_file, $rrd_file, $status));
- continue;
- }
- unset($output);
- @unlink("/{$xml_file}");
- }
- unset($rrdrestore);
- @unlink("{$g['tmp_path']}/rrd_restore");
- /* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */
- if (!isset($config['system']['use_mfs_tmpvar'])) {
- unlink_if_exists("{$g['cf_conf_path']}/rrd.tgz");
- }
- return true;
- }
- return false;
-}
-
function create_new_rrd($rrdcreatecmd) {
$rrdcreateoutput = array();
$rrdcreatereturn = 0;
@@ -281,10 +233,6 @@ function enable_rrd_graphing() {
}
chown($rrddbpath, "nobody");
- if (platform_booting()) {
- restore_rrd();
- }
-
/* db update script */
$rrdupdatesh = "#!/bin/sh\n";
$rrdupdatesh .= "\n";
@@ -309,14 +257,6 @@ function enable_rrd_graphing() {
}
}
- if (platform_booting()) {
- if (!is_dir($rrddbpath)) {
- mkdir($rrddbpath, 0775);
- }
-
- @chown($rrddbpath, "nobody");
- }
-
/* process all real and pseudo interfaces */
foreach ($ifdescrs as $ifname => $ifdescr) {
$temp = get_real_interface($ifname);
OpenPOWER on IntegriCloud