diff --git a/inc/status.inc b/inc/status.inc index 78fcb8f1..53a9c715 100755 --- a/inc/status.inc +++ b/inc/status.inc @@ -211,7 +211,7 @@ STATUS(){ SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}" "${NM_SERVICES[${srvc}]} is down" 1 # ([ "${srvc}" == "mysql" ] || [ "${srvc}" == "mariadb" ]) && ${NCMD} systemctl restart ${srvc} & - elif [ $errtime -gt 60 ] && [ $errtime -lt 180 ]; then + elif [ $errtime -gt 60 ] && [ $errtime -lt 180 ] && [ ! -f ${TMPFOLDER}/${nip}~${srvc}.errtime ]; then SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}" "${NM_SERVICES[${srvc}]} is down" 1 fi @@ -404,12 +404,15 @@ STATUS(){ # 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 + toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.errtime) + errtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.down) if [ "${ST_ACTION}" != "check" ]; then - toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.errtime) echo -e "${idsCL[Red]} - Node has been down for $(SHOW_TIME ${toterrtime}) ${idsCL[LightYello]}${LH}${idsCL[Default]}" fi - errtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.down) - if [ $errtime -gt 60 ] && [ $errtime -lt 180 ]; then + if [ $errtime -gt ${RENOTIFY} ]; then + touch ${TMPFOLDER}/${nip}.down + SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}" "${NM_NODETYPES[$NTYPE]}-Node${nid} has been down for $(SHOW_TIME ${toterrtime})" 1 + elif [ $errtime -gt 60 ] && [ $errtime -lt 180 ] && [ ! -f ${TMPFOLDER}/${nip}.errtime ]; then SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}" "${NM_NODETYPES[$NTYPE]}-Node${nid} is down" 1 fi # if [ $errtime -gt ${RENOTIFY} ] && [ "${EMAIL_NOTICE}" != "" ]; then