
mkdir -p ./logs/Transwarp-ArgoDB

thisdate=`date +%m-%d-%H:%M:%S.%2N`
echo "Collect Transwarp ArgoDB config for all nodes start at: ${thisdate}"

#Command used to print Hadoop Configuration to hadoop_configuration.txt
hadoop org.apache.hadoop.conf.Configuration > ./logs/Transwarp-ArgoDB/hadoop_configuration.txt

#All Process on each node out of containers
pdsh -w tpcds[1-16] "jps" > ./logs/Transwarp-ArgoDB/Process_Running_on_Each_Node.txt

# Collect all services in containers
sh ./get-pods.sh > ./logs/Transwarp-ArgoDB/pods.txt
thisdate=`date +%m-%d-%H:%M:%S.%2N`
echo "Collect hadoop config end at: ${thisdate}"

# Collect detail config for each node
loop_id=1
while [ $loop_id -le 16 ]
do

  mkdir -p ./logs/Transwarp-ArgoDB/tpcds${loop_id}
  mkdir -p ./logs/Transwarp-ArgoDB/tpcds${loop_id}/hadoop
  mkdir -p ./logs/Transwarp-ArgoDB/tpcds${loop_id}/argodbcomputing1
  mkdir -p ./logs/Transwarp-ArgoDB/tpcds${loop_id}/argodbstorage1

  scp root@tpcds${loop_id}:/etc/hdfs1/conf/*.* ./logs/Transwarp-ArgoDB/tpcds${loop_id}/hadoop/
  scp root@tpcds${loop_id}:/etc/argodbcomputing1/conf/*.* ./logs/Transwarp-ArgoDB/tpcds${loop_id}/argodbcomputing1/
  scp root@tpcds${loop_id}:/etc/argodbstorage1/conf/*.* ./logs/Transwarp-ArgoDB/tpcds${loop_id}/argodbstorage1/

  thisdate=`date +%m-%d-%H:%M:%S.%2N`
  echo "Collect hdfs and argodbcomputing1 config for tpcds${loop_id} at: ${thisdate}"

  ((loop_id++))
done

# options to run query
cp config ./logs/Transwarp-ArgoDB/

thisdate=`date +%m-%d-%H:%M:%S.%2N`
echo "Collect Transwarp ArgoDB config for all nodes end at: ${thisdate}"


cp collect_Transwarp_ArgoDB_Configs.sh ./logs/Transwarp-ArgoDB/

