Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-08 00:15:05 -06:00
parent 0c8f515e83
commit 1f57455f67

View File

@@ -144,15 +144,28 @@ STATUS(){
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
fi
if [ -f ${FOLDER}/${nip}-${srvc}.down ]; then
echo "${NM_SERVICES[${srvc}]} is back UP!" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL}
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}-${srvc}.errtime)
echo "${NM_SERVICES[${srvc}]} is back UP! It was down for $(SHOW_TIME ${toterrtime})" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL}
rm -f ${FOLDER}/${nip}-${srvc}.down
rm -f ${FOLDER}/${nip}-${srvc}.errtime
fi
fi
done
else
if [ "${ST_ACTION}" != "check" ]; then
echo -e "${idsCL[Red]}Node is Down!${idsCL[Default]}"
errtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.down)
if [ $errtime -gt ${RENOTIFY} ]; then
if [ ! -f ${FOLDER}/${nip}.errtime ]; then
mv ${FOLDER}/${nip}.down ${FOLDER}/${nip}.errtime
fi
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.errtime)
if [ "${ST_ACTION}" != "check" ]; then
echo -e "${idsCL[Red]}Node has been down for $(SHOW_TIME ${toterrtime})${idsCL[Default]}"
fi
echo "iDS-Node${nid} has been down for $(SHOW_TIME ${toterrtime})" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL}
else
if [ "${ST_ACTION}" != "check" ]; then
echo -e "${idsCL[Red]}Node is Down!${idsCL[Default]}"
fi
fi
touch ${FOLDER}/${nip}.down
fi