You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by di...@apache.org on 2014/07/07 11:01:32 UTC

[1/3] git commit: STRATOS-699 - HAProxy Puppet Configurations

Repository: stratos
Updated Branches:
  refs/heads/4.0.0 862a71d67 -> 37372c2e7


STRATOS-699 - HAProxy Puppet Configurations


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/335a4e34
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/335a4e34
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/335a4e34

Branch: refs/heads/4.0.0
Commit: 335a4e342e3209be686467bd996f18a5573dbdaa
Parents: 6a45473
Author: Dinesh Bandara <di...@wso2.com>
Authored: Thu Jul 3 16:40:48 2014 +0530
Committer: Dinesh Bandara <di...@wso2.com>
Committed: Thu Jul 3 16:40:48 2014 +0530

----------------------------------------------------------------------
 tools/puppet3/modules/haproxy/files/README.txt  | 12 +++
 tools/puppet3/modules/haproxy/manifests/init.pp | 70 ++++++++++++++++++
 .../modules/haproxy/manifests/initialize.pp     | 77 ++++++++++++++++++++
 .../modules/haproxy/manifests/push_templates.pp | 30 ++++++++
 .../puppet3/modules/haproxy/manifests/start.pp  | 25 +++++++
 .../templates/bin/haproxy-extension.sh.erb      | 48 ++++++++++++
 .../haproxy/templates/conf/jndi.properties.erb  | 33 +++++++++
 7 files changed, 295 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/335a4e34/tools/puppet3/modules/haproxy/files/README.txt
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/files/README.txt b/tools/puppet3/modules/haproxy/files/README.txt
new file mode 100644
index 0000000..b9c3baa
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/files/README.txt
@@ -0,0 +1,12 @@
+This folder should have following:
+
+1. apache-stratos-haproxy-extension-${version}.zip file
+
+2. Folder having a name as $mb_type which is defined in the nodes.pp file.
+
+eg:
+if $mb_type = activemq, folder structure of this folder would be:
+>$ls
+>activemq  apache-stratos-haproxy-extension-4.0.0.zip
+
+3. Under $mb_type folder, please add all the client jars, that should be copied to the haproxy-extension's lib directory.

