From 814fac4d25cafe81edea9cf4c2325bf001fc3dce Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 1 Jan 2024 12:16:54 -0600 Subject: [PATCH] update --- defaults.inc | 2 +- inc/temp.inc.sh | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/defaults.inc b/defaults.inc index 2323db1c..9351460d 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,5 +1,5 @@ -VERS='2.5.97-01012024' +VERS='2.5.98-01012024' noheader=' update service dailytemp confsync -r -report ' diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index 86d76ede..21a93fee 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -502,8 +502,10 @@ CHECKTEMP_SERVICE_RUNSENSOR(){ ([ "${SENSOR}" == "ServerRoomTH" ] || [[ "${SENSOR}" = *"ServerRoomLA"* ]]) && rm -f ${PW_TMPFOLDER}/temp.* rm -f ${PW_TMPFOLDER}/power.${SENSORa}.* - last_temp=1 - echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR} + if [ "${last_temp}" != "1" ]; then + last_temp=1 + echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR} + fi # iDS-vMS-Offsite Fan Issue Workaround if [ "${PW_HOST_IDRACS[${SENSORa}]}" == "10.2.1.21" ] && [ "${FanSpeed}" != "" ]; then @@ -520,8 +522,10 @@ CHECKTEMP_SERVICE_RUNSENSOR(){ else if ([ ! "${last_temp}" ] || (( $(bc <<< "${last_temp} < 2") ))); then - last_temp=${temp_f} - echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR} + if [ "${last_temp}" != "${temp_f}" ]; then + last_temp=${temp_f} + echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR} + fi fi temp_diff=`echo "scale=2; ${last_temp}-${temp_f}" | bc` [ $(bc -l <<< "${temp_diff} < 0") -eq 1 ] && temp_diff=`echo "scale=2; ${temp_diff}*-1" | bc` @@ -531,8 +535,10 @@ CHECKTEMP_SERVICE_RUNSENSOR(){ ([ "${SENSOR}" == "ServerRoomTH" ] || [[ "${SENSOR}" = *"ServerRoomLA"* ]]) && touch ${PW_TMPFOLDER}/temp.warn if (( $(bc <<< "${temp_diff} >= 1") )); then SENDNOTICE "${SENSOR} ${GAUGE} WARNING" "WARNING ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 1 - last_temp=${temp_f} - echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR} + if [ "${last_temp}" != "${temp_f}" ]; then + last_temp=${temp_f} + echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR} + fi echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - WARNING ${GAUGE} - (Difference of ${temp_diff}${GAUGESH})" >> ${logtemp} fi @@ -551,8 +557,10 @@ CHECKTEMP_SERVICE_RUNSENSOR(){ 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} - last_temp=${temp_f} - echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR} + if [ "${last_temp}" != "${temp_f}" ]; then + last_temp=${temp_f} + echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR} + fi if ([ "${SENSOR}" == "ServerRoomTH" ] || [[ "${SENSOR}" = *"ServerRoomLA"* ]]) && [ ! -f touch ${PW_TMPFOLDER}/temp.crit ]; then touch ${PW_TMPFOLDER}/temp.crit @@ -571,8 +579,10 @@ CHECKTEMP_SERVICE_RUNSENSOR(){ 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} - last_temp=${temp_f} - echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR} + if [ "${last_temp}" != "${temp_f}" ]; then + last_temp=${temp_f} + echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR} + fi if ([ "${SENSOR}" == "ServerRoomTH" ] || [[ "${SENSOR}" = *"ServerRoomLA"* ]]) && [ ! -f ${PW_TMPFOLDER}/temp.critsys ]; then touch ${PW_TMPFOLDER}/temp.critsys SHUTDOWN_SYS ${SENSOR} TEMP &