Update temp.inc.sh

This commit is contained in:
2024-01-01 10:45:22 -06:00
parent b8002df5e5
commit 3c2fa2f47a

View File

@@ -400,7 +400,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
fi
echo "HERE1: ${SENSOR} = ${last_temp[${SENSOR//-/}]}"
[ "${last_temp[${SENSOR//-/}]}" == "" ] && last_temp[${SENSOR//-/}]=0
[ "${last_temp[${SENSOR//-/}]}" == "" ] && export last_temp[${SENSOR//-/}]=0
echo "HERE2: ${SENSOR} = ${last_temp[${SENSOR//-/}]}"
echo
logtemp=${PW_LOGFOLDER}/log-temp-${SENSOR}
@@ -493,7 +493,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
([ "${SENSOR}" == "ServerRoomTH" ] || [[ "${SENSOR}" = *"ServerRoomLA"* ]]) && rm -f ${PW_TMPFOLDER}/temp.*
rm -f ${PW_TMPFOLDER}/power.${SENSORa}.*
last_temp[${SENSOR//-/}]=1
export last_temp[${SENSOR//-/}]=1
# iDS-vMS-Offsite Fan Issue Workaround
if [ "${PW_HOST_IDRACS[${SENSORa}]}" == "10.2.1.21" ] && [ "${FanSpeed}" != "" ]; then
@@ -509,7 +509,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
else
([ ! "${last_temp[${SENSOR//-/}]}" ] || (( $(bc <<< "${last_temp[${SENSOR//-/}]} < 2") ))) && last_temp[${SENSOR//-/}]=${temp_f}
([ ! "${last_temp[${SENSOR//-/}]}" ] || (( $(bc <<< "${last_temp[${SENSOR//-/}]} < 2") ))) && export last_temp[${SENSOR//-/}]=${temp_f}
temp_diff=`echo "scale=2; ${last_temp[${SENSOR//-/}]}-${temp_f}" | bc`
[ $(bc -l <<< "${temp_diff} < 0") -eq 1 ] && temp_diff=`echo "scale=2; ${temp_diff}*-1" | bc`
@@ -518,7 +518,7 @@ 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}')" 1
last_temp[${SENSOR//-/}]=${temp_f}
export last_temp[${SENSOR//-/}]=${temp_f}
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - WARNING ${GAUGE} - (Difference of ${temp_diff}')" >> ${logtemp}
fi
@@ -537,7 +537,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
SENDNOTICE "${SENSOR} ${GAUGE} CRITICAL" "CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}')" 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}')" >> ${PW_LOGFILE}
last_temp[${SENSOR//-/}]=${temp_f}
export last_temp[${SENSOR//-/}]=${temp_f}
if ([ "${SENSOR}" == "ServerRoomTH" ] || [[ "${SENSOR}" = *"ServerRoomLA"* ]]) && [ ! -f touch ${PW_TMPFOLDER}/temp.crit ]; then
touch ${PW_TMPFOLDER}/temp.crit
@@ -556,7 +556,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
SENDNOTICE "${SENSOR} TEMP CRITICAL" "SYSTEM CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}')" 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}')" >> ${PW_LOGFILE}
last_temp[${SENSOR//-/}]=${temp_f}
export last_temp[${SENSOR//-/}]=${temp_f}
if ([ "${SENSOR}" == "ServerRoomTH" ] || [[ "${SENSOR}" = *"ServerRoomLA"* ]]) && [ ! -f ${PW_TMPFOLDER}/temp.critsys ]; then
touch ${PW_TMPFOLDER}/temp.critsys
SHUTDOWN_SYS ${SENSOR} TEMP &