From 9dc0a921855cc372a60a34553c93d41df811309c Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 26 Apr 2023 11:33:49 -0500 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 2e775324..607af7a3 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -159,6 +159,8 @@ STATUS(){ DIVIDER; echo -e "${idsST[Reset]}" fi for nip in "${!var}"; do + [ "${ST_ACTION}" != "check" ] && echo -en " ${idsST[Bold]}${idsCL[LightCyan]}${NM_NODETYPES[$NTYPE]}-Node${nid} (${nip})${idsST[Reset]}" + if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD=''; LH='- localhost' else NCMD="ssh root@${nip}"; LH='' fi @@ -167,13 +169,13 @@ STATUS(){ fi if [ "${checkhost}" != "false" ]; then if [ "${ST_ACTION}" != "check" ]; then - echo -en " ${idsST[Bold]}${idsCL[LightCyan]}${NM_NODETYPES[$NTYPE]}-Node${nid} (${nip})${idsST[Reset]}" + #echo -en " ${idsST[Bold]}${idsCL[LightCyan]}${NM_NODETYPES[$NTYPE]}-Node${nid} (${nip})${idsST[Reset]}" if [ "${ST_ACTION}" = "report" ] && [ "${2}" = "email" ]; then uptime=`${NCMD} uptime -p` elif [ "${ST_ACTION}" != "report" ]; then uptime=`${NCMD} uptime -p` fi - echo -e"${idsCL[LightCyan]} - ${uptime} ${idsCL[LightYello]}${LH}${idsCL[Default]}" + echo -e "${idsCL[LightCyan]} - ${uptime} ${idsCL[LightYello]}${LH}${idsCL[Default]}" DIVIDER false green fi if [ -f ${FOLDER}/${nip}.down ]; then @@ -350,14 +352,14 @@ STATUS(){ fi if [ "${ST_ACTION}" != "check" ]; then toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.errtime) - echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_NODETYPES[$NTYPE]}-Node${nid} (${nip})${idsST[Reset]}${idsCL[Red]} - Node is down!${idsCL[Default]}" + echo -e "${idsCL[Red]} - Node is down!${idsCL[Default]}" fi SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}" "${NM_NODETYPES[$NTYPE]}-Node${nid} is down" 1 echo "$(date) - ${nip} - ${NM_NODETYPES[$NTYPE]}-Node${nid} - Node is down" >> ${LOGFILE} else if [ "${ST_ACTION}" != "check" ]; then toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.errtime) - echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_NODETYPES[$NTYPE]}-Node${nid} (${nip})${idsST[Reset]}${idsCL[Red]} - Node has been down for $(SHOW_TIME ${toterrtime}) ${idsCL[LightYello]}${LH}${idsCL[Default]}" + echo -e "${idsCL[Red]} - Node has been down for $(SHOW_TIME ${toterrtime}) ${idsCL[LightYello]}${LH}${idsCL[Default]}" fi errtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.down) # if [ $errtime -gt ${RENOTIFY} ] && [ "${EMAIL_NOTICE}" != "" ]; then