diff options
-rw-r--r-- | config/haproxy/haproxy.inc | 28 | ||||
-rwxr-xr-x | config/haproxy/haproxy_global.php | 4 | ||||
-rwxr-xr-x | config/haproxy/haproxy_servers_edit.php | 2 |
3 files changed, 24 insertions, 10 deletions
diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc index a94c84fd..dfbec28c 100644 --- a/config/haproxy/haproxy.inc +++ b/config/haproxy/haproxy.inc @@ -201,7 +201,8 @@ function haproxy_configure() { if($backend['cookie_name']) fwrite ($fd, "\tcookie\t\t\t" . $backend['cookie_name'] . " insert indirect\n"); - fwrite ($fd, "\toption\t\t\t{$httpchk} HEAD " . $backend['monitor_uri'] . " HTTP/1.0\n"); + if($backend['monitor_uri']) + fwrite ($fd, "\toption\t\t\t{$httpchk} HEAD " . $backend['monitor_uri'] . " HTTP/1.0\n"); if($backend['stats_enabled']=='yes') { fwrite ($fd, "\tstats\t\t\tenable\n"); @@ -212,6 +213,12 @@ function haproxy_configure() { else fwrite ($fd, "\tstats\t\t\trealm .\n"); fwrite ($fd, "\tstats\t\t\tauth " . $backend['stats_username'].":". $backend['stats_password']."\n"); + if($backend['stats_node_enabled']=='yes') + fwrite ($fd, "\tstats\t\t\tshow-node " . $backend['stats_node'] . "\n"); + if($backend['stats_desc']) + fwrite ($fd, "\tstats\t\t\tshow-desc " . $backend['stats_desc'] . "\n"); + if($backend['stats_refresh']) + fwrite ($fd, "\tstats\t\t\trefresh " . $backend['stats_refresh'] . "\n"); } $a_acl=&$frontend['ha_acls']['item']; @@ -230,7 +237,7 @@ function haproxy_configure() { continue; if($backends == $backend['name']) { $server_ports = array(); - if($server['status']=='active') { + if($server['status'] != 'inactive') { if($server['cookie']) $cookie = " cookie {$server['cookie']} "; else @@ -249,12 +256,17 @@ function haproxy_configure() { } else { $advanced_txt = ""; } + if($server['status'] != 'active') { + $status = " " . $server['status']; + } else { + $status = ""; + } if($server['checkinter']) $checkinter = "check inter {$server['checkinter']}"; else $checkinter = "check inter 1000"; foreach($server_ports as $pport) - fwrite ($fd, "\tserver\t\t\t" . $server['name'] . " " . $server['address'].":" . $pport . " $cookie " . " $checkinter weight " . $server['weight'] . "{$advanced_txt}\n"); + fwrite ($fd, "\tserver\t\t\t" . $server['name'] . " " . $server['address'].":" . $pport . " $cookie " . " $checkinter weight " . $server['weight'] . $status . "{$advanced_txt}\n"); } } } @@ -350,11 +362,11 @@ function haproxy_do_xmlrpc_sync($sync_to_ip, $password) { $xml['haproxy'] = $config['installedpackages']['haproxy']; // Prevent sync loops - unset($xml['synchost1']); - unset($xml['synchost2']); - unset($xml['synchost3']); - unset($xml['syncpassword']); - + unset($xml['haproxy']['synchost1']); + unset($xml['haproxy']['synchost2']); + unset($xml['haproxy']['synchost3']); + unset($xml['haproxy']['syncpassword']); + /* assemble xmlrpc payload */ $params = array( XML_RPC_encode($password), diff --git a/config/haproxy/haproxy_global.php b/config/haproxy/haproxy_global.php index e547aa10..b0486fb8 100755 --- a/config/haproxy/haproxy_global.php +++ b/config/haproxy/haproxy_global.php @@ -74,10 +74,10 @@ if ($_POST) { $config['installedpackages']['haproxy']['enablesync'] = $_POST['enablesync'] ? true : false; $config['installedpackages']['haproxy']['synchost1'] = $_POST['synchost1'] ? $_POST['synchost1'] : false; $config['installedpackages']['haproxy']['synchost2'] = $_POST['synchost2'] ? $_POST['synchost2'] : false; - $config['installedpackages']['haproxy']['synchost2'] = $_POST['synchost3'] ? $_POST['synchost3'] : false; + $config['installedpackages']['haproxy']['synchost3'] = $_POST['synchost3'] ? $_POST['synchost3'] : false; $config['installedpackages']['haproxy']['remotesyslog'] = $_POST['remotesyslog'] ? $_POST['remotesyslog'] : false; $config['installedpackages']['haproxy']['syncpassword'] = $_POST['syncpassword'] ? $_POST['syncpassword'] : false; - $config['installedpackages']['haproxy']['advanced'] = base64_encode($_POST['advanced']) ? $_POST['advanced'] : false; + $config['installedpackages']['haproxy']['advanced'] = $_POST['advanced'] ? base64_encode($_POST['advanced']) : false; $config['installedpackages']['haproxy']['nbproc'] = $_POST['nbproc'] ? $_POST['nbproc'] : false; touch($d_haproxyconfdirty_path); write_config(); diff --git a/config/haproxy/haproxy_servers_edit.php b/config/haproxy/haproxy_servers_edit.php index 5c747277..a4360b04 100755 --- a/config/haproxy/haproxy_servers_edit.php +++ b/config/haproxy/haproxy_servers_edit.php @@ -270,6 +270,8 @@ function clearcombo(){ <td width="78%" class="vtable" colspan="2"> <select name="status"> <option value="active" <?php if($pconfig['status']=='active') echo "SELECTED";?>>active</option> + <option value="backup" <?php if($pconfig['status']=='backup') echo "SELECTED";?>>backup</option> + <option value="disabled" <?php if($pconfig['status']=='disabled') echo "SELECTED";?>>disabled</option> <option value="inactive" <?php if($pconfig['status']=='inactive') echo "SELECTED";?>>inactive</option> </select> </td> |