diff --git a/inc/status.inc b/inc/status.inc index 2fd406e1..b3ea2389 100755 --- a/inc/status.inc +++ b/inc/status.inc @@ -417,10 +417,20 @@ STATUS(){ [ "${checkhostssl}" != "ok" ] && echo "$(date +%Y-%m-%d-%H-%M-%S) - ${nip} - ${NM_HOSTNAMES[${nip}]}[${nip}] - Node is down" >> ${NM_LOGFILE} else if [ ! -f ${NM_TMPFOLDER}/${nip}.errtime ]; then - tmp=tmp + mv touch ${NM_TMPFOLDER}/${nip}.down touch ${NM_TMPFOLDER}/${nip}.errtime + toterrtime=$(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}.errtime)) + errtime=${toterrtime} + if [ "${checkhost}" != "false" ]; then + SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}]" "${NM_HOSTNAMES[${nip}]}[${nip}] is online, but SSL is down" 1 + else + SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}]" "${NM_HOSTNAMES[${nip}]}[${nip}] is down" 1 + fi + touch ${NM_TMPFOLDER}/${nip}.sent + else + toterrtime=$(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}.errtime)) + errtime=$(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}.down)) fi - toterrtime=$(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}.errtime)) - errtime=$(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}.down)) + if [ "${ST_ACTION}" != "check" ]; then if [ "${checkhost}" != "false" ]; then echo -e "${idsCL[Red]} - Node SSL has been down for $(SHOW_TIME ${toterrtime}) ${idsCL[LightYellow]}${LH}${idsCL[Default]}" @@ -428,20 +438,13 @@ STATUS(){ echo -e "${idsCL[Red]} - Node has been down for $(SHOW_TIME ${toterrtime}) ${idsCL[LightYellow]}${LH}${idsCL[Default]}" fi fi - if [ ${errtime} -gt ${NM_RENOTIFY_TIMEOUT} ]; then + if [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}.sent)) -gt ${NM_RENOTIFY_TIMEOUT} ]; then if [ "${checkhost}" != "false" ]; then SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}]" "${NM_HOSTNAMES[${nip}]}[${nip}] SSL has been down for $(SHOW_TIME ${toterrtime})" 1 else SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}]" "${NM_HOSTNAMES[${nip}]}[${nip}] has been down for $(SHOW_TIME ${toterrtime})" 1 fi touch ${NM_TMPFOLDER}/${nip}.sent - elif [ ${errtime} -gt 60 ] && [ ${errtime} -lt 240 ] && [ ! -f ${NM_TMPFOLDER}/${nip}.errtime ]; then - if [ "${checkhost}" != "false" ]; then - SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}]" "${NM_HOSTNAMES[${nip}]}[${nip}] is online, but SSL is down" 1 - else - SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}]" "${NM_HOSTNAMES[${nip}]}[${nip}] is down" 1 - fi - touch ${NM_TMPFOLDER}/${nip}.sent fi touch ${NM_TMPFOLDER}/${nip}.down fi