Revert "Fix JVM monitoring scripts"
[integration/test.git] / csit / scripts / set_jvm_common_attribute.sh
index 52bd734f8c141d46d61fb2f4e8259fc8563b3b43..408910d943cac7e8e7b908fae71d7eb4bb06dc94 100644 (file)
@@ -18,45 +18,39 @@ EOF
 for i in `seq 1 ${NUM_ODL_SYSTEM}`
 do
     CONTROLLERIP=ODL_SYSTEM_${i}_IP
+    CLUSTERNAME=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 12`
 
     cat > ${WORKSPACE}/elasticsearch.yml <<EOF
-    cluster.name: elasticsearch
+    cluster.name: ${CLUSTERNAME}
     network.host: ${!CONTROLLERIP}
+    discovery.zen.ping.multicast.enabled: false
 
 EOF
     cat > ${WORKSPACE}/org.apache.karaf.decanter.appender.elasticsearch.cfg <<EOF
     host=${!CONTROLLERIP}
     port=9300
-    clusterName=elasticsearch
+    clusterName=${CLUSTERNAME}
 
 EOF
 
-    out='{"acknowledged":true}'
-    cmd='http://'${!CONTROLLERIP}':9200/_all'
-    command_='curl -XDELETE '${cmd}' 2> /dev/null'
-    command2='curl '${!CONTROLLERIP}':9200/_cat/indices?v'
-
     cat > ${WORKSPACE}/elasticsearch_startup.sh <<EOF
+    cd /tmp/elasticsearch/elasticsearch-1.7.5
+    ls -al
+
+    if [ -d "data" ]; then
+        echo "data directory exists, deleting...."
+        rm -r data
+    else
+        echo "data directory does not exist"
+    fi
+
     cd /tmp/elasticsearch
+    ls -al
+
     echo "Starting Elasticsearch node"
     sudo /tmp/elasticsearch/elasticsearch-1.7.5/bin/elasticsearch > /dev/null 2>&1 &
     ls -al /tmp/elasticsearch/elasticsearch-1.7.5/bin/elasticsearch
 
-    for ((i=1;i<=100;i++));
-    do
-        output=${command_};
-        outpu1=${command2};
-        echo $output1;
-        echo $output;
-        if [[ "$out" ==  "$output" ]];
-        then
-            echo "indices deleted";
-            break;
-        fi
-        echo "could not reach server, retrying";
-        sleep 2;
-    done;
-
 EOF
     echo "Setup ODL_SYSTEM_IP specific config files for ${!CONTROLLERIP} "
 
@@ -71,6 +65,9 @@ EOF
     scp ${WORKSPACE}/org.apache.karaf.decanter.collector.jmx-others.cfg ${!CONTROLLERIP}:/tmp/${BUNDLEFOLDER}/etc/
 
     scp ${WORKSPACE}/elasticsearch.yml ${!CONTROLLERIP}:/tmp/
+
+    ssh ${!CONTROLLERIP} "sudo ls -al /tmp/elasticsearch/"
+
     ssh ${!CONTROLLERIP} "sudo mv /tmp/elasticsearch.yml /tmp/elasticsearch/elasticsearch-1.7.5/config/"
     ssh ${!CONTROLLERIP} "cat /tmp/elasticsearch/elasticsearch-1.7.5/config/elasticsearch.yml"