This commit is contained in:
2024-02-14 22:20:53 -06:00
parent 4e1577fda1
commit 385b53dddf
2 changed files with 16 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERS='2.6.32-02132024'
VERS='2.6.33-02142024'
noheader=' update service dailytemp confsync -r -report '

View File

@@ -95,7 +95,13 @@ CHECKTEMP(){
reading=$(CHECKTEMPSENSOR ${SENSOR} . . . . ${avgdays})
echo -e "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${reading}${idsCL[Default]}"
else
echo -e "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Sensor Offline${idsCL[Default]}"
if [ "${avgdays}" != "noavg" ]; then
([ "${avgdays}" == "" ] && avgdays=3d
average=$(AVERAGETEMP ${SENSOR} ${avgdays})
echo -e "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${reading}${idsCL[Default]}"
else
echo -e "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Sensor Offline${idsCL[Default]}"
fi
fi
echo
last_sensor=${SENSOR}
@@ -226,7 +232,7 @@ CHECKTEMPSENSOR(){
GAUGESH="°F"
fi
if [ "${6}" != "noavg" ]; then
[ "${6}" != "" ] && [[ "${6}" =~ ^[0-9]+$ ]] && avgdays=${6} || avgdays=3
[ "${6}" != "" ] && [[ "${6}" =~ ^[0-9]+$ ]] && avgdays=${6} || avgdays=3d
if [ "${PW_SENSOR_TYPE[${1}]}" != "esxi" ]; then
average=$(AVERAGETEMP ${1} ${avgdays})
else
@@ -389,14 +395,15 @@ AVERAGETEMP(){
while IFS=$'\t' read date temp hum speed ;do
if [ "${3}" == "FanSpeed" ] && [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" = *"${PW_HOST_IDRACS[${sensor}]}"* ]]; then
temptotal=$(bc <<< "scale=2; ${temptotal}+${speed}")
elif [ "${sensorid}" == "19" ]; then
temptotal=$(bc <<< "scale=0; ${temptotal}+${speed}")
if ([ "${3}" == "FanSpeed" ] && [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" = *"${PW_HOST_IDRACS[${sensor}]}"* ]]) || [ "${sensorid}" == "19" ]; then
val=${speed}
else
temptotal=$(bc <<< "scale=2; ${temptotal}+${temp}")
val=${temp}
fi
if [ "${val}" != "" ] && [ "${val}" != "0" ] && [[ "${val}" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
temptotal=$(bc <<< "scale=2; ${temptotal}+${val}")
((logsfound++))
fi
((logsfound++))
done < <(${mysql_conn} -se "USE servermonitor; SELECT date,temp,hum,speed from sensor_data WHERE ${WHERE} AND date BETWEEN DATE_SUB(DATE(NOW()), INTERVAL ${interval}) AND NOW() ORDER BY id DESC;")
if [ "${3}" == "FanSpeed" ] && [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" = *"${PW_HOST_IDRACS[${sensor}]}"* ]]; then
average=$(ROUND_NUMBER $(bc <<< "scale=2; ${temptotal}/${logsfound}") 2)