From 93865d388d8782e768e0a7f7d39d87c69f528084 Mon Sep 17 00:00:00 2001 From: thompsa Date: Mon, 8 Feb 2010 00:20:46 +1300 Subject: Add backend server name field. --- config/haproxy-dev/haproxy.inc | 4 +++- config/haproxy-dev/haproxy_pool_edit.php | 38 +++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/config/haproxy-dev/haproxy.inc b/config/haproxy-dev/haproxy.inc index 4ab000da..d6665f38 100644 --- a/config/haproxy-dev/haproxy.inc +++ b/config/haproxy-dev/haproxy.inc @@ -266,7 +266,9 @@ function haproxy_configure() { foreach($a_servers as $be) { if(!$be['port']) $be['port'] = $backend['port']; - fwrite ($fd, "\tserver\t\t\t" . $be['address'] . " " . $be['address'].":" . $be['port'] . " $cookie " . " $checkinter weight " . $be['weight'] . "{$advanced_txt}\n"); + if (!$be['name']) + $be['name'] = $be['address']; + fwrite ($fd, "\tserver\t\t\t" . $be['name'] . " " . $be['address'].":" . $be['port'] . " $cookie " . " $checkinter weight " . $be['weight'] . "{$advanced_txt}\n"); } } } diff --git a/config/haproxy-dev/haproxy_pool_edit.php b/config/haproxy-dev/haproxy_pool_edit.php index 8a006a29..91909a29 100755 --- a/config/haproxy-dev/haproxy_pool_edit.php +++ b/config/haproxy-dev/haproxy_pool_edit.php @@ -78,6 +78,7 @@ if ($_POST) { $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_weight=$_POST['server_weight'.$x]; @@ -85,6 +86,7 @@ if ($_POST) { if ($server_address) { $server=array(); + $server['name']=$server_name; $server['address']=$server_address; $server['port']=$server_port; $server['weight']=$server_weight; @@ -174,15 +176,18 @@ function clearcombo(){ } @@ -226,10 +231,11 @@ function clearcombo(){ - - - - + + + + + - - - + + + + @@ -293,7 +304,7 @@ function clearcombo(){
AddressPortWeightNameAddressPortWeight
+ + + +
Check freq - size="64"> + size="20"> milliseconds
Defaults to 1000 if left blank.