2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-23 11:40:25 +00:00

Merge pull request #6436 from omula/fix_gmond

Fix gmond
This commit is contained in:
besawn
2019-10-24 16:39:16 -04:00
committed by GitHub
2 changed files with 39 additions and 115 deletions

View File

@@ -65,7 +65,7 @@ sub start {
if ($OS =~ /AIX/) {
$res_gmond = `/etc/rc.d/init.d/gmond restart 2>&1`;
} else {
$res_gmond = `/etc/init.d/gmond restart 2>&1`;
$res_gmond = `systemctl restart gmond 2>&1`;
}
my $tmp;
@@ -90,9 +90,9 @@ sub start {
$res_gmetad = `/etc/rc.d/init.d/gmetad restart 2>&1`;
}
} else {
$tmp = `/etc/init.d/gmetad status | grep running`;
$tmp = `systemctl status gmetad| grep running`;
if (!$tmp) {
$res_gmetad = `/etc/init.d/gmetad restart 2>&1`;
$res_gmetad = `systemctl restart gmetad 2>&1`;
}
}
@@ -166,7 +166,7 @@ sub start {
$result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/rc.d/init.d/gmond restart 2>&1`;
}
else {
$result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/init.d/gmond restart 2>&1`;
$result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec systemctl restart gmond 2>&1`;
}
}
@@ -787,7 +787,7 @@ sub stop {
if ($OS =~ /AIX/) {
$res_gmond = `/etc/rc.d/init.d/gmond stop 2>&1`;
} else {
$res_gmond = `/etc/init.d/gmond stop 2>&1`;
$res_gmond = `systemctl stop gmond 2>&1`;
}
if ($?) {
if ($callback) {
@@ -805,7 +805,7 @@ sub stop {
if ($OS =~ /AIX/) {
$res_gmetad = `/etc/rc.d/init.d/gmetad stop 2>&1`;
} else {
$res_gmetad = `/etc/init.d/gmetad stop 2>&1`;
$res_gmetad = `systemctl stop gmetad 2>&1`;
}
if ($?) {
@@ -867,7 +867,7 @@ sub stop {
if ($OS =~ /AIX/) {
$result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/rc.d/init.d/gmond stop 2>&1`;
} else {
$result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/init.d/gmond stop 2>&1`;
$result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec systemctl stop gmond 2>&1`;
}
}

View File

@@ -1,24 +1,24 @@
#!/bin/sh
#get IP address of MS
OS=`uname`
OS=$(uname)
echo "the OS is $OS"
logger -t xcat -p local4.info "the OS is $OS"
ms_ip=$MONMASTER
echo "MS IP is $ms_ip"
logger -t xcat -p local4.info "the MS is $ms_ip"
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
logger -t xcat -p local4.info "Gangliamon setup"
fi
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
logger -t xcat -p local4.info "Gangliamon setup"
fi
CLUSTER=\"$MONSERVER\"
echo "cluster is $CLUSTER"
@@ -26,102 +26,26 @@ logger -t xcat -p local4.info "cluster is $CLUSTER"
MASTER=$ms_ip
#echo "The new IP is: $NEW_IP"
#echo "I will replace now....
gmond_conf="/etc/ganglia/gmond.conf"
gmond_conf_old="/etc/gmond.conf"
gmond_conf=$(gmond --help|grep -Eo "[a-z/]+/gmond.conf")
gmond_version=$(gmond -V|cut -d" " -f2)
if [ $OS == "AIX" ]; then
echo "into AIX loop"
logger -t xcat -p local4.info "into AIX loop"
if [ -f $gmond_conf_old ]; then
echo "ganglia version 3.0.7"
logger -t xcat -p local4.info "ganglia version 3.0.7"
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"
logger -t xcat -p local4.info "into AIX new loop"
if [ -f $gmond_conf ]; then
echo "ganglia version v3.10"
logger -t xcat -p local4.info "ganglia version v3.10"
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"
logger -t xcat -p local4.info "not AIX"
if [ -f $gmond_conf ]; then
grep "xCAT gmond settings done" $gmond_conf
if [ $? -gt 0 ]; then
/bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig
sed -i 's/setuid = yes/setuid = no/1' $gmond_conf
sed -i 's/name = "unspecified"/name='$CLUSTER'/1' $gmond_conf
sed -e "1,50s/^ *mcast_join = .*/host = $MASTER/" $gmond_conf > /etc/temp.conf
/bin/cp -f /etc/temp.conf $gmond_conf
sed -i 's/^ *mcast_join/#mcast_join/g' $gmond_conf
sed -i 's/^ *bind/#bind/g' $gmond_conf
echo "# xCAT gmond settings done sh" >> $gmond_conf
fi
fi
fi
if [ $OS != "AIX" ]; then
echo "not AIX"
logger -t xcat -p local4.info "not AIX"
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
if [ ! -f $gmond_conf ]; then
# echo "file not found"
logger -t xcat -p local4.warning "gmond configuration file not found. Generating a default one"
gmond -t > ${gmond_conf}
fi
if [ ! -f $gmond_conf ]; then
# echo "file not found"
logger -t xcat -p local4.warning "gmond configuration file not found"
fi
if [ ! -f $gmond_conf_old ]; then
# echo "file not found"
logger -t xcat -p local4.warning "gmond configuration file not found"
fi
echo "ganglia version ${gmond_version}"
logger -t xcat -p local4.info "ganglia version ${gmond_version}"
grep "xCAT gmond settings done" $gmond_conf
if [ $? -gt 0 ]; then
/bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig
sed -i -e "s/setuid = yes/setuid = no/1" ${gmond_conf}
sed -i -e 's/name = "unspecified"/name='$CLUSTER'/1' ${gmond_conf}
sed -i -e "1,40s/mcast_join = .*/host = $MASTER/" ${gmond_conf}
sed -i -e '/mcast_join/d' ${gmond_conf}
sed -i -e "/\s\+bind/d" ${gmond_conf}
echo "# xCAT gmond settings done sh" >> $gmond_conf
fi
exit 0