summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2009-03-13 21:12:21 +0100
committerSeth Mos <seth.mos@xs4all.nl>2009-03-13 21:13:58 +0100
commitdb7b006f39a507f2e4ceca17557b1db637f4611f (patch)
tree2440d70650ecb0ec66c525728945d1ffc450104c /usr
parent71c47cb67168985a1d0bda4d3f6f1c5a2ffbe5b8 (diff)
downloadpfsense-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')
-rwxr-xr-xusr/local/www/system_gateway_groups.php1
-rwxr-xr-xusr/local/www/system_gateway_groups_edit.php23
-rwxr-xr-xusr/local/www/system_gateways.php1
-rwxr-xr-xusr/local/www/system_gateways_settings.php156
-rwxr-xr-xusr/local/www/system_routes.php1
5 files changed, 175 insertions, 7 deletions
diff --git a/usr/local/www/system_gateway_groups.php b/usr/local/www/system_gateway_groups.php
index 7607aad..e236f28 100755
--- a/usr/local/www/system_gateway_groups.php
+++ b/usr/local/www/system_gateway_groups.php
@@ -101,6 +101,7 @@ effect.");?><br>
$tab_array[0] = array("Gateways", false, "system_gateways.php");
$tab_array[1] = array("Routes", false, "system_routes.php");
$tab_array[2] = array("Groups", true, "system_gateway_groups.php");
+ $tab_array[3] = array("Settings", false, "system_gateways_settings.php");
display_top_tabs($tab_array);
?>
</td></tr>
diff --git a/usr/local/www/system_gateway_groups_edit.php b/usr/local/www/system_gateway_groups_edit.php
index cad6867..1bbdeaa 100755
--- a/usr/local/www/system_gateway_groups_edit.php
+++ b/usr/local/www/system_gateway_groups_edit.php
@@ -45,6 +45,11 @@ if (!is_array($config['gateways']['gateway_group']))
$a_gateway_groups = &$config['gateways']['gateway_group'];
$a_gateways = return_gateways_array();
+$categories = array('down' => 'Member Down',
+ 'downloss' => 'Packet Loss',
+ 'downlatency' => 'High Latency',
+ 'downlosslatency' => 'Packet Loss or High Latency');
+
$id = $_GET['id'];
if (isset($_POST['id']))
$id = $_POST['id'];
@@ -57,6 +62,7 @@ if (isset($id) && $a_gateway_groups[$id]) {
$pconfig['name'] = $a_gateway_groups[$id]['name'];
$pconfig['item'] = &$a_gateway_groups[$id]['item'];
$pconfig['descr'] = $a_gateway_groups[$id]['descr'];
+ $pconfig['trigger'] = $a_gateway_groups[$id]['trigger'];
}
if (isset($_GET['dup']))
@@ -169,9 +175,9 @@ include("head.inc");
echo "<option value='0' $selected[0] >Never</option>";
echo "<option value='1' $selected[1] >Tier 1</option>";
echo "<option value='2' $selected[2] >Tier 2</option>";
- echo "<option value='3' $selected[3]>Tier 3</option>";
- echo "<option value='4' $selected[4]>Tier 4</option>";
- echo "<option value='5' $selected[5]>Tier 5</option>";
+ echo "<option value='3' $selected[3] >Tier 3</option>";
+ echo "<option value='4' $selected[4] >Tier 4</option>";
+ echo "<option value='5' $selected[5] >Tier 5</option>";
echo "</select> <strong>{$gateway['descr']}</strong><br/>";
}
?>
@@ -189,10 +195,13 @@ include("head.inc");
<td width="22%" valign="top" class="vncellreq">Trigger Level</td>
<td width="78%" class="vtable">
<select name='trigger' class='formfldselect' id='trigger'>
- <option value='down'>Member Down</option>
- <option value='downlatencyorloss'>Packet Loss or High Latency</option>
- <option value='downlatency'>High Latency</option>
- <option value='downloss'>Packet Loss</option>
+ <?php
+ foreach ($categories as $category => $categoryd) {
+ echo "<option value=\"$category\"";
+ if ($category == $pconfig['trigger']) echo " selected";
+ echo ">" . htmlspecialchars($categoryd) . "</option>\n";
+ }
+ ?>
</select>
<br> <span class="vexpl">When to trigger exclusion of a member</span></td>
</tr>
diff --git a/usr/local/www/system_gateways.php b/usr/local/www/system_gateways.php
index 7255c5d..a2aace9 100755
--- a/usr/local/www/system_gateways.php
+++ b/usr/local/www/system_gateways.php
@@ -110,6 +110,7 @@ effect.");?><br>
$tab_array[0] = array("Gateways", true, "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", false, "system_gateways_settings.php");
display_top_tabs($tab_array);
?>
</td></tr>
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">&nbsp;</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>
diff --git a/usr/local/www/system_routes.php b/usr/local/www/system_routes.php
index 12e837b..ecbb552 100755
--- a/usr/local/www/system_routes.php
+++ b/usr/local/www/system_routes.php
@@ -132,6 +132,7 @@ include("head.inc");
$tab_array[0] = array("Gateways", false, "system_gateways.php");
$tab_array[1] = array("Routes", true, "system_routes.php");
$tab_array[2] = array("Groups", false, "system_gateway_groups.php");
+ $tab_array[3] = array("Settings", false, "system_gateways_settings.php");
display_top_tabs($tab_array);
?>
</td></tr>
OpenPOWER on IntegriCloud