From 8cae7be74890bcc2d1e3d797ae7a8e8c20591d22 Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sun, 7 Apr 2013 00:54:56 +0200 Subject: haproxy-devel, add options for checking server health -fix adding a new server -show advanced options icon in serverpool overview --- config/haproxy-devel/haproxy_pool_edit.php | 132 +++++++++++++++++++++++------ 1 file changed, 107 insertions(+), 25 deletions(-) (limited to 'config/haproxy-devel/haproxy_pool_edit.php') diff --git a/config/haproxy-devel/haproxy_pool_edit.php b/config/haproxy-devel/haproxy_pool_edit.php index 3ed0b799..c3707903 100644 --- a/config/haproxy-devel/haproxy_pool_edit.php +++ b/config/haproxy-devel/haproxy_pool_edit.php @@ -30,6 +30,7 @@ */ require("guiconfig.inc"); +require_once("haproxy.inc"); $d_haproxyconfdirty_path = $g['varrun_path'] . "/haproxy.conf.dirty"; @@ -48,13 +49,13 @@ if (isset($_GET['dup'])) $id = $_GET['dup']; global $simplefields; -$simplefields = array("retries","balance","connection_timeout","server_timeout", "stats_enabled","stats_username","stats_password","stats_uri","stats_realm","stats_admin","stats_node_enabled","stats_node","stats_desc","stats_refresh"); +$simplefields = array( +"name","cookie","balance", +"check_type","checkinter","httpcheck_method","monitor_uri","monitor_httpversion","monitor_username","monitor_domain", +"connection_timeout","server_timeout","retries", +"stats_enabled","stats_username","stats_password","stats_uri","stats_realm","stats_admin","stats_node_enabled","stats_node","stats_desc","stats_refresh"); if (isset($id) && $a_pools[$id]) { - $pconfig['name'] = $a_pools[$id]['name']; - $pconfig['checkinter'] = $a_pools[$id]['checkinter']; - $pconfig['monitor_uri'] = $a_pools[$id]['monitor_uri']; - $pconfig['cookie'] = $a_pools[$id]['cookie']; $pconfig['advanced'] = base64_decode($a_pools[$id]['advanced']); $pconfig['advanced_backend'] = base64_decode($a_pools[$id]['advanced_backend']); $pconfig['a_servers']=&$a_pools[$id]['ha_servers']['item']; @@ -87,7 +88,10 @@ if ($_POST) { if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['name'])) $input_errors[] = "The field 'Name' contains invalid characters."; - + + if ($_POST['checkinter'] !== "" && !is_numeric($_POST['checkinter'])) + $input_errors[] = "The field 'Check frequency' value is not a number."; + if ($_POST['connection_timeout'] !== "" && !is_numeric($_POST['connection_timeout'])) $input_errors[] = "The field 'Connection timeout' value is not a number."; @@ -216,13 +220,21 @@ include("head.inc"); row_helper(); +// 'processing' done, make all simple fields usable in html. +foreach($simplefields as $field){ + $pconfig[$field] = htmlspecialchars($pconfig[$field]); +} ?> - + @@ -456,20 +481,6 @@ row_helper(); - - Check freq - - size="20"> milliseconds -
For HTTP/HTTPS defaults to 1000 if left blank. For TCP no check will be performed if left empty. - - - - Health check URI - - size="64"> -
Defaults to / if left blank. - - Per server pass thru @@ -488,7 +499,74 @@ row_helper(); - + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Health checking
Health check method +
+ +
Check frequency + size="20"> milliseconds +
For HTTP/HTTPS defaults to 1000 if left blank. For TCP no check will be performed if left empty. +
Http check method + +
OPTIONS is the method usually best to perform server checks, HEAD and GET can also be used +
Http check URI + size="64"> +
Defaults to / if left blank. +
Http check version + size="64"> +
Defaults to "HTTP/1.0" if left blank. + Note that the Host field is mandatory in HTTP/1.1, and as a trick, it is possible to pass it + after "\r\n" following the version string like this:
+     "HTTP/1.1\r\nHost:\ www"
+ Also some hosts might require an accept parameter like this:
+     "HTTP/1.0\r\nHost:\ webservername:8080\r\nAccept:\ */*" +
Check with Username + size="64" onchange="updatevisibility();" onkeyup="updatevisibility();"> +
+ This is the username which will be used when connecting to MySQL/PostgreSQL server. +
+USE mysql;
+CREATE USER ''@'<pfSenseIP>';
+FLUSH PRIVILEGES;
+
Domain + size="64"> +

@@ -548,7 +626,7 @@ set by the 'retries' parameter. @@ -557,7 +635,7 @@ set by the 'retries' parameter. @@ -615,6 +693,10 @@ set by the 'retries' parameter.
Stats Username - size="64"> + size="64">
size="64">