Update nodemgmt-scripts.sh
This commit is contained in:
@@ -159,6 +159,8 @@ STATUS(){
|
|||||||
DIVIDER; echo -e "${idsST[Reset]}"
|
DIVIDER; echo -e "${idsST[Reset]}"
|
||||||
fi
|
fi
|
||||||
for nip in "${!var}"; do
|
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'
|
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=''
|
else NCMD="ssh root@${nip}"; LH=''
|
||||||
fi
|
fi
|
||||||
@@ -167,13 +169,13 @@ STATUS(){
|
|||||||
fi
|
fi
|
||||||
if [ "${checkhost}" != "false" ]; then
|
if [ "${checkhost}" != "false" ]; then
|
||||||
if [ "${ST_ACTION}" != "check" ]; 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
|
if [ "${ST_ACTION}" = "report" ] && [ "${2}" = "email" ]; then
|
||||||
uptime=`${NCMD} uptime -p`
|
uptime=`${NCMD} uptime -p`
|
||||||
elif [ "${ST_ACTION}" != "report" ]; then
|
elif [ "${ST_ACTION}" != "report" ]; then
|
||||||
uptime=`${NCMD} uptime -p`
|
uptime=`${NCMD} uptime -p`
|
||||||
fi
|
fi
|
||||||
echo -e"${idsCL[LightCyan]} - ${uptime} ${idsCL[LightYello]}${LH}${idsCL[Default]}"
|
echo -e "${idsCL[LightCyan]} - ${uptime} ${idsCL[LightYello]}${LH}${idsCL[Default]}"
|
||||||
DIVIDER false green
|
DIVIDER false green
|
||||||
fi
|
fi
|
||||||
if [ -f ${FOLDER}/${nip}.down ]; then
|
if [ -f ${FOLDER}/${nip}.down ]; then
|
||||||
@@ -350,14 +352,14 @@ STATUS(){
|
|||||||
fi
|
fi
|
||||||
if [ "${ST_ACTION}" != "check" ]; then
|
if [ "${ST_ACTION}" != "check" ]; then
|
||||||
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.errtime)
|
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
|
fi
|
||||||
SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}" "${NM_NODETYPES[$NTYPE]}-Node${nid} is down" 1
|
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}
|
echo "$(date) - ${nip} - ${NM_NODETYPES[$NTYPE]}-Node${nid} - Node is down" >> ${LOGFILE}
|
||||||
else
|
else
|
||||||
if [ "${ST_ACTION}" != "check" ]; then
|
if [ "${ST_ACTION}" != "check" ]; then
|
||||||
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.errtime)
|
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
|
fi
|
||||||
errtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.down)
|
errtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.down)
|
||||||
# if [ $errtime -gt ${RENOTIFY} ] && [ "${EMAIL_NOTICE}" != "" ]; then
|
# if [ $errtime -gt ${RENOTIFY} ] && [ "${EMAIL_NOTICE}" != "" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user