status_rrd_graph_settings.php 3.68 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1
<?php
2

Ad Schellevis's avatar
Ad Schellevis committed
3
/*
4
	Copyright (C) 2014-2015 Deciso B.V.
Ad Schellevis's avatar
Ad Schellevis committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
	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.
*/

30
require_once("guiconfig.inc");
Ad Schellevis's avatar
Ad Schellevis committed
31
require_once("rrd.inc");
32
require_once("interfaces.inc");
Ad Schellevis's avatar
Ad Schellevis committed
33 34 35

$pconfig['enable'] = isset($config['rrd']['enable']);

36
if ($_POST) {
Ad Schellevis's avatar
Ad Schellevis committed
37 38
	$pconfig = $_POST;

39 40 41 42 43 44 45
	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();
Ad Schellevis's avatar
Ad Schellevis committed
46
	}
47 48 49

	enable_rrd_graphing();
	setup_gateways_monitor();
Ad Schellevis's avatar
Ad Schellevis committed
50 51
}

52
$pgtitle = array(gettext('System'), gettext('Settings'), gettext('RRD Graphs'));
Ad Schellevis's avatar
Ad Schellevis committed
53 54 55
include("head.inc");

?>
56 57 58

<body>

Ad Schellevis's avatar
Ad Schellevis committed
59
<?php include("fbegin.inc"); ?>
60 61

	<section class="page-content-main">
62
		<div class="container-fluid">
63
			<div class="row">
64

65
				<?php if (isset($savemsg)) print_info_box($savemsg); ?>
66

67
			    <section class="col-xs-12">
68 69 70

					<div class="tab-content content-box col-xs-12">

71 72

							<form action="status_rrd_graph_settings.php" method="post" name="iform" id="iform">
73 74


75 76

							<div class="table-responsive">
77
								<table class="table table-striped __nomb">
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
									<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>
96
							 <div class="container-fluid">
97 98 99
							 <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.");?>
100

101 102 103
							 </p>
						</div>
				    </div>
104
			</section>
105
			</div>
Ad Schellevis's avatar
Ad Schellevis committed
106
		</div>
107
	</section>
108 109

<?php include("foot.inc"); ?>