2008-08-14 20:22:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#get IP address of MS
|
2008-11-07 14:00:45 +00:00
|
|
|
OS=`uname`
|
|
|
|
echo "the OS is $OS"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.info "the OS is $OS"
|
2008-08-14 20:22:59 +00:00
|
|
|
ms_ip=$MONMASTER
|
2010-04-06 08:17:04 +00:00
|
|
|
echo "MS IP is $ms_ip"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.info "the MS is $ms_ip"
|
2008-08-14 20:22:59 +00:00
|
|
|
result=`ping -c1 $MONMASTER 2>&1`
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
index1=`expr index "$result" "\("`
|
|
|
|
index2=`expr index "$result" "\)"`
|
|
|
|
#ms_ip=${result:$index1+1:$index2-$index1-2}
|
|
|
|
pos=`expr $index1 + 1`
|
|
|
|
length=`expr $index2 - $index1`
|
|
|
|
length=`expr $length - 1`
|
|
|
|
ms_ip=`expr substr "$result" $pos $length`
|
|
|
|
echo final is $ms_ip
|
|
|
|
else
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.info "Gangliamon setup"
|
2008-08-14 20:22:59 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
CLUSTER=\"$MONSERVER\"
|
2008-11-07 14:00:45 +00:00
|
|
|
echo "cluster is $CLUSTER"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.info "cluster is $CLUSTER"
|
2008-08-14 20:22:59 +00:00
|
|
|
MASTER=$ms_ip
|
|
|
|
#echo "The new IP is: $NEW_IP"
|
|
|
|
#echo "I will replace now....
|
2008-09-03 19:00:10 +00:00
|
|
|
gmond_conf="/etc/ganglia/gmond.conf"
|
|
|
|
gmond_conf_old="/etc/gmond.conf"
|
2008-08-14 20:22:59 +00:00
|
|
|
|
2008-11-07 14:00:45 +00:00
|
|
|
if [ $OS == "AIX" ]; then
|
|
|
|
echo "into AIX loop"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.info "into AIX loop"
|
2008-11-07 14:00:45 +00:00
|
|
|
if [ -f $gmond_conf_old ]; then
|
|
|
|
echo "ganglia version 3.0.7"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.info "ganglia version 3.0.7"
|
2008-11-07 14:00:45 +00:00
|
|
|
grep "xCAT gmond settings done" $gmond_conf_old
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
/bin/cp -f $gmond_conf_old /etc/gmond.conf.orig
|
|
|
|
sed -e "s/setuid = yes/setuid = no/1" $gmond_conf_old > /etc/gmond.conf1
|
|
|
|
sed -e 's/name = "unspecified"/name='$CLUSTER'/1' /etc/gmond.conf1 > /etc/gmond.conf2
|
|
|
|
sed -e "1,40s/mcast_join = .*/host = $MASTER/" /etc/gmond.conf2 > /etc/gmond.conf3
|
|
|
|
sed -e 's/mcast_join/#/g' /etc/gmond.conf3 > /etc/gmond.conf4
|
|
|
|
sed -e "s/bind/#/g" /etc/gmond.conf4 > /etc/gmond.conf5
|
|
|
|
/bin/cp -f /etc/gmond.conf5 $gmond_conf_old
|
|
|
|
rm -f /etc/gmond.conf1 /etc/gmond.conf2 /etc/gmond.conf3 /etc/gmond.conf4 /etc/gmond.conf5
|
|
|
|
echo "# xCAT gmond settings done sh" >> $gmond_conf_old
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ $OS == "AIX" ]; then
|
|
|
|
echo "into AIX new loop"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.info "into AIX new loop"
|
2008-11-07 14:00:45 +00:00
|
|
|
if [ -f $gmond_conf ]; then
|
|
|
|
echo "ganglia version v3.10"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.info "ganglia version v3.10"
|
2008-11-07 14:00:45 +00:00
|
|
|
grep "xCAT gmond settings done" $gmond_conf
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
/bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig
|
|
|
|
sed -e "s/setuid = yes/setuid = no/1" $gmond_conf > /etc/ganglia/gmond.conf1
|
|
|
|
sed -e 's/name = "unspecified"/name='$CLUSTER'/1' /etc/ganglia/gmond.conf1 > /etc/ganglia/gmond.conf2
|
|
|
|
sed -e "1,40s/mcast_join = .*/host = $MASTER/" /etc/ganglia/gmond.conf2 > /etc/ganglia/gmond.conf3
|
|
|
|
sed -e 's/mcast_join/#/g' /etc/ganglia/gmond.conf3 > /etc/ganglia/gmond.conf4
|
|
|
|
sed -e "s/bind/#/g" /etc/ganglia/gmond.conf4 > /etc/ganglia/gmond.conf5
|
|
|
|
/bin/cp -f /etc/ganglia/gmond.conf5 $gmond_conf
|
|
|
|
rm -f /etc/ganglia/gmond.conf1 /etc/ganglia/gmond.conf2 /etc/ganglia/gmond.conf3 /etc/ganglia/gmond.conf4 /etc/ganglia/gmond.conf5
|
|
|
|
echo "# xCAT gmond settings done sh" >> $gmond_conf
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ $OS != "AIX" ]; then
|
|
|
|
echo "not AIX"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.info "not AIX"
|
2008-08-14 20:22:59 +00:00
|
|
|
if [ -f $gmond_conf ]; then
|
|
|
|
grep "xCAT gmond settings done" $gmond_conf
|
|
|
|
if [ $? -gt 0 ]; then
|
2008-09-03 19:00:10 +00:00
|
|
|
/bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig
|
2008-08-14 20:22:59 +00:00
|
|
|
sed -i 's/setuid = yes/setuid = no/1' $gmond_conf
|
|
|
|
sed -i 's/name = "unspecified"/name='$CLUSTER'/1' $gmond_conf
|
2014-08-18 14:05:09 +00:00
|
|
|
sed -e "1,50s/^ *mcast_join = .*/host = $MASTER/" $gmond_conf > /etc/temp.conf
|
2008-08-14 20:22:59 +00:00
|
|
|
/bin/cp -f /etc/temp.conf $gmond_conf
|
2014-08-18 14:05:09 +00:00
|
|
|
sed -i 's/^ *mcast_join/#mcast_join/g' $gmond_conf
|
|
|
|
sed -i 's/^ *bind/#bind/g' $gmond_conf
|
2008-08-14 20:22:59 +00:00
|
|
|
echo "# xCAT gmond settings done sh" >> $gmond_conf
|
|
|
|
fi
|
2008-11-07 14:00:45 +00:00
|
|
|
fi
|
2008-08-14 20:22:59 +00:00
|
|
|
fi
|
2008-09-03 19:00:10 +00:00
|
|
|
|
2008-11-07 14:00:45 +00:00
|
|
|
|
|
|
|
if [ $OS != "AIX" ]; then
|
|
|
|
echo "not AIX"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.info "not AIX"
|
2008-11-07 14:00:45 +00:00
|
|
|
|
2008-09-03 19:00:10 +00:00
|
|
|
if [ -f $gmond_conf_old ]; then
|
|
|
|
grep "xCAT gmond settings done" $gmond_conf_old
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
/bin/cp -f $gmond_conf_old /etc/gmond.conf.orig
|
|
|
|
sed -i 's/setuid = yes/setuid = no/1' $gmond_conf_old
|
|
|
|
sed -i 's/name = "unspecified"/name='$CLUSTER'/1' $gmond_conf_old
|
|
|
|
sed -e "1,40s/mcast_join = .*/host = $MASTER/" $gmond_conf_old > /etc/temp.conf
|
|
|
|
/bin/cp -f /etc/temp.conf $gmond_conf_old
|
|
|
|
sed -i 's/mcast_join/#/g' $gmond_conf_old
|
|
|
|
sed -i 's/bind/#/g' $gmond_conf_old
|
|
|
|
echo "# xCAT gmond settings done sh_old" >> $gmond_conf_old
|
|
|
|
fi
|
|
|
|
fi
|
2008-11-07 14:00:45 +00:00
|
|
|
fi
|
2008-08-14 20:22:59 +00:00
|
|
|
|
|
|
|
if [ ! -f $gmond_conf ]; then
|
|
|
|
# echo "file not found"
|
2010-04-06 08:17:04 +00:00
|
|
|
logger -t gmonfail "gmond configuration file not found"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.warning "gmond configuration file not found"
|
2008-08-14 20:22:59 +00:00
|
|
|
fi
|
|
|
|
|
2008-11-07 14:00:45 +00:00
|
|
|
if [ ! -f $gmond_conf_old ]; then
|
|
|
|
# echo "file not found"
|
|
|
|
logger -t gmonfail "gmond configuration file not found"
|
2012-05-15 07:13:23 +00:00
|
|
|
logger -t xCAT -p local4.warning "gmond configuration file not found"
|
2008-11-07 14:00:45 +00:00
|
|
|
fi
|
|
|
|
|
2008-08-14 20:22:59 +00:00
|
|
|
exit 0
|