Commit 59b865ca authored by Franco Fichtner's avatar Franco Fichtner

system/settings: moves rrd settings to logs/reports; closes #422

parent cd8cafcb
......@@ -58,15 +58,14 @@
</VPN>
</LogFiles>
<Settings cssClass="fa fa-cogs">
<General url="/system_general.php"/>
<AdminAccess VisibleName="Admin Access" url="/system_advanced_admin.php"/>
<FirewallNAT VisibleName="Firewall/NAT" url="/system_advanced_firewall.php"/>
<Networking url="/system_advanced_network.php"/>
<Miscellaneous url="/system_advanced_misc.php"/>
<Tunables VisibleName="Tunables" url="/system_advanced_sysctl.php"/>
<Notifications url="/system_advanced_notifications.php"/>
<RRDGraphs VisibleName="RRD Graphs" url="/status_rrd_graph_settings.php"/>
<LogFiles VisibleName="Log Files" url="/diag_logs_settings.php"/>
<General order="100" url="/system_general.php"/>
<AdminAccess VisibleName="Admin Access" order="200" url="/system_advanced_admin.php"/>
<Networking order="300" url="/system_advanced_network.php"/>
<FirewallNAT VisibleName="Firewall/NAT" order="400" url="/system_advanced_firewall.php"/>
<Notifications order="500" url="/system_advanced_notifications.php"/>
<LogFiles VisibleName="Logs/Reports" order="600" url="/diag_logs_settings.php"/>
<Miscellaneous order="700" url="/system_advanced_misc.php"/>
<Tunables VisibleName="Tunables" order="800" url="/system_advanced_sysctl.php"/>
</Settings>
<Wizard url="/wizard.php" cssClass="fa fa-magic">
<Step url="/wizard.php*"/>
......
......@@ -1020,13 +1020,6 @@
"status_openvpn.php*"
]
},
"page-status-rrdgraph-settings": {
"name": "WebCfg - Status: RRD Graphs settings page",
"descr": "Allow access to the 'Status: RRD Graphs: settings' page.",
"match": [
"status_rrd_graph_settings.php*"
]
},
"page-status-services": {
"name": "WebCfg - Status: Services page",
"descr": "Allow access to the 'Status: Services' page.",
......
<?php
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2007 Seth Mos <seth.mos@dds.nl>
Copyright (C) 2004-2009 Scott Ullrich
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
......@@ -30,11 +31,14 @@
require_once("guiconfig.inc");
require_once("interfaces.inc");
require_once("rrd.inc");
require_once("filter.inc");
require_once("system.inc");
require_once("pfsense-utils.inc");
require_once("services.inc");
$pconfig['rrdenable'] = isset($config['rrd']['enable']);
function clear_all_log_files()
{
killbyname('syslogd');
......@@ -114,9 +118,14 @@ function is_valid_syslog_server($target) {
|| is_hostnamewithport($target));
}
if ($_POST['resetlogs'] == gettext("Reset Log Files")) {
if ($_POST['resetlogs'] == 'Reset Log Files') {
clear_all_log_files();
$savemsg .= gettext("The log files have been reset.");
$savemsg = gettext("The log files have been reset.");
} elseif ($_POST['ResetRRD']) {
$savemsg = gettext('RRD data has been cleared.');
mwexec('/bin/rm /var/db/rrd/*');
enable_rrd_graphing();
setup_gateways_monitor();
} elseif ($_POST) {
unset($input_errors);
......@@ -188,6 +197,8 @@ if ($_POST['resetlogs'] == gettext("Reset Log Files")) {
unset($config['syslog']['remoteserver3']);
}
$config['rrd']['enable'] = $_POST['rrdenable'] ? true : false;
write_config();
$retval = 0;
......@@ -209,6 +220,8 @@ if ($_POST['resetlogs'] == gettext("Reset Log Files")) {
}
filter_pflog_start();
enable_rrd_graphing();
setup_gateways_monitor();
}
}
......@@ -294,17 +307,43 @@ function check_everything() {
<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<section class="col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="diag_logs_settings.php" method="post" name="iform" id="iform">
<form action="diag_logs_settings.php" method="post" name="iform" id="iform">
<div class="tab-content content-box col-xs-12 __mb">
<div class="table-responsive">
<table class="table table-striped">
<tr>
<td colspan="2" valign="top" class="listtopic"><strong><?=gettext('Reporting Database Options');?></strong></td>
</tr>
<tr>
<td width="22%" valign="top" class="vtable"><?=gettext("Round-Robin-Database");?></td>
<td width="78%" class="vtable">
<label>
<input name="rrdenable" type="checkbox" id="rrdenable" value="yes" <?php if ($pconfig['rrdenable']) echo "checked=\"checked\"" ?> onclick="enable_change(false)" />
&nbsp;<?=gettext("Enables the RRD graphing backend.");?>
</label>
</td>
</tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
<input name="ResetRRD" type="submit" class="btn btn-default" value="<?=gettext("Reset RRD Data");?>" onclick="return confirm('<?=gettext('Do you really want to reset the RRD graphs? This will erase all graph data.');?>')" />
</td>
</tr>
</table>
</div>
<div class="container-fluid">
<p><strong><span class="text-danger"><?=gettext("Note:");?></span></strong><br />
<?=gettext("Graphs will not be allowed to be recreated within a 1 minute interval, please " .
"take this into account after changing the style.");?>
</p>
</div>
</div>
<div class="tab-content content-box col-xs-12 __mb">
<div class="table-responsive">
<table class="table table-striped">
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("General Logging Options");?></td>
<td colspan="2" valign="top" class="listtopic"><strong><?=gettext("Local Logging Options");?></strong></td>
</tr>
<tr>
<td width="22%" valign="top" class="vtable"><?=gettext('Forward/Reverse Display') ?></td>
......@@ -374,16 +413,20 @@ function check_everything() {
<tr>
<td width="22%" valign="top"><?=gettext('Reset Logs') ?></td>
<td width="78%">
<input name="resetlogs" type="submit" class="btn btn-primary" value="<?=gettext("Reset Log Files"); ?>" onclick="return confirm('<?=gettext('Do you really want to reset the log files? This will erase all local log data.');?>')" />
<br /><br />
<input name="resetlogs" type="submit" class="btn btn-default" value="<?=gettext("Reset Log Files"); ?>" onclick="return confirm('<?=gettext('Do you really want to reset the log files? This will erase all local log data.');?>')" />
<br/><br/>
<?= gettext("Note: Clears all local log files and reinitializes them as empty logs. This also restarts the DHCP daemon. Use the Save button first if you have made any setting changes."); ?>
</td>
</tr>
</table>
</div>
</div>
<div class="tab-content content-box col-xs-12 __mb">
<div class="table-responsive">
<table class="table table-striped">
<tr>
<td colspan="2" valign="top">&nbsp;</td>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Remote Logging Options");?></td>
<td colspan="2" valign="top" class="listtopic"><strong><?=gettext("Remote Logging Options");?></strong></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Source Address"); ?></td>
......@@ -485,8 +528,8 @@ function check_everything() {
</tr>
</table>
</div>
</form>
</div>
</div>
</form>
</section>
</div>
</div>
......
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2007 Seth Mos <seth.mos@dds.nl>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require_once("guiconfig.inc");
require_once("rrd.inc");
require_once("interfaces.inc");
$pconfig['enable'] = isset($config['rrd']['enable']);
if ($_POST) {
$pconfig = $_POST;
if (isset($pconfig['ResetRRD'])) {
$savemsg = gettext('RRD data has been cleared.');
mwexec('/bin/rm /var/db/rrd/*');
} else {
$config['rrd']['enable'] = $_POST['enable'] ? true : false;
$savemsg = get_std_save_message();
write_config();
}
enable_rrd_graphing();
setup_gateways_monitor();
}
$pgtitle = array(gettext('System'), gettext('Settings'), gettext('RRD Graphs'));
include("head.inc");
?>
<body>
<?php include("fbegin.inc"); ?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<section class="col-xs-12">
<div class="tab-content content-box col-xs-12">
<form action="status_rrd_graph_settings.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped __nomb">
<tr>
<td width="22%" valign="top" class="vtable"><?=gettext("RRD Graphs");?></td>
<td width="78%" class="vtable">
<label>
<input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\"" ?> onclick="enable_change(false)" />
&nbsp;<?=gettext("Enables the RRD graphing backend.");?>
</label>
</td>
</tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
<input name="ResetRRD" type="submit" class="btn btn-default" value="<?=gettext("Reset RRD Data");?>" onclick="return confirm('<?=gettext('Do you really want to reset the RRD graphs? This will erase all graph data.');?>')" />
</td>
</tr>
</table>
</div>
<div class="container-fluid">
<p><strong><span class="text-danger"><?=gettext("Note:");?></span></strong><br />
<?=gettext("Graphs will not be allowed to be recreated within a 1 minute interval, please " .
"take this into account after changing the style.");?>
</p>
</div>
</div>
</section>
</div>
</div>
</section>
<?php include("foot.inc"); ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment