Updated Branches:
  refs/heads/master d6cf0a0ef -> 36d0c28d0

Added network partition id to cartridge agent and load balancer cartridge 
scripts


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

Branch: refs/heads/master
Commit: 36d0c28d033534cfac0e703626be29b3fd7b11a2
Parents: d6cf0a0
Author: Imesh Gunaratne <[email protected]>
Authored: Fri Dec 13 12:12:29 2013 +0530
Committer: Imesh Gunaratne <[email protected]>
Committed: Fri Dec 13 12:12:29 2013 +0530

----------------------------------------------------------------------
 .../ec2/load-balancer/cartridge-agent.sh             |  4 ++--
 .../ec2/load-balancer/start-load-balancer.sh         |  5 +++++
 .../templates/loadbalancer.conf.template             |  2 +-
 .../cartridge-agent/ec2/php/cartridge-agent.sh       |  2 +-
 .../health-stats/src/main/bin/health-publisher.sh    |  2 +-
 .../agent/health/publisher/HealthPublisher.java      | 15 ++++++++++++---
 6 files changed, 22 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/36d0c28d/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/cartridge-agent.sh
----------------------------------------------------------------------
diff --git 
a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/cartridge-agent.sh
 
b/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/cartridge-agent.sh
index 3b5d998..e463a69 100644
--- 
a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/cartridge-agent.sh
+++ 
b/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/cartridge-agent.sh
@@ -61,7 +61,7 @@ source ${instance_path}/launch.params
 # Starting load balancer
 #---------------------------
 pushd $instance_path/load-balancer/
-sh start-load-balancer.sh $MB_IP $MB_PORT $CEP_IP $CEP_PORT $LB_CLUSTER_ID &
+sh start-load-balancer.sh $MB_IP $MB_PORT $CEP_IP $CEP_PORT $LB_CLUSTER_ID 
$NETWORK_PARTITION_ID &
 popd
 
 #---------------------------
@@ -84,6 +84,6 @@ popd
 
 pushd $health_publisher_path/bin
 echo "Executing: health-publisher.sh"
-sh health-publisher.sh $MEMBER_ID $CEP_IP $CEP_PORT $PORTS $CLUSTER_ID
+sh health-publisher.sh $MEMBER_ID $CEP_IP $CEP_PORT $PORTS $CLUSTER_ID 
$NETWORK_PARTITION_ID
 echo "Health stat published" | tee -a $LOG
 popd

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/36d0c28d/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/start-load-balancer.sh
----------------------------------------------------------------------
diff --git 
a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/start-load-balancer.sh
 
b/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/start-load-balancer.sh
index a370344..671a4a1 100755
--- 
a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/start-load-balancer.sh
+++ 
b/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/start-load-balancer.sh
@@ -42,12 +42,14 @@ mb_port=$2
 cep_ip=$3
 cep_port=$4
 lb_cluster_id=$5
+network_partition_id=$6
 
 echo "mb-ip: $mb_ip" | tee -a $LOG
 echo "mb-port: $mb_port" | tee -a $LOG
 echo "cep-ip: $cep_ip" | tee -a $LOG
 echo "cep-port: $cep_port" | tee -a $LOG
 echo "lb-cluster-id: $lb_cluster_id" | tee -a $LOG
+echo "lb-network-partition-id: $network_partition_id" | tee -a $LOG
 
 cp -f $script_home/templates/loadbalancer.conf.template 
$script_home/loadbalancer.conf.orig
 cat $script_home/loadbalancer.conf.orig | sed -e "s@MB_IP@$mb_ip@g" > 
$script_home/loadbalancer.conf
@@ -64,6 +66,9 @@ cat $script_home/loadbalancer.conf.orig | sed -e 
"s@CEP_PORT@$cep_port@g" > $scr
 cp -f $script_home/loadbalancer.conf $script_home/loadbalancer.conf.orig
 cat $script_home/loadbalancer.conf.orig | sed -e 
"s@LB_CLUSTER_ID@$lb_cluster_id@g" > $script_home/loadbalancer.conf
 
+cp -f $script_home/loadbalancer.conf $script_home/loadbalancer.conf.orig
+cat $script_home/loadbalancer.conf.orig | sed -e 
"s@NETWORK_PARTITION_ID@$network_partition_id@g" > 
$script_home/loadbalancer.conf
+
 rm $script_home/loadbalancer.conf.orig
 
 echo "Moving generated loadbalancer.conf to $lb_conf_path" | tee -a $LOG

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/36d0c28d/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/templates/loadbalancer.conf.template
----------------------------------------------------------------------
diff --git 
a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/templates/loadbalancer.conf.template
 
b/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/templates/loadbalancer.conf.template
index caa9078..de7bee3 100755
--- 
a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/templates/loadbalancer.conf.template
+++ 
b/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/templates/loadbalancer.conf.template
@@ -73,7 +73,7 @@ loadbalancer {
 
     # Network partition id
     # Provide the network partition id if cep-stats-publisher is set to true.
-    network-partition-id: network-partition-1;
+    network-partition-id: NETWORK_PARTITION_ID;
 
     # Multi-tenancy
     # If this property is set to true, all incoming request URLs will be 
scanned using the given tenant-identifier-regex

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/36d0c28d/products/cartridge-agent/modules/cartridge-agent/ec2/php/cartridge-agent.sh
----------------------------------------------------------------------
diff --git 
a/products/cartridge-agent/modules/cartridge-agent/ec2/php/cartridge-agent.sh 
b/products/cartridge-agent/modules/cartridge-agent/ec2/php/cartridge-agent.sh
index fcdabe3..396f0be 100755
--- 
a/products/cartridge-agent/modules/cartridge-agent/ec2/php/cartridge-agent.sh
+++ 
b/products/cartridge-agent/modules/cartridge-agent/ec2/php/cartridge-agent.sh
@@ -80,7 +80,7 @@ popd
 
 pushd $health_publisher_path/bin
 echo "Executing: health-publisher.sh"
-sh health-publisher.sh $MEMBER_ID $CEP_IP $CEP_PORT $PORTS $CLUSTER_ID
+sh health-publisher.sh $MEMBER_ID $CEP_IP $CEP_PORT $PORTS $CLUSTER_ID 
$NETWORK_PARTITION_ID
 echo "Health stat published" | tee -a $LOG
 popd
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/36d0c28d/products/cartridge-agent/modules/health-stats/src/main/bin/health-publisher.sh
----------------------------------------------------------------------
diff --git 
a/products/cartridge-agent/modules/health-stats/src/main/bin/health-publisher.sh
 
b/products/cartridge-agent/modules/health-stats/src/main/bin/health-publisher.sh
index 9163ede..ab115e6 100755
--- 
a/products/cartridge-agent/modules/health-stats/src/main/bin/health-publisher.sh
+++ 
b/products/cartridge-agent/modules/health-stats/src/main/bin/health-publisher.sh
@@ -28,7 +28,7 @@ 
class_path=${lib_path}andes-client-0.13.wso2v8.jar:${lib_path}ant-1.7.0.jar:${li
 
 current_path=`pwd`
 
-java -cp $class_path -Dmember.id=$1 
-Dkey.file.path=$current_path/../security/client-truststore.jks 
-Dthrift.receiver.ip=$2 -Dthrift.receiver.port=$3 -Dopen.ports=$4 
-Dcluster.id=$5 -Dpartition.id=$6 
org.apache.stratos.cartridge.agent.health.publisher.Main $*
+java -cp $class_path -Dmember.id=$1 
-Dkey.file.path=$current_path/../security/client-truststore.jks 
-Dthrift.receiver.ip=$2 -Dthrift.receiver.port=$3 -Dopen.ports=$4 
-Dcluster.id=$5 -Dnetwork.partition.id=$6 
org.apache.stratos.cartridge.agent.health.publisher.Main $*
 
 echo "Health publisher completed"
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/36d0c28d/products/cartridge-agent/modules/health-stats/src/main/java/org/apache/stratos/cartridge/agent/health/publisher/HealthPublisher.java
----------------------------------------------------------------------
diff --git 
a/products/cartridge-agent/modules/health-stats/src/main/java/org/apache/stratos/cartridge/agent/health/publisher/HealthPublisher.java
 
b/products/cartridge-agent/modules/health-stats/src/main/java/org/apache/stratos/cartridge/agent/health/publisher/HealthPublisher.java
index 096004f..fa4c519 100644
--- 
a/products/cartridge-agent/modules/health-stats/src/main/java/org/apache/stratos/cartridge/agent/health/publisher/HealthPublisher.java
+++ 
b/products/cartridge-agent/modules/health-stats/src/main/java/org/apache/stratos/cartridge/agent/health/publisher/HealthPublisher.java
@@ -64,7 +64,7 @@ public class HealthPublisher implements Observer {
                     " 'metaData':[]," +
                     " 'payloadData':[" +
                     " {'name':'cluster_id','type':'STRING'}," +
-                    " {'name':'partition_id','type':'STRING'}," +
+                    " {'name':'network_partition_id','type':'STRING'}," +
                     " {'name':'member_id','type':'STRING'}," +
                     " {'name':'health_description','type':'STRING'}," +
                     " {'name':'value','type':'DOUBLE'}" +
@@ -96,12 +96,21 @@ public class HealthPublisher implements Observer {
     private void publishEvents(Map<String, Double> stats) {
 
         String memberID = System.getProperty("member.id");
+        if(memberID == null) {
+            throw new RuntimeException("member.id system property was not 
found");
+        }
         String clusterID = System.getProperty("cluster.id");
-        String partitionId = System.getProperty("partition.id");
+        if(clusterID == null) {
+            throw new RuntimeException("cluster.id system property was not 
found");
+        }
+        String networkPartitionId = System.getProperty("network.partition.id");
+        if(networkPartitionId == null) {
+            throw new RuntimeException("network.partition.id system property 
was not found");
+        }
 
         for (Map.Entry<String, Double> entry : stats.entrySet()) {
 
-            Object[] payload = new 
Object[]{clusterID,partitionId,memberID,entry.getKey(), entry.getValue()};
+            Object[] payload = new 
Object[]{clusterID,networkPartitionId,memberID,entry.getKey(), 
entry.getValue()};
             Event event = eventObject(null, null, payload, new HashMap<String, 
String>());
             try {
                 asyncDataPublisher.publish(DATA_STREAM_NAME, VERSION, event);

Reply via email to