http://git-wip-us.apache.org/repos/asf/stratos/blob/335a4e34/tools/puppet3/modules/haproxy/manifests/init.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/manifests/init.pp b/tools/puppet3/modules/haproxy/manifests/init.pp
new file mode 100755
index 0000000..f8ce3ed
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/manifests/init.pp
@@ -0,0 +1,70 @@
+#--------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#--------------------------------------------------------------
+
+class haproxy(
+  $network_partition_id = $stratos_network_partition_id,
+  $service_filter       = $stratos_load_balanced_service_type,
+  $version              = '4.0.0',
+  $owner                = 'root',
+  $group                = 'root',
+  $target               = '/mnt',
+){
+
+  $deployment_code = 'haproxy-extension'
+  $carbon_version  = $version
+  $service_code    = 'haproxy-extension'
+  $carbon_home     = "${target}/apache-stratos-${service_code}-${carbon_version}"
+
+  tag($service_code)
+
+  $service_templates = [
+    'bin/haproxy-extension.sh',
+    'conf/jndi.properties',
+    ]
+
+  package { ['haproxy', 'socat']:
+    ensure  => installed,
+  }
+
+  haproxy::initialize { $deployment_code:
+    repo      => $package_repo,
+    version   => $carbon_version,
+    service   => $service_code,
+    local_dir => $local_package_dir,
+    target    => $target,
+    owner     => $owner,
+  }
+  
+  haproxy::push_templates {
+    $service_templates:
+      target    => $carbon_home,
+      require   => Haproxy::Initialize[$deployment_code];
+  }
+
+  haproxy::start { $deployment_code:
+    owner   => $owner,
+    target  => $carbon_home,
+    require => [
+      Package['haproxy'],
+      Haproxy::Push_templates[$service_templates],
+    ];
+  }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/335a4e34/tools/puppet3/modules/haproxy/manifests/initialize.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/manifests/initialize.pp b/tools/puppet3/modules/haproxy/manifests/initialize.pp
new file mode 100755
index 0000000..65bd795
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/manifests/initialize.pp
@@ -0,0 +1,77 @@
+#--------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#--------------------------------------------------------------
+
+define haproxy::initialize ($repo, $version, $service, $local_dir, $target, $owner,) {
+  file {
+    "/${local_dir}/apache-stratos-${service}-${version}.zip":
+      ensure => present,
+      source => "puppet:///modules/haproxy/apache-stratos-${service}-${version}.zip";
+  }
+
+  exec {
+    "creating_target_for_${name}":
+      path    => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+      command => "mkdir -p ${target}";
+
+    "creating_local_package_repo_for_${name}":
+      path    => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java/bin/',
+      unless  => "test -d ${local_dir}",
+      command => "mkdir -p ${local_dir}";
+
+    "downloading_stratos${service}-${version}.zip_for_${name}":
+      path      => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+      cwd       => $local_dir,
+      unless    => "test -f ${local_dir}/apache-stratos-${service}-${version}.zip",
+      command => "puppet:///modules/haproxy/apache-stratos-${service}-${version}.zip", 
+      logoutput => 'on_failure',
+      creates   => "${local_dir}/apache-stratos-${service}-${version}.zip",
+      timeout   => 0,
+      require   => Exec["creating_local_package_repo_for_${name}", "creating_target_for_${name}"];
+
+    "extracting_stratos${service}-${version}.zip_for_${name}":
+      path      => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+      cwd       => $target,
+      unless    => "test -d ${target}/apache-stratos-${service}-${version}/conf",
+      command   => "unzip ${local_dir}/apache-stratos-${service}-${version}.zip",
+      logoutput => 'on_failure',
+      creates   => "${target}/apache-stratos-${service}-${version}/repository",
+      timeout   => 0,
+      require   => Exec["downloading_stratos${service}-${version}.zip_for_${name}"];
+
+    "setting_permission_for_${name}":
+      path      => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+      cwd       => $target,
+      command   => "chown -R ${owner}:${owner} ${target}/apache-stratos-${service}-${version} ;
+                    chmod -R 755 ${target}/apache-stratos-${service}-${version}",
+      logoutput => 'on_failure',
+      timeout   => 0,
+      require   => Exec["extracting_stratos${service}-${version}.zip_for_${name}"];
+  }
+
+ file { "/${target}/apache-stratos-${service}-${version}/lib":
+    path => "/${target}/apache-stratos-${service}-${version}/lib",
+    ensure => directory,
+    require => Exec["setting_permission_for_${name}"],
+    source => ["puppet:///modules/haproxy/${mb_type}"],
+    sourceselect => all,
+    recurse => true,
+  }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/335a4e34/tools/puppet3/modules/haproxy/manifests/push_templates.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/manifests/push_templates.pp b/tools/puppet3/modules/haproxy/manifests/push_templates.pp
new file mode 100755
index 0000000..b8ba309
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/manifests/push_templates.pp
@@ -0,0 +1,30 @@
+#--------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#--------------------------------------------------------------
+
+define haproxy::push_templates ($target) {
+  file { "${target}/${name}":
+    ensure  => present,
+    owner   => $haproxy::owner,
+    group   => $haproxy::group,
+    mode    => '0755',
+    content => template("haproxy/${name}.erb"),
+  }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/335a4e34/tools/puppet3/modules/haproxy/manifests/start.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/manifests/start.pp b/tools/puppet3/modules/haproxy/manifests/start.pp
new file mode 100755
index 0000000..351c4c3
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/manifests/start.pp
@@ -0,0 +1,25 @@
+# ----------------------------------------------------------------------------
+#  Copyright 2005-2013 WSO2, Inc. http://www.wso2.org
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+# ----------------------------------------------------------------------------
+
+define haproxy::start ($target, $owner) {
+  exec { "starting_${name}":
+    user    => $owner,
+    path    => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java/bin/',
+    unless  => "test -f ${target}/wso2carbon.lck",
+    cwd     => "${target}/bin/",
+    command => "touch ${target}/wso2carbon.lck; bash haproxy-extension.sh > /dev/null 2>&1 &",
+  }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/335a4e34/tools/puppet3/modules/haproxy/templates/bin/haproxy-extension.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/templates/bin/haproxy-extension.sh.erb b/tools/puppet3/modules/haproxy/templates/bin/haproxy-extension.sh.erb
new file mode 100755
index 0000000..7f17d2e
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/templates/bin/haproxy-extension.sh.erb
@@ -0,0 +1,48 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+echo "Starting haproxy extension..."
+script_path="$( cd -P "$( dirname "$SOURCE" )" && pwd )/`dirname $0`"
+lib_path=${script_path}/../lib/
+class_path=`echo ${lib_path}/*.jar | tr ' ' ':'`
+#properties="-Dhaproxy.private.ip=<%= @ipaddress %>
+properties="-Dhaproxy.private.ip=0.0.0.0
+            -Djndi.properties.dir=${script_path}/../conf
+            -Dexecutable.file.path=haproxy
+            -Dtemplates.path=${script_path}/../templates
+            -Dtemplates.name=haproxy.cfg.template
+            -Dscripts.path=${script_path}/../scripts
+            -Dconf.file.path=/tmp/haproxy.cfg
+            -Dstats.socket.file.path=/tmp/haproxy-stats.socket
+            -Dlog4j.properties.file.path=${script_path}/../conf/log4j.properties
+            -Djavax.net.ssl.trustStore=${script_path}/../security/client-truststore.jks
+            -Djavax.net.ssl.trustStorePassword=<%= @truststore_password %>
+            -Dthrift.receiver.ip=<%= @cep_ip %>
+            -Dthrift.receiver.port=<%= @cep_port %>
+            -Dnetwork.partition.id=<%= @network_partition_id %>
+            <% if @stratos_lb_category == 'service.aware.load.balancer' %>-Dstratos.topology.service.filter=service-name=<%= @service_filter %><% end %>            
+            -Dcep.stats.publisher.enabled=true"
+
+# Uncomment below line to enable remote debugging
+#debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
+
+/opt/java/bin/java -cp "${class_path}" ${properties} ${debug} org.apache.stratos.haproxy.extension.Main $*

http://git-wip-us.apache.org/repos/asf/stratos/blob/335a4e34/tools/puppet3/modules/haproxy/templates/conf/jndi.properties.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/templates/conf/jndi.properties.erb b/tools/puppet3/modules/haproxy/templates/conf/jndi.properties.erb
new file mode 100644
index 0000000..e4b4462
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/templates/conf/jndi.properties.erb
@@ -0,0 +1,33 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# This is a generated file and will be overwritten at the next load balancer startup.
+# Please use loadbalancer.conf for updating mb-ip, mb-port and templates/jndi.properties.template
+# file for updating other configurations.
+#
+<% if @mb_type == 'wso2mb' %>
+    connectionfactoryName=topicConnectionfactory
+    connectionfactory.topicConnectionfactory=amqp://admin:admin@carbon/carbon?brokerlist='tcp://<%= @mb_ip %>:<%= @mb_port %>'
+    java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory
+    java.naming.provider.url=<%= @carbon_home %>/conf/jndi.properties
+<% end %>
+<% if @mb_type == 'activemq' %>
+    connectionfactoryName=TopicConnectionFactory
+    java.naming.provider.url=tcp://<%= @mb_ip %>:<%= @mb_port %>
+    java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+<% end %>


[2/3] git commit: Merge branch '4.0.0' of https://git-wip-us.apache.org/repos/asf/stratos into 4.0.0

Posted by di...@apache.org.
Merge branch '4.0.0' of https://git-wip-us.apache.org/repos/asf/stratos into 4.0.0


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/34df8812
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/34df8812
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/34df8812

Branch: refs/heads/4.0.0
Commit: 34df88126ef8ae2970f111731be4fa1d1d0b8a98
Parents: 335a4e3 862a71d
Author: Dinesh Bandara <di...@wso2.com>
Authored: Thu Jul 3 17:02:01 2014 +0530
Committer: Dinesh Bandara <di...@wso2.com>
Committed: Thu Jul 3 17:02:01 2014 +0530

----------------------------------------------------------------------

----------------------------------------------------------------------



[3/3] git commit: Fix for STRATOS-702 - HAProxy Extension won't update it's member list

Posted by di...@apache.org.
Fix for STRATOS-702 - HAProxy Extension won't update it's member list


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/37372c2e
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/37372c2e
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/37372c2e

Branch: refs/heads/4.0.0
Commit: 37372c2e78e170a97ba24b51d82a501ef36295e6
Parents: 34df881
Author: Dinesh Bandara <di...@wso2.com>
Authored: Mon Jul 7 14:21:12 2014 +0530
Committer: Dinesh Bandara <di...@wso2.com>
Committed: Mon Jul 7 14:28:23 2014 +0530

----------------------------------------------------------------------
 .../balancer/extension/api/LoadBalancerExtension.java  | 13 ++++++++-----
 .../org/apache/stratos/haproxy/extension/HAProxy.java  |  3 +++
 .../stratos/haproxy/extension/HAProxyConfigWriter.java |  5 +++++
 .../haproxy/extension/HAProxyStatisticsReader.java     |  5 +++--
 4 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/37372c2e/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerExtension.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerExtension.java b/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerExtension.java
index 44b7419..e58ce37 100644
--- a/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerExtension.java
+++ b/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerExtension.java
@@ -92,12 +92,15 @@ public class LoadBalancerExtension implements Runnable {
             @Override
             protected void onEvent(Event event) {
                 try {
-                    // Configure load balancer
-                    loadBalancer.configure(TopologyManager.getTopology());
 
-                    // Start load balancer
-                    loadBalancer.start();
-                    loadBalancerStarted = true;
+                    if (!loadBalancerStarted) {
+                        // Configure load balancer
+                        loadBalancer.configure(TopologyManager.getTopology());
+
+                        // Start load balancer
+                        loadBalancer.start();
+                        loadBalancerStarted = true;
+                    }
                 } catch (Exception e) {
                     if (log.isErrorEnabled()) {
                         log.error("Could not start load balancer", e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/37372c2e/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxy.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxy.java b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxy.java
index 75efdc2..c71eba1 100644
--- a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxy.java
+++ b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxy.java
@@ -84,6 +84,9 @@ public class HAProxy implements LoadBalancer {
     }
 
     public void reload(Topology topology) throws LoadBalancerExtensionException {
+        if(log.isDebugEnabled()) {
+           log.info("Reconfigure and Reload the Load Balancer ");
+        }
         configure(topology);
         reloadConfiguration();
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/37372c2e/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
index db28b0e..66ea32a 100644
--- a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
+++ b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
@@ -61,6 +61,11 @@ public class HAProxyConfigWriter {
         StringBuilder frontendBackendCollection = new StringBuilder();
         for (Service service : topology.getServices()) {
             for (Cluster cluster : service.getClusters()) {
+
+                if(cluster.getServiceName().equals("haproxy"))
+                    continue;
+
+
                 if ((service.getPorts() == null) || (service.getPorts().size() == 0)) {
                     throw new RuntimeException(String.format("No ports found in service: %s", service.getServiceName()));
                 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/37372c2e/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyStatisticsReader.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyStatisticsReader.java b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyStatisticsReader.java
index b38aa3c..676f522 100644
--- a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyStatisticsReader.java
+++ b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyStatisticsReader.java
@@ -60,9 +60,10 @@ public class HAProxyStatisticsReader implements LoadBalancerStatisticsReader {
                     }
 
                     for (Port port : service.getPorts()) {
-                        frontendId = cluster.getClusterId() + "-proxy-" + port.getProxy();
+                        frontendId = cluster.getClusterId() + "-host-" + HAProxyContext.getInstance().getHAProxyPrivateIp() + "-proxy-" + port.getProxy();
+                        //frontendId = cluster.getClusterId() + "-proxy-" + port.getProxy();
                         backendId = frontendId + "-members";
-
+                        
                         for (Member member : cluster.getMembers()) {
                             // echo "get weight <backend>/<server>" | socat stdio <stats-socket>
                             command = String.format("%s/get-weight.sh %s %s %s", scriptsPath, backendId, member.getMemberId(), statsSocketFilePath);