Thursday, September 6, 2012

Shell Script for finding Temperature of Exadata Cell Servers and DB nodes

Exadata Servers contain both Cell Storage Servers and DB nodes. At times it is difficult to go and find the temperature by logging in each and every server.

Below is the script for finding out Server Temperature.

/tmp/consol_list --- contains the old temperature details , so we delete and first itself.
/var/tmp/dont_del_hosts ---- contains the servers for which we need to find temperatures.
The newserver is the DB node for which we are going to find the temp.
and
script_file is the file which contains the exact code for finding temperature of cell steorge servers. Pl find the code below for that.
################################################################################################
rm  /tmp/consol_list
for i in `cat /var/tmp/dont_del_hosts`
do
ssh root@$i < script_file  2>1
scp root@$i:/tmp/average_file /tmp/ 2>1
cat /tmp/average_file >> /tmp/consol_list
done
newserver=`ssh -t root@x.x.x.x "dcli -g all_group -l root "ipmitool sensor list | grep "degrees" | grep " T_AMB" | grep "db0" | cut -d '|' -f 2 | head -1`
echo "Average Temperature of  DBnode 1 is $newserver" >> /tmp/consol_list
mailx -s " TEMPERATURE DETAILS " jegan.ramachandran@gmail.com < /tmp/consol_list
#####################################################################################

Script_file

===================================================================
`cellcli << EOF
spool /tmp/txt_file
list metrichistory where objectType = 'CELL' and name = 'CL_TEMP'
EOF` 2>1
cd /tmp
cat txt_file | cut -d ' ' -f 4 > /tmp/txt1
sum=`awk '{ sum += $1 } END { print sum }' txt1`
line_count=`cat /tmp/txt1 | wc -l`
average=`expr $sum / $line_count`
echo "Average Temp for `hostname` is   $average" > /tmp/average_file
===============================================================

Thanks and Regards
JeganR

No comments:

Post a Comment