From 45e656ca50908e39f2ac95f1fd2938f60bddf572 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 28 May 2023 12:53:15 -0500 Subject: [PATCH] Update status.inc --- inc/status.inc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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