
mkdir -p ./logs/OperatingSystem

thisdate=`date +%m-%d-%H:%M:%S.%2N`
echo "Collect system config for each node start at: ${thisdate}"
# Collect detail config for each node
loop_id=1
while [ $loop_id -le 16 ]
do

  mkdir -p ./logs/OperatingSystem/tpcds${loop_id}

  # get cpu info
  pdsh -w tpcds${loop_id} "cat /proc/cpuinfo " > ./logs/OperatingSystem/tpcds${loop_id}/cpu_info.out
  # get mem info
  pdsh -w tpcds${loop_id} "free -g " > ./logs/OperatingSystem/tpcds${loop_id}/memory.out
  # get disk info
  pdsh -w tpcds${loop_id} "df " > ./logs/OperatingSystem/tpcds${loop_id}/disk_status.out
  # get network info
  pdsh -w tpcds${loop_id} "ip address " > ./logs/OperatingSystem/tpcds${loop_id}/ifconfig.out
  # get bashrc
  pdsh -w tpcds${loop_id} "cat /root/.bashrc" > ./logs/OperatingSystem/tpcds${loop_id}/bashrc.out

  # get hosts
  scp root@tpcds${loop_id}:/etc/hosts ./logs/OperatingSystem/tpcds${loop_id}/

  # get limits 
  scp root@tpcds${loop_id}:/etc/security/limits.conf ./logs/OperatingSystem/tpcds${loop_id}/

  thisdate=`date +%m-%d-%H:%M:%S.%2N`
  echo "Collect system config for tpcds${loop_id} at: ${thisdate}"
  ((loop_id++))
done


thisdate=`date +%m-%d-%H:%M:%S.%2N`
echo "Collect system config for each node end at: ${thisdate}"

cp collect_System_Configs.sh ./logs/OperatingSystem/

