Update temp.inc.sh

This commit is contained in:
2024-02-24 10:02:02 -06:00
parent dd4ab2e6f6
commit 3f764660ec

View File

@@ -108,7 +108,22 @@ CHECKTEMP(){
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Pulling data ... "
reading=$(CHECKTEMPSENSOR ${SENSOR})
temp_f=$(CHECKTEMPSENSOR ${SENSOR})
c=0; spct=''; [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]] && spc1=`expr 5 - ${#temp_f}` || spc1=`expr 6 - ${#temp_f}`
until [ ${c} = ${spc1} ]; do spct="${spct} "; c=`expr ${c} + 1`; done
[ "${PW_SENSOR_TYPE[${1}]}" == "system" ] && [[ "${1}" = *"FAN"* ]] && temp_f_disp=$(IDS_NUMBER_FORMAT ${temp_f} 0) || temp_f_disp=${temp_f}
if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
lclr="${idsCL[Yellow]}"
lmd="WARNING "
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then
lclr="${idsCL[LightRed]}"
lmd="CRITICAL"
else
lclr="${idsCL[Green]}"
lmd="Normal "
fi
reading="${lclr}${lmd}${spct}${temp_f_disp}${GAUGESH}"
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${reading}${idsCL[Default]}"
if [ "${avgdays}" != "noavg" ]; then
echo -en " / ${idsCL[Yellow]}Calculating ${avgdays_disp} average ... "
@@ -351,8 +366,15 @@ CHECKTEMPSENSOR(){
fi
# echo "HERE: '${temp_c}' -> '${temp_f}'"
# echo -en ""
c=0; spct=''; [ "${PW_SENSOR_TYPE[${1}]}" == "system" ] && [[ "${1}" = *"FAN"* ]] && spc1=`expr 5 - ${#temp_f}` || spc1=`expr 6 - ${#temp_f}`
until [ ${c} = ${spc1} ]; do spct="${spct} "; c=`expr ${c} + 1`; done
echo ${temp_f}
# c=0; spct=''; [ "${PW_SENSOR_TYPE[${1}]}" == "system" ] && [[ "${1}" = *"FAN"* ]] && spc1=`expr 5 - ${#temp_f}` || spc1=`expr 6 - ${#temp_f}`
# until [ ${c} = ${spc1} ]; do spct="${spct} "; c=`expr ${c} + 1`; done
# if [ "${average}" != "" ]; then
# ([ "${PW_SENSOR_TYPE[${1}]}" == "system" ] && [[ "${1}" = *"FAN"* ]]) && average_disp=$(IDS_NUMBER_FORMAT ${average}) || average_disp=${average}
@@ -368,27 +390,27 @@ CHECKTEMPSENSOR(){
# fi
# fi
if [ "${PW_SENSOR_TYPE[${1}]}" == "system" ] && [[ "${1}" = *"FAN"* ]]; then
temp_f_disp=$(IDS_NUMBER_FORMAT ${temp_f} 0)
temp_warn_disp=$(IDS_NUMBER_FORMAT ${temp_warn} 0)
temp_crit_disp=$(IDS_NUMBER_FORMAT ${temp_crit} 0)
else
temp_f_disp=${temp_f}
temp_warn_disp=${temp_warn}
temp_crit_disp=${temp_crit}
fi
if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
lclr="${idsCL[Yellow]}"
lmd="WARNING "
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then
lclr="${idsCL[LightRed]}"
lmd="CRITICAL"
else
lclr="${idsCL[Green]}"
lmd="Normal "
fi
echo -en "${lclr}${lmd}${spct}${temp_f_disp}${GAUGESH}"
# if [ "${PW_SENSOR_TYPE[${1}]}" == "system" ] && [[ "${1}" = *"FAN"* ]]; then
# temp_f_disp=$(IDS_NUMBER_FORMAT ${temp_f} 0)
# temp_warn_disp=$(IDS_NUMBER_FORMAT ${temp_warn} 0)
# temp_crit_disp=$(IDS_NUMBER_FORMAT ${temp_crit} 0)
# else
# temp_f_disp=${temp_f}
# temp_warn_disp=${temp_warn}
# temp_crit_disp=${temp_crit}
# fi
#
# if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
# lclr="${idsCL[Yellow]}"
# lmd="WARNING "
# elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then
# lclr="${idsCL[LightRed]}"
# lmd="CRITICAL"
# else
# lclr="${idsCL[Green]}"
# lmd="Normal "
# fi
# echo -en "${lclr}${lmd}${spct}${temp_f_disp}${GAUGESH}"
# if [ "${7}" == "fans" ]; then
# echo -en "${idsCL[Default]}${spc}[${idsCL[LightGreen]}${GL_LOW}${GAUGESH}${idsCL[Default]}/${idsCL[Green]}${ESXI_DEFAULT_EXHAUST_MIN}${GAUGESH}${idsCL[Default]}/${idsCL[LightYellow]}${GL_HIGH}${GAUGESH}${idsCL[Default]}]"