diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2009-03-13 21:12:21 +0100 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2009-03-13 21:13:58 +0100 |
commit | db7b006f39a507f2e4ceca17557b1db637f4611f (patch) | |
tree | 2440d70650ecb0ec66c525728945d1ffc450104c /usr/local/www/system_gateways_settings.php | |
parent | 71c47cb67168985a1d0bda4d3f6f1c5a2ffbe5b8 (diff) | |
download | pfsense-db7b006f39a507f2e4ceca17557b1db637f4611f.zip pfsense-db7b006f39a507f2e4ceca17557b1db637f4611f.tar.gz |
* Make sure the trigger level on the gateway groups edit page loads it's settings from the config.
* Add the settings tab to the tabs
* Add a settings page that allows you to define the global trigger levels for all the gateways which are monitored
Diffstat (limited to 'usr/local/www/system_gateways_settings.php')
-rwxr-xr-x | usr/local/www/system_gateways_settings.php | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/usr/local/www/system_gateways_settings.php b/usr/local/www/system_gateways_settings.php new file mode 100755 index 0000000..35ef2fc --- /dev/null +++ b/usr/local/www/system_gateways_settings.php @@ -0,0 +1,156 @@ +<?php +/* $Id$ */ +/* + status_rrd_graph.php + Part of pfSense + Copyright (C) 2007 Seth Mos <seth.mos@xs4all.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. +*/ + +##|+PRIV +##|*IDENT=page-status-rrdgraphs +##|*NAME=Status: RRD Graphs page +##|*DESCR=Allow access to the 'Status: RRD Graphs' page. +##|*MATCH=status_rrd_graph_settings.php* +##|-PRIV + +include("guiconfig.inc"); + +if (!is_array($config['gateways']['settings'])) + $config['gateways']['settings'] = array(); + +$a_settings = &$config['gateways']['settings']; + +$changedesc = "Gateways: "; + +require("guiconfig.inc"); + +if (empty($a_settings)) { + $pconfig['latencylow'] = "100"; + $pconfig['latencyhigh'] = "500"; + $pconfig['losslow'] = "10"; + $pconfig['losshigh'] = "20"; +} else { + $pconfig['latencylow'] = $a_settings['latencylow']; + $pconfig['latencyhigh'] = $a_settings['latencyhigh']; + $pconfig['losslow'] = $a_settings['losslow']; + $pconfig['losshigh'] = $a_settings['losshigh']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + if(($_POST['latencylow']) && ($_POST['latencylow'] > $_POST['latencyhigh'])) { + $inputerrors = "The High latency watermark needs to be higher then the low latency watermark"; + } + if(($_POST['losslow']) && ($_POST['latencylow'] > $_POST['losshigh'])) { + $inputerrors = "The High packet loss watermark needs to be higher then the low packet loss watermark"; + } + + if (!$input_errors) { + $a_settings['latencylow'] = $_POST['latencylow']; + $a_settings['latencyhigh'] = $_POST['latencyhigh']; + $a_settings['losslow'] = $_POST['losslow']; + $a_settings['losshigh'] = $_POST['losshigh']; + + + $config['gateways']['settings'] = $a_settings; + + $retval = 0; + $retval = setup_gateways_monitor(); + write_config(); + + $savemsg = get_std_save_message($retval); + } +} + +$pgtitle = array("Status","RRD Graphs"); +include("head.inc"); + +?> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<form action="system_gateways_settings.php" method="post" name="iform" id="iform"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <?php + $tab_array = array(); + $tab_array[0] = array("Gateways", false, "system_gateways.php"); + $tab_array[1] = array("Routes", false, "system_routes.php"); + $tab_array[2] = array("Groups", false, "system_gateway_groups.php"); + $tab_array[3] = array("Settings", true, "system_gateways_settings.php"); + display_top_tabs($tab_array); + ?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6"> + <tr> + <td width="22%" valign="top" class="vncellreq">Latency boundaries</td> + <td width="78%" class="vtable"> + From + <input name="latencylow" type="text" class="formfld unknown" id="latencylow" size="2" + value="<?=htmlspecialchars($pconfig['latencylow']);?>"> + To + <input name="latencyhigh" type="text" class="formfld unknown" id="latencyhigh" size="2" + value="<?=htmlspecialchars($pconfig['latencyhigh']);?>"> + <br> <span class="vexpl">These define the low and high water marks for latency in milliseconds.</span></td> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq">Packet Loss boundaries</td> + <td width="78%" class="vtable"> + From + <input name="losslow" type="text" class="formfld unknown" id="losslow" size="2" + value="<?=htmlspecialchars($pconfig['losslow']);?>"> + To + <input name="losshigh" type="text" class="formfld unknown" id="losshigh" size="2" + value="<?=htmlspecialchars($pconfig['losshigh']);?>"> + <br> <span class="vexpl">These define the low and high water marks for packet loss in %.</span></td> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)"> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> + +</form> +<?php include("fend.inc"); ?> +</body> +</html> |