From ffebfd732d5fc0db7c5b9931527342716ebb215f Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 30 Apr 2024 18:48:53 -0500 Subject: [PATCH] update --- defaults.inc | 2 +- inc/temp.inc.sh | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/defaults.inc b/defaults.inc index 8c4c2804..711e0d2a 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS='2.7.22-04282024' +VERS='2.7.24-04302024' noheader=' update service dailytemp confsync -r -report ' diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index 43c41a89..44c6b37f 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -942,10 +942,15 @@ Previous Temp: ${last_temp}${GAUGESH}" [ $(bc -l <<< "${temp_diff} < 0") -eq 1 ] && temp_diff=`echo "scale=2; ${temp_diff}*-1" | bc` if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then - # [[ "${SENSOR}" = *"${PW_SHUTDOWN_SENSORS}"* ]] && touch ${PW_TMPFOLDER}/temp.warn touch ${PW_TMPFOLDER}/temp.warn.${SENSOR} - if (( $(bc <<< "${temp_diff} >= 1") )); then + + if [ ! -f ${PW_TMPFOLDER}/temp.warn.${SENSOR}.pre ]; then + touch ${PW_TMPFOLDER}/temp.warn.${SENSOR}.pre + + elif [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/temp.warn.${SENSOR}.pre)) -ge 120 ]; then + # if (( $(bc <<< "${temp_diff} >= 1") )); then + touch ${PW_TMPFOLDER}/temp.warn.${SENSOR}.pre SENDNOTICE "${SENSOR} ${GAUGE} WARNING" "WARNING ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 1 if [ "${last_temp}" != "${temp_f}" ]; then last_temp=${temp_f} @@ -957,7 +962,12 @@ Previous Temp: ${last_temp}${GAUGESH}" elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit_sys}") -eq 1 ]; then - if (( $(bc <<< "${temp_diff} >= 1") )); then + if [ ! -f ${PW_TMPFOLDER}/temp.crit.${SENSOR}.pre ]; then + touch ${PW_TMPFOLDER}/temp.crit.${SENSOR}.pre + + elif [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/temp.crit.${SENSOR}.pre)) -ge 120 ]; then + # if (( $(bc <<< "${temp_diff} >= 1") )); then + touch ${PW_TMPFOLDER}/temp.crit.${SENSOR}.pre SENDNOTICE "${SENSOR} ${GAUGE} CRITICAL" "CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 1 echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - CRITICAL - (Difference of ${temp_diff}${GAUGESH})" >> ${logtemp} echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} - ${temp_f}${GAUGESH} - CRITICAL ${GAUGE} - (Difference of ${temp_diff}${GAUGESH})" >> ${PW_LOGFILE} @@ -979,7 +989,12 @@ Previous Temp: ${last_temp}${GAUGESH}" fi fi elif [ $(bc -l <<< "${temp_f} >= ${temp_crit_sys}") -eq 1 ]; then - if (( $(bc <<< "${temp_diff} >= 1") )); then + if [ ! -f ${PW_TMPFOLDER}/temp.critsys.${SENSOR}.pre ]; then + touch ${PW_TMPFOLDER}/temp.critsys.${SENSOR}.pre + + elif [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/temp.critsys.${SENSOR}.pre)) -ge 120 ]; then + # if (( $(bc <<< "${temp_diff} >= 1") )); then + touch ${PW_TMPFOLDER}/temp.critsys.${SENSOR}.pre SENDNOTICE "${SENSOR} TEMP CRITICAL" "SYSTEM CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 1 echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - SYSTEM CRITICAL - (Difference of ${temp_diff})" >> ${logtemp} echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - ${SENSOR} - CRITICAL ${GAUGE} SYSTEM - (Difference of ${temp_diff}${GAUGESH})" >> ${PW_LOGFILE}