Update nodemgmt-scripts.sh

This commit is contained in:
2019-01-29 23:50:36 -06:00
parent 94891ec066
commit bde9fea75f

View File

@@ -148,20 +148,19 @@ case "$1" in
fi fi
done done
fi fi
echo "HERE: ${2}"
if [ -z ${LOCAL_SERVICES+x} ] || [ "${2}" = "all" ]; then if [ -z ${LOCAL_SERVICES+x} ] || [ "${2}" = "all" ]; then
nid=1 nid=1
for nip in "${HOSTS2[@]}" for nip in "${NODE_HOSTS[@]}"
do do
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD='' if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD=''
else NCMD="ssh root@${nip}" else NCMD="ssh root@${nip}"
fi fi
for srvc in "${SERVICES2[@]}" for srvc in "${NODE_SERVICES[@]}"
do do
echo "${nip} - checking ${srvc}" echo "${nip} - checking ${srvc}"
if [ $(${NCMD} pgrep ${srvc} | wc -l) -lt "1" ]; then if [ $(${NCMD} pgrep ${srvc} | wc -l) -lt "1" ]; then
echo "${NM_SERVICES[${srvc}]} is down" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL} echo "${NM_SERVICES[${srvc}]} is down" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL}
fi fi
done done
nid=`expr $nid + 1` nid=`expr $nid + 1`
done done