aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2011-12-13 17:13:42 -0800
committerMarcello Coutinho <marcellocoutinho@gmail.com>2011-12-13 17:13:42 -0800
commit57221cbcaf7b43676d4f4ca870ad481d0772dbfb (patch)
tree5bd35b09928b1f215510ec278cadd3239b3cf12d /config/haproxy
parentacbc0de64d69867ad5b8d028cdfd7bfc68a419ba (diff)
parent757bbc6c7eefc0fc441eb62a0a541d0f913287cf (diff)
downloadpfsense-packages-57221cbcaf7b43676d4f4ca870ad481d0772dbfb.tar.gz
pfsense-packages-57221cbcaf7b43676d4f4ca870ad481d0772dbfb.tar.bz2
pfsense-packages-57221cbcaf7b43676d4f4ca870ad481d0772dbfb.zip
Merge pull request #127 from briantist/patch-2
Changes for new server statuses and to make monitor uri optional.
Diffstat (limited to 'config/haproxy')
-rw-r--r--config/haproxy/haproxy.inc28
1 files changed, 20 insertions, 8 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),