Update nodemgmt-scripts.sh

This commit is contained in:
2019-01-29 15:45:56 -06:00
parent 9f70e61abc
commit 00784c8241

View File

@@ -139,6 +139,35 @@ case "$1" in
echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
echo ""
;;
status-check)
nid=1
for nip in "${NODE_HOSTS[@]}"
do
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
nip='localhost'
NCMD=''
else
NCMD="ssh root@${nip}"
fi
for srvc in "${NODE_SERVICES[@]}"
do
if [ "${srvc}" = "mysql" ]; then SER='MySQL: '
elif [ "${srvc}" = "nginx" ]; then SER='NGINX: '
elif [ "${srvc}" = "gogs" ]; then SER='Gogs: '
elif [ "${srvc}" = "gitea" ]; then SER='Gitea: '
elif [ "${srvc}" = "haproxy" ]; then SER='HAProxy:'
elif [ "${srvc}" = "keepalived" ]; then SER='Keepalived:'
elif [ "${srvc}" = "maxscale" ]; then SER='MaxScale:'
else SER="${2}"
fi
if [ $(${NCMD} pgrep ${srvc} | wc -l) -lt "1" ]; then
echo "${SER} is down" | mail -s "iDS-Node${nid}-${nip}" 9208839613@vtext.com
fi
done
nid=`expr $nid + 1`
done
;;
set-permissions)
nid=1