Update nodemgmt-scripts.sh

This commit is contained in:
2019-01-29 23:47:51 -06:00
parent 398ce044c0
commit 36cfe3cd6b

View File

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