Update temp.inc.sh

This commit is contained in:
2024-01-31 08:37:00 -06:00
parent 00baeb031d
commit 2d9461e589

View File

@@ -63,15 +63,20 @@ CHECKTEMP(){
elif [[ "${avgdays}" =~ ^[0-9]+$ ]]; then elif [[ "${avgdays}" =~ ^[0-9]+$ ]]; then
avgdays_disp="${avgdays}Day" avgdays_disp="${avgdays}Day"
fi fi
echo -e "${idsCL[Cyan]}Sensor Temperature(s) Current / ${idsCL[LightYellow]}${avgdays_disp}AVG ${idsCL[Yellow]}warning${idsCL[Default]} / ${idsCL[LightRed]}critical${idsCL[Default]}"
else else
avgdays=noavg avgdays=noavg
echo -e "${idsCL[Cyan]}Sensor Temperature(s) Current ${idsCL[Yellow]}warning${idsCL[Default]} / ${idsCL[LightRed]}critical${idsCL[Default]}"
fi fi
DIVIDER . yellow 70 DIVIDER . yellow 70
if [ "${temptype}" != "esxi" ]; then
if [ "${avgdays}" != "noavg" ]; then
echo -e "${idsCL[Cyan]}Sensor Temperature(s) Current / ${idsCL[LightYellow]}${avgdays_disp}AVG ${idsCL[Yellow]}warning${idsCL[Default]} / ${idsCL[LightRed]}critical${idsCL[Default]}"
else
echo -e "${idsCL[Cyan]}Sensor Temperature(s) Current ${idsCL[Yellow]}warning${idsCL[Default]} / ${idsCL[LightRed]}critical${idsCL[Default]}"
fi
DIVIDER . yellow 70
for SENSOR in ${PW_SENSOR_ORD[@]}; do for SENSOR in ${PW_SENSOR_ORD[@]}; do
if ([ "${search}" == "" ] || [[ "${SENSOR,,}" = *"${search,,}"* ]]) && [ "${PW_SENSOR_TYPE[${SENSOR}]}" != "esxi" ] && [ "${temptype}" != "esxi" ] && ([ "${temptype}" != "fans" ] || ([ "${temptype}" == "fans" ] && [[ "${SENSOR}" = *"Room"* ]])); then if ([ "${search}" == "" ] || [[ "${SENSOR,,}" = *"${search,,}"* ]]) && [ "${PW_SENSOR_TYPE[${SENSOR}]}" != "esxi" ] && ([ "${temptype}" != "fans" ] || ([ "${temptype}" == "fans" ] && [[ "${SENSOR}" = *"Room"* ]])); then
[ "${last_sensor}" == "${SENSOR%%-*}" ] && echo -en "\033[1A" [ "${last_sensor}" == "${SENSOR%%-*}" ] && echo -en "\033[1A"
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done 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 if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
@@ -100,15 +105,17 @@ CHECKTEMP(){
fi fi
done done
DIVIDER true yellow 70 DIVIDER true yellow 70
fi
if [ "${avgdays}" != "" ]; then if [ "${temptype}" != "sensors" ]; then
if [ "${avgdays}" != "noavg" ]; then
echo -e "${idsCL[Cyan]}ESXi Sensor Temperature(s) Current / ${idsCL[LightYellow]}${avgdays_disp}AVG ${idsCL[Yellow]}warning${idsCL[Default]} / ${idsCL[LightRed]}critical${idsCL[Default]}" echo -e "${idsCL[Cyan]}ESXi Sensor Temperature(s) Current / ${idsCL[LightYellow]}${avgdays_disp}AVG ${idsCL[Yellow]}warning${idsCL[Default]} / ${idsCL[LightRed]}critical${idsCL[Default]}"
else else
echo -e "${idsCL[Cyan]}ESXi Sensor Temperature(s) Current ${idsCL[Yellow]}warning${idsCL[Default]} / ${idsCL[LightRed]}critical${idsCL[Default]}" echo -e "${idsCL[Cyan]}ESXi Sensor Temperature(s) Current ${idsCL[Yellow]}warning${idsCL[Default]} / ${idsCL[LightRed]}critical${idsCL[Default]}"
fi fi
DIVIDER . yellow 70 DIVIDER . yellow 70
for SENSOR in ${PW_SENSOR_ORD[@]}; do for SENSOR in ${PW_SENSOR_ORD[@]}; do
if ([ "${search}" == "" ] || [[ "${SENSOR,,}" = *"${search,,}"* ]]) && [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "esxi" ] && [ "${temptype}" != "sensors" ]; then if ([ "${search}" == "" ] || [[ "${SENSOR,,}" = *"${search,,}"* ]]) && [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "esxi" ]; then
vHOSTiDRACIP=${PW_HOST_IDRACS[${SENSOR}]} vHOSTiDRACIP=${PW_HOST_IDRACS[${SENSOR}]}
vHOSTIP=${PW_HOST_ADDRESSES[${SENSOR}]} vHOSTIP=${PW_HOST_ADDRESSES[${SENSOR}]}
vHOSTNAME=${PW_ESXI_HOST_NAMES[${vHOSTiDRACIP}]} vHOSTNAME=${PW_ESXI_HOST_NAMES[${vHOSTiDRACIP}]}
@@ -200,6 +207,7 @@ CHECKTEMP(){
echo echo
fi fi
done done
fi
rm -f ${PW_TMPFOLDER}/.fanspeed.* rm -f ${PW_TMPFOLDER}/.fanspeed.*
end=`date +%s`; runtime=$((end-start)); echo -e "runtime: ${runtime}s" end=`date +%s`; runtime=$((end-start)); echo -e "runtime: ${runtime}s"
[ "${PW_ACTION}" != "" ] && echo -e "${idsCL[Default]}" [ "${PW_ACTION}" != "" ] && echo -e "${idsCL[Default]}"