From db7b006f39a507f2e4ceca17557b1db637f4611f Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 13 Mar 2009 21:12:21 +0100 Subject: * 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 --- usr/local/www/system_gateway_groups.php | 1 + usr/local/www/system_gateway_groups_edit.php | 23 ++-- usr/local/www/system_gateways.php | 1 + usr/local/www/system_gateways_settings.php | 156 +++++++++++++++++++++++++++ usr/local/www/system_routes.php | 1 + 5 files changed, 175 insertions(+), 7 deletions(-) create mode 100755 usr/local/www/system_gateways_settings.php (limited to 'usr') 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.");?>
$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); ?> 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 ""; echo ""; echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; echo " {$gateway['descr']}
"; } ?> @@ -189,10 +195,13 @@ include("head.inc"); Trigger Level
When to trigger exclusion of a member 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.");?>
$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); ?> 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 @@ + + 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"); + +?> + + + + +
+ + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + +
Latency boundaries + From + + To + +
These define the low and high water marks for latency in milliseconds.
Packet Loss boundaries + From + + To + +
These define the low and high water marks for packet loss in %.
  + +
+
+
+ +
+ + + 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); ?> -- cgit v1.1