aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy-devel/haproxy_pool_edit.php
diff options
context:
space:
mode:
Diffstat (limited to 'config/haproxy-devel/haproxy_pool_edit.php')
-rw-r--r--config/haproxy-devel/haproxy_pool_edit.php500
1 files changed, 152 insertions, 348 deletions
diff --git a/config/haproxy-devel/haproxy_pool_edit.php b/config/haproxy-devel/haproxy_pool_edit.php
index b6673a0a..93fa20dc 100644
--- a/config/haproxy-devel/haproxy_pool_edit.php
+++ b/config/haproxy-devel/haproxy_pool_edit.php
@@ -3,6 +3,7 @@
/*
haproxy_pool_edit.php
part of pfSense (http://www.pfsense.com/)
+ Copyright (C) 2013 PiBa-NL
Copyright (C) 2009 Scott Ullrich <sullrich@pfsense.com>
Copyright (C) 2008 Remco Hoef <remcoverhoef@pfsense.com>
All rights reserved.
@@ -32,6 +33,7 @@ $shortcut_section = "haproxy";
require("guiconfig.inc");
require_once("haproxy.inc");
require_once("haproxy_utils.inc");
+require_once("haproxy_htmllist.inc");
$d_haproxyconfdirty_path = $g['varrun_path'] . "/haproxy.conf.dirty";
@@ -53,9 +55,48 @@ global $simplefields;
$simplefields = array(
"name","cookie","balance","transparent_clientip","transparent_interface",
"check_type","checkinter","httpcheck_method","monitor_uri","monitor_httpversion","monitor_username","monitor_domain","monitor_agentport",
+"agent_check","agent_port","agent_inter",
"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");
+$fields_servers=array();
+$fields_servers[0]['name']="name";
+$fields_servers[0]['columnheader']="Name";
+$fields_servers[0]['colwidth']="20%";
+$fields_servers[0]['type']="textbox";
+$fields_servers[0]['size']="30";
+$fields_servers[1]['name']="address";
+$fields_servers[1]['columnheader']="Address";
+$fields_servers[1]['colwidth']="10%";
+$fields_servers[1]['type']="textbox";
+$fields_servers[1]['size']="20";
+$fields_servers[2]['name']="port";
+$fields_servers[2]['columnheader']="Port";
+$fields_servers[2]['colwidth']="5%";
+$fields_servers[2]['type']="textbox";
+$fields_servers[2]['size']="5";
+$fields_servers[3]['name']="ssl";
+$fields_servers[3]['columnheader']="SSL";
+$fields_servers[3]['colwidth']="5%";
+$fields_servers[3]['type']="checkbox";
+$fields_servers[3]['size']="30";
+$fields_servers[4]['name']="weight";
+$fields_servers[4]['columnheader']="Weight";
+$fields_servers[4]['colwidth']="8%";
+$fields_servers[4]['type']="textbox";
+$fields_servers[4]['size']="5";
+$fields_servers[5]['name']="status";
+$fields_servers[5]['columnheader']="Mode";
+$fields_servers[5]['colwidth']="5%";
+$fields_servers[5]['type']="select";
+$fields_servers[5]['size']="5";
+$fields_servers[5]['items']=&$a_servermodes;
+$fields_servers[6]['name']="advanced";
+$fields_servers[6]['columnheader']="Advanced";
+$fields_servers[6]['colwidth']="15%";
+$fields_servers[6]['type']="textbox";
+$fields_servers[6]['size']="20";
+
if (isset($id) && $a_pools[$id]) {
$pconfig['advanced'] = base64_decode($a_pools[$id]['advanced']);
$pconfig['advanced_backend'] = base64_decode($a_pools[$id]['advanced_backend']);
@@ -115,45 +156,28 @@ if ($_POST) {
if (($_POST['name'] == $config['installedpackages']['haproxy']['ha_pools']['item'][$i]['name']) && ($i != $id))
$input_errors[] = "This pool name has already been used. Pool names must be unique.";
- $a_servers=array();
- for($x=0; $x<99; $x++) {
- $server_name = $_POST['server_name'.$x];
- $server_address = $_POST['server_address'.$x];
- $server_port = $_POST['server_port'.$x];
- $server_ssl = $_POST['server_ssl'.$x];
- $server_weight = $_POST['server_weight'.$x];
- $server_status = $_POST['server_status'.$x];
- $server_advanced = $_POST['server_advanced'.$x];
-
- if ($server_address) {
- $server = array();
- $server['name'] = $server_name;
- $server['address'] = $server_address;
- $server['port'] = $server_port;
- $server['ssl'] = $server_ssl;
- $server['weight'] = $server_weight;
- $server['status'] = $server_status;
- $server['advanced'] = $server_advanced;
- $a_servers[] = $server;
-
- if (preg_match("/[^a-zA-Z0-9\.\-_]/", $server_name))
- $input_errors[] = "The field 'Name' contains invalid characters.";
- if (!is_ipaddr($server_address))
- $input_errors[] = "The field 'Address' contains invalid characters.";
-
- if (!preg_match("/.{2,}/", $server_name))
- $input_errors[] = "The field 'Name' is required (and must be at least 2 characters).";
-
- if (!preg_match("/.{2,}/", $server_address))
- $input_errors[] = "The field 'Address' is required (and must be at least 2 characters).";
-
-
- if (!is_numeric($server_weight))
- $input_errors[] = "The field 'Weight' value is not a number.";
-
- if ($server_port && !is_numeric($server_port))
- $input_errors[] = "The field 'Port' value is not a number.";
- }
+ $a_servers = haproxy_htmllist_get_values($fields_servers);
+ foreach($a_servers as $server){
+ $server_name = $server['name'];
+ $server_address = $server['address'];
+ $server_port = $server['port'];
+ $server_weight = $server['weight'];
+ if (preg_match("/[^a-zA-Z0-9\.\-_]/", $server_name))
+ $input_errors[] = "The field 'Name' contains invalid characters.";
+ if (!is_ipaddr($server_address))
+ $input_errors[] = "The field 'Address' is not a valid ip address.";
+
+ if (!preg_match("/.{2,}/", $server_name))
+ $input_errors[] = "The field 'Name' is required (and must be at least 2 characters).";
+
+ if (!preg_match("/.{2,}/", $server_address))
+ $input_errors[] = "The field 'Address' is required (and must be at least 2 characters).";
+
+ if (!is_numeric($server_weight))
+ $input_errors[] = "The field 'Weight' value is not a number.";
+
+ if ($server_port && !is_numeric($server_port))
+ $input_errors[] = "The field 'Port' value is not a number.";
}
if (!$input_errors) {
@@ -216,20 +240,16 @@ $pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
if(strstr($pfSversion, "1.2"))
$one_two = true;
+$closehead = false;
$pgtitle = "HAProxy: Backend server pool: Edit";
include("head.inc");
-row_helper();
-
// 'processing' done, make all simple fields usable in html.
foreach($simplefields as $field){
$pconfig[$field] = htmlspecialchars($pconfig[$field]);
}
-?>
-
-<input type='hidden' name='address_type' value='textbox' />
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+?>
<style type="text/css">
.haproxy_stats_visible{display:none;}
.haproxy_check_enabled{display:none;}
@@ -238,8 +258,15 @@ foreach($simplefields as $field){
.haproxy_check_smtp{display:none;}
.haproxy_transparent_clientip{display:none;}
.haproxy_check_agent{display:none;}
+ .haproxy_agent_check{display:none;}
</style>
-<script language="javascript">
+</head>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<script type="text/javascript">
+ function htmllist_get_select_options(tableId) {
+ return "<?=haproxy_js_select_options($a_servermodes);?>";
+ }
+
function clearcombo(){
for (var i=document.iform.serversSelect.options.length-1; i>=0; i--){
document.iform.serversSelect.options[i] = null;
@@ -273,6 +300,8 @@ foreach($simplefields as $field){
setCSSdisplay(".haproxy_check_username", check_type == 'MySQL' || check_type == 'PostgreSQL');
setCSSdisplay(".haproxy_check_smtp", check_type == 'SMTP' || check_type == 'ESMTP');
setCSSdisplay(".haproxy_check_agent", check_type == 'Agent');
+
+ setCSSdisplay(".haproxy_agent_check", agent_check.checked);
transparent_clientip = d.getElementById("transparent_clientip");
setCSSdisplay(".haproxy_transparent_clientip", transparent_clientip.checked);
@@ -285,31 +314,6 @@ foreach($simplefields as $field){
sqlcheckusername.innerText = monitor_username.value;
}
}
-
-
-</script>
-<script type="text/javascript">
- rowname[0] = "server_name";
- rowtype[0] = "textbox";
- rowsize[0] = "30";
- rowname[1] = "server_address";
- rowtype[1] = "textbox";
- rowsize[1] = "20";
- rowname[2] = "server_port";
- rowtype[2] = "textbox";
- rowsize[2] = "5";
- rowname[3] = "server_ssl";
- rowtype[3] = "checkbox";
- rowsize[3] = "5";
- rowname[4] = "server_weight";
- rowtype[4] = "textbox";
- rowsize[4] = "5";
- rowname[5] = "server_status";
- rowtype[5] = "select";
- rowsize[5] = "1";
- rowname[6] = "server_advanced";
- rowtype[6] = "textbox";
- rowsize[6] = "20";
</script>
<?php include("fbegin.inc"); ?>
<?php if ($input_errors) print_input_errors($input_errors); ?>
@@ -339,13 +343,13 @@ foreach($simplefields as $field){
<tr align="left">
<td width="22%" valign="top" class="vncellreq">Name</td>
<td width="78%" class="vtable" colspan="2">
- <input name="name" type="text" <?if(isset($pconfig['name'])) echo "value=\"{$pconfig['name']}\"";?> size="16" maxlength="16">
+ <input name="name" type="text" <?if(isset($pconfig['name'])) echo "value=\"{$pconfig['name']}\"";?> size="16" maxlength="16" />
</td>
</tr>
<tr align="left">
<td width="22%" valign="top" class="vncell">Cookie</td>
<td width="78%" class="vtable" colspan="2">
- <input name="cookie" type="text" <?if(isset($pconfig['cookie'])) echo "value=\"{$pconfig['cookie']}\"";?>size="64"><br/>
+ <input name="cookie" type="text" <?if(isset($pconfig['cookie'])) echo "value=\"{$pconfig['cookie']}\"";?>size="64" /><br/>
This value will be checked in incoming requests, and the first
operational pool possessing the same value will be selected. In return, in
cookie insertion or rewrite modes, this value will be assigned to the cookie
@@ -357,88 +361,11 @@ foreach($simplefields as $field){
</tr>
<tr align="left">
<td class="vncell" colspan="3"><strong>Server list</strong>
-
- <table class="" width="100%" cellpadding="0" cellspacing="0" id='servertable'>
- <tr>
- <td width="20%" class="listhdrr">Name</td>
- <td width="10%" class="listhdrr">Address</td>
- <td width="5%" class="listhdrr">Port</td>
- <td width="5%" class="listhdrr">SSL</td>
- <td width="8%" class="listhdrr">Weight</td>
- <td width="5%" class="listhdrr">Mode</td>
- <td width="15%" class="listhdr">Advanced</td>
- <td width="4%" class=""></td>
- </tr>
- <?php
- $a_servers=$pconfig['a_servers'];
-
- if (!is_array($a_servers)) {
- $a_servers=array();
- }
-
+ <?
$counter=0;
- foreach ($a_servers as $server) {
- ?>
- <tr id="tr_view_<?=$counter;?>" name="tr_view_<?=$counter;?>" ondblclick="editRow(<?=$counter;?>); return false;" >
- <td class="vtable listlr"><?=$server['name']; ?></td>
- <td class="vtable listr"><?=$server['address']; ?></td>
- <td class="vtable listr"><?=$server['port']; ?></td>
- <td class="vtable listr"><?=$server['ssl']=='yes'?'yes':'no'; ?></td>
- <td class="vtable listr"><?=$server['weight']; ?></td>
- <td class="vtable listr"><?=$server['status']; ?></td>
- <td class="vtable listr"><?=htmlspecialchars($server['advanced']); ?></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1"><tr>
- <td valign="middle">
- <img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="edit entry" width="17" height="17" border="0" onclick="editRow(<?=$counter;?>); return false;">
- </td>
- <td valign="middle">
- <img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="delete entry" width="17" height="17" border="0" onclick="deleteRow(<?=$counter;?>, 'servertable'); return false;">
- </td>
- <td valign="middle">
- <img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="duplicate entry" width="17" height="17" border="0" onclick="dupRow(<?=$counter;?>, 'servertable'); return false;">
- </td></tr></table>
- </td>
- </tr>
- <tr id="tr_edit_<?=$counter;?>" name="tr_edit_<?=$counter;?>" style="display: none;">
- <td class="vtable">
- <input name="server_name<?=$counter;?>" id="server_name<?=$counter;?>" type="text" value="<?=$server['name']; ?>" size="30"/></td>
- <td class="vtable">
- <input name="server_address<?=$counter;?>" id="server_address<?=$counter;?>" type="text" value="<?=$server['address']; ?>" size="20"/></td>
- <td class="vtable">
- <input name="server_port<?=$counter;?>" id="server_port<?=$counter;?>" type="text" value="<?=$server['port']; ?>" size="5"/></td>
- <td class="vtable">
- <input name="server_ssl<?=$counter;?>" id="server_ssl<?=$counter;?>" type="checkbox" value="yes" <?=$server['ssl']=='yes'?"checked":""; ?> size="5"/></td>
- <td class="vtable">
- <input name="server_weight<?=$counter;?>" id="server_weight<?=$counter;?>" type="text" value="<?=$server['weight']; ?>" size="5"/></td>
- <td class="vtable">
- <select name="server_status<?=$counter;?>" id="server_status<?=$counter;?>">
- <option value="active" <?php if($server['status']=='active') echo "SELECTED";?>>active</option>
- <option value="backup" <?php if($server['status']=='backup') echo "SELECTED";?>>backup</option>
- <option value="disabled" <?php if($server['status']=='disabled') echo "SELECTED";?>>disabled</option>
- <option value="inactive" <?php if($server['status']=='inactive') echo "SELECTED";?>>inactive</option>
- </select>
- </td>
- <td class="vtable">
- <input name="server_advanced<?=$counter;?>" id="server_advanced<?=$counter;?>" type="text" value="<?=htmlspecialchars($server['advanced']); ?>" size="20"/></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1"><tr>
- <td valign="middle">
- <img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="delete entry" width="17" height="17" border="0" onclick="removeRow(this); return false;">
- </td>
- <td valign="middle">
- <img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="duplicate entry" width="17" height="17" border="0" onclick="dupRow(<?=$counter;?>, 'servertable'); return false;">
- </td></tr></table>
- </td>
- </tr>
- <?php
- $counter++;
- }
+ $a_servers = $pconfig['a_servers'];
+ haproxy_htmllist("tableA_servers", $a_servers, $fields_servers);
?>
- </table>
- <a onclick="javascript:addRowTo('servertable'); return false;" href="#">
- <img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="add another entry" />
- </a>
</td>
</tr>
<tr align="left">
@@ -447,7 +374,7 @@ foreach($simplefields as $field){
<table width="100%">
<tr>
<td width="25%" valign="top">
- <input type="radio" name="balance" id="balance" value="roundrobin"<?php if($pconfig['balance'] == "roundrobin") echo " CHECKED"; ?>>Round robin</input>
+ <input type="radio" name="balance" value="roundrobin"<?php if($pconfig['balance'] == "roundrobin") echo " CHECKED"; ?> />Round robin
</td>
<td>
Each server is used in turns, according to their weights.
@@ -459,7 +386,7 @@ foreach($simplefields as $field){
</tr>
<tr>
<td width="25%" valign="top">
- <input type="radio" name="balance" id="balance" value="static-rr"<?php if($pconfig['balance'] == "static-rr") echo " CHECKED"; ?>>Static Round Robin</input>
+ <input type="radio" name="balance" value="static-rr"<?php if($pconfig['balance'] == "static-rr") echo " CHECKED"; ?> />Static Round Robin
</td>
<td>
Each server is used in turns, according to their weights.
@@ -474,7 +401,7 @@ foreach($simplefields as $field){
</tr>
<tr>
<td width="25%" valign="top">
- <input type="radio" name="balance" id="balance" value="leastconn"<?php if($pconfig['balance'] == "leastconn") echo " CHECKED"; ?>>Least Connections</input>
+ <input type="radio" name="balance" value="leastconn"<?php if($pconfig['balance'] == "leastconn") echo " CHECKED"; ?> />Least Connections
</td>
<td>
The server with the lowest number of connections receives the
@@ -487,8 +414,9 @@ foreach($simplefields as $field){
adjusted on the fly for slow starts for instance.
</td>
</tr>
- <tr><td valign="top"><input type="radio" name="balance" id="balance" value="source"<?php if($pconfig['balance'] ==
-"source") echo " CHECKED"; ?>>Source</input></td><td>
+ <tr><td valign="top"><input type="radio" name="balance" value="source"<?php if($pconfig['balance'] == "source") echo " CHECKED"; ?> />Source
+ </td>
+ <td>
The source IP address is hashed and divided by the total
weight of the running servers to designate which server will
receive the request. This ensures that the same client IP
@@ -509,7 +437,7 @@ foreach($simplefields as $field){
<tr align="left">
<td width="22%" valign="top" class="vncell">Transparent ClientIP</td>
<td width="78%" class="vtable" colspan="2">
- <input id="transparent_clientip" name="transparent_clientip" type="checkbox" value="yes" <?php if ($pconfig['transparent_clientip']=='yes') echo "checked"; ?> onclick='updatevisibility();'>
+ <input id="transparent_clientip" name="transparent_clientip" type="checkbox" value="yes" <?php if ($pconfig['transparent_clientip']=='yes') echo "checked"; ?> onclick='updatevisibility();' />
Use Client-IP to connect to backend servers.
<div class="haproxy_transparent_clientip">
@@ -535,7 +463,7 @@ foreach($simplefields as $field){
<tr align="left">
<td width="22%" valign="top" class="vncell">Per server pass thru</td>
<td width="78%" class="vtable" colspan="2">
- <input type="text" name='advanced' id='advanced' value='<?php echo $pconfig['advanced']; ?>' size="64">
+ <input type="text" name='advanced' id='advanced' value='<?php echo $pconfig['advanced']; ?>' size="64" />
<br/>
NOTE: paste text into this box that you would like to pass thru. Applied to each 'server' line.
</td>
@@ -565,7 +493,7 @@ foreach($simplefields as $field){
<tr align="left" class="haproxy_check_enabled">
<td width="22%" valign="top" class="vncell">Check frequency</td>
<td width="78%" class="vtable" colspan="2">
- <input name="checkinter" type="text" <?if(isset($pconfig['checkinter'])) echo "value=\"{$pconfig['checkinter']}\"";?>size="20"> milliseconds
+ <input name="checkinter" type="text" <?if(isset($pconfig['checkinter'])) echo "value=\"{$pconfig['checkinter']}\"";?> size="20" /> milliseconds
<br/>For HTTP/HTTPS defaults to 1000 if left blank. For TCP no check will be performed if left empty.
</td>
</tr>
@@ -581,14 +509,14 @@ foreach($simplefields as $field){
<tr align="left" class="haproxy_check_http">
<td width="22%" valign="top" class="vncell">Http check URI</td>
<td width="78%" class="vtable" colspan="2">
- <input name="monitor_uri" type="text" <?if(isset($pconfig['monitor_uri'])) echo "value=\"{$pconfig['monitor_uri']}\"";?>size="64">
+ <input name="monitor_uri" type="text" <?if(isset($pconfig['monitor_uri'])) echo "value=\"{$pconfig['monitor_uri']}\"";?>size="64" />
<br/>Defaults to / if left blank.
</td>
</tr>
<tr align="left" class="haproxy_check_http">
<td width="22%" valign="top" class="vncell">Http check version</td>
<td width="78%" class="vtable" colspan="2">
- <input name="monitor_httpversion" type="text" <?if(isset($pconfig['monitor_httpversion'])) echo "value=\"{$pconfig['monitor_httpversion']}\"";?>size="64">
+ <input name="monitor_httpversion" type="text" <?if(isset($pconfig['monitor_httpversion'])) echo "value=\"{$pconfig['monitor_httpversion']}\"";?> size="64" />
<br/>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:<br/>
@@ -600,29 +528,56 @@ foreach($simplefields as $field){
<tr align="left" class="haproxy_check_username">
<td width="22%" valign="top" class="vncell">Check with Username</td>
<td width="78%" class="vtable" colspan="2">
- <input name="monitor_username" id="monitor_username" type="text" <?if(isset($pconfig['monitor_username'])) echo "value=\"{$pconfig['monitor_username']}\"";?>size="64" onchange="updatevisibility();" onkeyup="updatevisibility();">
+ <input name="monitor_username" id="monitor_username" type="text" <?if(isset($pconfig['monitor_username'])) echo "value=\"{$pconfig['monitor_username']}\"";?>size="64" onchange="updatevisibility();" onkeyup="updatevisibility();" />
<br/>
This is the username which will be used when connecting to MySQL/PostgreSQL server.
<pre>
USE mysql;
-CREATE USER '<span id="sqlcheckusername" name="sqlcheckusername"></span>'@'&lt;pfSenseIP&gt;';
+CREATE USER '<span id="sqlcheckusername"></span>'@'&lt;pfSenseIP&gt;';
FLUSH PRIVILEGES;</pre>
</td>
</tr>
<tr align="left" class="haproxy_check_smtp">
<td width="22%" valign="top" class="vncell">Domain</td>
<td width="78%" class="vtable" colspan="2">
- <input name="monitor_domain" type="text" <?if(isset($pconfig['monitor_domain'])) echo "value=\"{$pconfig['monitor_domain']}\"";?>size="64">
+ <input name="monitor_domain" type="text" <?if(isset($pconfig['monitor_domain'])) echo "value=\"{$pconfig['monitor_domain']}\"";?> size="64" />
</td>
</tr>
<tr align="left" class="haproxy_check_agent">
<td width="22%" valign="top" class="vncell">Agentport</td>
<td width="78%" class="vtable" colspan="2">
- <input name="monitor_agentport" type="text" <?if(isset($pconfig['monitor_agentport'])) echo "value=\"{$pconfig['monitor_agentport']}\"";?>size="64">
+ <input name="monitor_agentport" type="text" <?if(isset($pconfig['monitor_agentport'])) echo "value=\"{$pconfig['monitor_agentport']}\"";?> size="64" />
+ <br/>
+ Fill in the TCP portnumber the healthcheck should be performed on.
+ </td>
+ </tr>
+ <tr><td>&nbsp;</td></tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Agent checks</td>
+ </tr>
+ <tr align="left">
+ <td width="22%" valign="top" class="vncell">Use agent checks</td>
+ <td width="78%" class="vtable" colspan="2">
+ <input id="agent_check" name="agent_check" type="checkbox" value="yes" <?php if ($pconfig['agent_check']=='yes') echo "checked"; ?> onclick='updatevisibility();' />
+ Use a TCP connection to read an ASCII string of the form 100%,75%,drain,down (more about this in the <a href='http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#agent-check' target='_blank'>haproxy manual</a>)
+ </td>
+ </tr>
+ <tr align="left" class="haproxy_agent_check">
+ <td width="22%" valign="top" class="vncell">Agent port</td>
+ <td width="78%" class="vtable" colspan="2">
+ <input name="agent_port" type="text" <?if(isset($pconfig['agent_port'])) echo "value=\"{$pconfig['agent_port']}\"";?> size="64" />
<br/>
Fill in the TCP portnumber the healthcheck should be performed on.
</td>
</tr>
+ <tr align="left" class="haproxy_agent_check">
+ <td width="22%" valign="top" class="vncell">Agent interval</td>
+ <td width="78%" class="vtable" colspan="2">
+ <input name="agent_inter" type="text" <?if(isset($pconfig['agent_inter'])) echo "value=\"{$pconfig['agent_inter']}\"";?> size="64" />
+ <br/>
+ Interval between two agent checks, defaults to 2000 ms.
+ </td>
+ </tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td colspan="2" valign="top" class="listtopic">Advanced settings</td>
@@ -630,21 +585,21 @@ FLUSH PRIVILEGES;</pre>
<tr align="left">
<td width="22%" valign="top" class="vncell">Connection timeout</td>
<td width="78%" class="vtable" colspan="2">
- <input name="connection_timeout" type="text" <?if(isset($pconfig['connection_timeout'])) echo "value=\"{$pconfig['connection_timeout']}\"";?> size="20">
+ <input name="connection_timeout" type="text" <?if(isset($pconfig['connection_timeout'])) echo "value=\"{$pconfig['connection_timeout']}\"";?> size="20" />
<div>the time (in milliseconds) we give up if the connection does not complete within (default 30000).</div>
</td>
</tr>
<tr align="left">
<td width="22%" valign="top" class="vncell">Server timeout</td>
<td width="78%" class="vtable" colspan="2">
- <input name="server_timeout" type="text" <?if(isset($pconfig['server_timeout'])) echo "value=\"{$pconfig['server_timeout']}\"";?> size="20">
+ <input name="server_timeout" type="text" <?if(isset($pconfig['server_timeout'])) echo "value=\"{$pconfig['server_timeout']}\"";?> size="20" />
<div>the time (in milliseconds) we accept to wait for data from the server, or for the server to accept data (default 30000).</div>
</td>
</tr>
<tr align="left">
<td width="22%" valign="top" class="vncell">Retries</td>
<td width="78%" class="vtable" colspan="2">
- <input name="retries" type="text" <?if(isset($pconfig['retries'])) echo "value=\"{$pconfig['retries']}\"";?> size="20">
+ <input name="retries" type="text" <?if(isset($pconfig['retries'])) echo "value=\"{$pconfig['retries']}\"";?> size="20" />
<div>After a connection failure to a server, it is possible to retry, potentially
on another server. This is useful if health-checks are too rare and you don't
want the clients to see the failures. The number of attempts to reconnect is
@@ -658,72 +613,72 @@ set by the 'retries' parameter.</div>
<tr align="left">
<td width="22%" valign="top" class="vncell">Stats Enabled</td>
<td width="78%" class="vtable" colspan="2">
- <input id="stats_enabled" name="stats_enabled" type="checkbox" value="yes" <?php if ($pconfig['stats_enabled']=='yes') echo "checked"; ?> onclick='updatevisibility();'>
+ <input id="stats_enabled" name="stats_enabled" type="checkbox" value="yes" <?php if ($pconfig['stats_enabled']=='yes') echo "checked"; ?> onclick='updatevisibility();' />
</td>
</tr>
- <tr class="haproxy_stats_visible" align="left" id='stats_realm_row' name='stats_realm_row'>
+ <tr class="haproxy_stats_visible" align="left" id='stats_realm_row'>
<td width="22%" valign="top" class="vncellreq">Stats Realm</td>
<td width="78%" class="vtable" colspan="2">
- <input id="stats_realm" name="stats_realm" type="text" <?if(isset($pconfig['stats_realm'])) echo "value=\"{$pconfig['stats_realm']}\"";?> size="64"><br/>
+ <input id="stats_realm" name="stats_realm" type="text" <?if(isset($pconfig['stats_realm'])) echo "value=\"{$pconfig['stats_realm']}\"";?> size="64" /><br/>
EXAMPLE: haproxystats
</td>
</tr>
- <tr class="haproxy_stats_visible" align="left" id='stats_uri_row' name='stats_uri_row'>
+ <tr class="haproxy_stats_visible" align="left" id='stats_uri_row'>
<td width="22%" valign="top" class="vncellreq">Stats Uri</td>
<td width="78%" class="vtable" colspan="2">
- <input id="stats_uri" name="stats_uri" type="text" <?if(isset($pconfig['stats_uri'])) echo "value=\"{$pconfig['stats_uri']}\"";?> size="64"><br/>
+ <input id="stats_uri" name="stats_uri" type="text" <?if(isset($pconfig['stats_uri'])) echo "value=\"{$pconfig['stats_uri']}\"";?> size="64" /><br/>
EXAMPLE: /haproxy?stats
</td>
</tr>
- <tr class="haproxy_stats_visible" align="left" id='stats_username_row' name='stats_username_row'>
+ <tr class="haproxy_stats_visible" align="left" id='stats_username_row'>
<td width="22%" valign="top" class="vncellreq">Stats Username</td>
<td width="78%" class="vtable" colspan="2">
- <input id="stats_username" name="stats_username" type="text" <?if(isset($pconfig['stats_username'])) echo "value=\"".$pconfig['stats_username']."\"";?> size="64">
+ <input id="stats_username" name="stats_username" type="text" <?if(isset($pconfig['stats_username'])) echo "value=\"".$pconfig['stats_username']."\"";?> size="64" />
</td>
</tr>
- <tr class="haproxy_stats_visible" align="left" id='stats_password_row' name='stats_password_row'>
+ <tr class="haproxy_stats_visible" align="left" id='stats_password_row'>
<td width="22%" valign="top" class="vncellreq">Stats Password</td>
<td width="78%" class="vtable" colspan="2">
<input id="stats_password" name="stats_password" type="password" <?
if(isset($pconfig['stats_password']))
echo "value=\"".$pconfig['stats_password']."\"";
- ?> size="64">
+ ?> size="64" />
<br/>
</td>
</tr>
- <tr class="haproxy_stats_visible" align="left" id='stats_node_admin_row' name='stats_node_enabled_row'>
+ <tr class="haproxy_stats_visible" align="left" id='stats_node_admin_row'>
<td width="22%" valign="top" class="vncell">Stats Admin</td>
<td width="78%" class="vtable" colspan="2">
- <input id="stats_admin" name="stats_admin" type="checkbox" value="yes" <?php if ($pconfig['stats_admin']=='yes') echo "checked"; ?>>
+ <input id="stats_admin" name="stats_admin" type="checkbox" value="yes" <?php if ($pconfig['stats_admin']=='yes') echo "checked"; ?> />
<br/>
</td>
</tr>
- <tr class="haproxy_stats_visible" align="left" id='stats_node_enabled_row' name='stats_node_enabled_row'>
+ <tr class="haproxy_stats_visible" align="left" id='stats_node_enabled_row'>
<td width="22%" valign="top" class="vncell">Stats Enable Node Name</td>
<td width="78%" class="vtable" colspan="2">
- <input id="stats_node_enabled" name="stats_node_enabled" type="checkbox" value="yes" <?php if ($pconfig['stats_node_enabled']=='yes') echo "checked"; ?>>
+ <input id="stats_node_enabled" name="stats_node_enabled" type="checkbox" value="yes" <?php if ($pconfig['stats_node_enabled']=='yes') echo "checked"; ?> />
<br/>
</td>
</tr>
- <tr class="haproxy_stats_visible" align="left" id='stats_node_row' name='stats_node_row'>
+ <tr class="haproxy_stats_visible" align="left" id='stats_node_row'>
<td width="22%" valign="top" class="vncell">Stats Node</td>
<td width="78%" class="vtable" colspan="2">
- <input id="stats_node" name="stats_node" type="text" <?if(isset($pconfig['stats_node'])) echo "value=\"{$pconfig['stats_node']}\"";?> size="64"><br/>
+ <input id="stats_node" name="stats_node" type="text" <?if(isset($pconfig['stats_node'])) echo "value=\"{$pconfig['stats_node']}\"";?> size="64" /><br/>
The node name is displayed in the stats and helps to differentiate which server in a cluster is actually serving clients.<br/>
Leave blank to use the system name.
</td>
</tr>
- <tr class="haproxy_stats_visible" align="left" id='stats_desc_row' name='stats_desc_row'>
+ <tr class="haproxy_stats_visible" align="left" id='stats_desc_row'>
<td width="22%" valign="top" class="vncell">Stats Description</td>
<td width="78%" class="vtable" colspan="2">
- <input id="stats_desc" name="stats_desc" type="text" <?if(isset($pconfig['stats_node'])) echo "value=\"{$pconfig['stats_desc']}\"";?> size="64"><br/>
+ <input id="stats_desc" name="stats_desc" type="text" <?if(isset($pconfig['stats_node'])) echo "value=\"{$pconfig['stats_desc']}\"";?> size="64" /><br/>
</td>
</tr>
- <tr class="haproxy_stats_visible" align="left" id='stats_refresh_row' name='stats_refresh_row'>
+ <tr class="haproxy_stats_visible" align="left" id='stats_refresh_row'>
<td width="22%" valign="top" class="vncell">Stats Refresh</td>
<td width="78%" class="vtable" colspan="2">
- <input id="stats_refresh" name="stats_refresh" type="text" <?if(isset($pconfig['stats_refresh'])) echo "value=\"{$pconfig['stats_refresh']}\"";?> size="10" maxlength="30"><br/>
+ <input id="stats_refresh" name="stats_refresh" type="text" <?if(isset($pconfig['stats_refresh'])) echo "value=\"{$pconfig['stats_refresh']}\"";?> size="10" maxlength="30" /><br/>
Specify the refresh rate of the stats page in seconds, or specified time unit (us, ms, s, m, h, d).
</td>
</tr>
@@ -731,10 +686,10 @@ set by the 'retries' parameter.</div>
<tr align="left">
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save">
- <input type="button" class="formbtn" value="Cancel" onclick="history.back()">
+ <input name="Submit" type="submit" class="formbtn" value="Save" />
+ <input type="button" class="formbtn" value="Cancel" onclick="history.back()" />
<?php if (isset($id) && $a_pools[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
+ <input name="id" type="hidden" value="<?=$id;?>" />
<?php endif; ?>
</td>
</tr>
@@ -742,170 +697,19 @@ set by the 'retries' parameter.</div>
</div>
</td></tr></table>
</form>
-<br>
-<?php include("fend.inc"); ?>
+<br/>
<script type="text/javascript">
<?
+ phparray_to_javascriptarray($fields_servers,"fields_servers",Array('/*','/*/name','/*/type','/*/size','/*/items','/*/items/*','/*/items/*/*','/*/items/*/*/name'));
phparray_to_javascriptarray($a_checktypes,"checktypes",Array('/*','/*/name','/*/descr'));
?>
browser_InnerText_support = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;
- field_counter_js = 7;
- rows = 1;
totalrows = <?php echo $counter; ?>;
- loaded = <?php echo $counter; ?>;
updatevisibility();
</script>
+<?php
+haproxy_htmllist_js();
+include("fend.inc"); ?>
</body>
</html>
-
-<?php
-
-function row_helper() {
- $options = <<<EOD
- <option value='active' SELECTED>active</option>"+
-" <option value='backup'>backup</option>"+
-" <option value='disabled'>disabled</option>"+
-" <option value='inactive'>inactive</option>
-EOD;
-
- echo <<<EOF
-<script type="text/javascript">
-// Global Variables
-var rowname = new Array(99);
-var rowtype = new Array(99);
-var newrow = new Array(99);
-var rowsize = new Array(99);
-
-for (i = 0; i < 99; i++) {
- rowname[i] = '';
- rowtype[i] = '';
- newrow[i] = '';
- rowsize[i] = '25';
-}
-
-var field_counter_js = 0;
-var loaded = 0;
-var is_streaming_progress_bar = 0;
-var temp_streaming_text = "";
-
-var addRowTo = (function() {
- return (function (tableId) {
- var d, tbody, tr, td, bgc, i, ii, j;
- var btable, btbody, btr, btd;
-
- d = document;
- tbody = d.getElementById(tableId).getElementsByTagName("tbody").item(0);
- tr = d.createElement("tr");
- totalrows++;
- for (i = 0; i < field_counter_js; i++) {
- td = d.createElement("td");
- if(rowtype[i] == 'textbox') {
- td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows +
- "'></input><input size='" + rowsize[i] + "' name='" + rowname[i] + totalrows +
- "' id='" + rowname[i] + totalrows + "'></input> ";
- } else if(rowtype[i] == 'select') {
- td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows +
- "'></input><select size='" + rowsize[i] + "' name='" + rowname[i] + totalrows +
- "' id='" + rowname[i] + totalrows + "'>$options</select> ";
- } else {
- td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows +
- "'></input><input type='checkbox' name='" + rowname[i] + totalrows +
- "' id='" + rowname[i] + totalrows + "' value='yes'></input> ";
- }
- td.setAttribute("class","vtable");
- tr.appendChild(td);
- }
- td = d.createElement("td");
- td.rowSpan = "1";
- td.setAttribute("class","list");
-
- // Recreate the button table.
- btable = document.createElement("table");
- btable.setAttribute("border", "0");
- btable.setAttribute("cellspacing", "0");
- btable.setAttribute("cellpadding", "1");
- btbody = document.createElement("tbody");
- btr = document.createElement("tr");
- btd = document.createElement("td");
- btd.setAttribute("valign", "middle");
- btd.innerHTML = '<img src="/themes/' + theme + '/images/icons/icon_x.gif" title="delete entry" width="17" height="17" border="0" onclick="removeRow(this); return false;">';
- btr.appendChild(btd);
- btd = document.createElement("td");
- btd.setAttribute("valign", "middle");
- btd.innerHTML = '<img src="/themes/' + theme + "/images/icons/icon_plus.gif\" title=\"duplicate entry\" width=\"17\" height=\"17\" border=\"0\" onclick=\"dupRow(" + totalrows + ", 'servertable'); return false;\">";
- btr.appendChild(btd);
- btbody.appendChild(btr);
- btable.appendChild(btbody);
-
- td.appendChild(btable);
- tr.appendChild(td);
- tbody.appendChild(tr);
- });
-})();
-
-function dupRow(rowId, tableId) {
- var dupEl;
- var newEl;
-
- addRowTo(tableId);
- for (i = 0; i < field_counter_js; i++) {
- dupEl = document.getElementById(rowname[i] + rowId);
- newEl = document.getElementById(rowname[i] + totalrows);
- if (dupEl && newEl)
- if(rowtype[i] == 'checkbox')
- newEl.checked = dupEl.checked;
- else
- newEl.value = dupEl.value;
- }
-}
-
-function deleteRow(rowId, tableId) {
- var view = document.getElementById("tr_view_" + rowId);
- var edit = document.getElementById("tr_edit_" + rowId);
-
- view.parentNode.removeChild(view);
- edit.parentNode.removeChild(edit);
-}
-
-function removeRow(el) {
- var cel;
- // Break out of one table first
- while (el && el.nodeName.toLowerCase() != "table")
- el = el.parentNode;
- while (el && el.nodeName.toLowerCase() != "tr")
- el = el.parentNode;
-
- if (el && el.parentNode) {
- cel = el.getElementsByTagName("td").item(0);
- el.parentNode.removeChild(el);
- }
-}
-function editRow(num) {
- var trview = document.getElementById('tr_view_' + num);
- var tredit = document.getElementById('tr_edit_' + num);
-
- trview.style.display='none';
- tredit.style.display='';
-}
-
-function find_unique_field_name(field_name) {
- // loop through field_name and strip off -NUMBER
- var last_found_dash = 0;
- for (var i = 0; i < field_name.length; i++) {
- // is this a dash, if so, update
- // last_found_dash
- if (field_name.substr(i,1) == "-" )
- last_found_dash = i;
- }
- if (last_found_dash < 1)
- return field_name;
- return(field_name.substr(0,last_found_dash));
-}
-</script>
-
-EOF;
-
-}
-
-?>