Update temp.inc.sh
This commit is contained in:
280
inc/temp.inc.sh
280
inc/temp.inc.sh
@@ -106,85 +106,66 @@ CHECKTEMP(){
|
||||
|
||||
[ "${last_sensor%%-*}" == "${SENSOR%%-*}" ] && [ "${last_sensor}" != "Offsite-ServerRoom" ] && echo -en "\033[1A"
|
||||
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 ... "
|
||||
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
|
||||
temp_f=$(CHECKTEMPSENSOR ${SENSOR})
|
||||
[ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"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
|
||||
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
|
||||
reading="${lclr}${lmd}${spct}${temp_f_disp}${GAUGESH}"
|
||||
else
|
||||
temp_f=""
|
||||
temp_f_disp=" "
|
||||
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Pulling data ... "
|
||||
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
|
||||
temp_f=$(CHECKTEMPSENSOR ${SENSOR})
|
||||
[ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"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=""
|
||||
reading="${idsCL[Yellow]}Sensor Offline "
|
||||
fi
|
||||
|
||||
|
||||
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 ... "
|
||||
average=$(AVERAGETEMP ${SENSOR} ${avgdays})
|
||||
([ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]) && average_disp=$(IDS_NUMBER_FORMAT ${average}) || average_disp=${average}
|
||||
c=0; spca=''; spc1=`expr 6 - ${#average_disp}`; until [ ${c} = ${spc1} ]; do spca="${spca} "; c=`expr ${c} + 1`; done
|
||||
if [ "${average_disp}" == "" ]; then
|
||||
averagedisp="${idsCL[Green]}"
|
||||
elif [ $(bc -l <<< "${average} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${average} < ${temp_crit}") -eq 1 ]; then
|
||||
averagedisp="${idsCL[Yellow]}${average}"
|
||||
elif [ $(bc -l <<< "${average} >= ${temp_crit}") -eq 1 ]; then
|
||||
averagedisp="${idsCL[LightRed]}${average_disp}"
|
||||
else
|
||||
averagedisp="${idsCL[Green]}${average_disp}"
|
||||
fi
|
||||
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${reading} ${idsCL[Default]}/${spca}${averagedisp}${GAUGESH}"
|
||||
fi
|
||||
if ([ "${average}" != "" ] || [ "${temp_f}" != "" ]) && [[ "${SENSOR}" != *"FAN"* ]]; then
|
||||
tmp="${spct}${temp_f_disp}${GAUGESH}"
|
||||
[ "${average}" != "" ] && fws=11 || fws=21
|
||||
c=0; spc=''; spc1=`expr ${fws} - ${#tmp}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
|
||||
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
|
||||
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
|
||||
echo -en "${idsCL[Default]}${spc}[${spcw}${idsCL[Yellow]}${temp_warn_disp}${GAUGESH}${idsCL[Default]} /${spcc}${idsCL[LightRed]}${temp_crit_disp}${GAUGESH}=>${idsCL[Default]} ]"
|
||||
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ] && [[ "${SENSOR}" != *"-ProbeXXX" ]]; then
|
||||
INFO=$(curl -m 8 -s --get -d "deviceid=${PW_SENSOR_DEVICEID[${SENSOR}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php)
|
||||
echo -e " - $(echo ${INFO} | jq -r '.device0 .obs[].timestamp')"
|
||||
else
|
||||
echo
|
||||
fi
|
||||
lmd="WARNING "
|
||||
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then
|
||||
lclr="${idsCL[LightRed]}"
|
||||
lmd="CRITICAL"
|
||||
else
|
||||
echo -e "${idsCL[Default]}"
|
||||
lclr="${idsCL[Green]}"
|
||||
lmd="Normal "
|
||||
fi
|
||||
# else
|
||||
# if [ "${avgdays}" != "noavg" ]; then
|
||||
# average=$(AVERAGETEMP ${SENSOR} ${avgdays})
|
||||
# ([ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]) && average_disp=$(IDS_NUMBER_FORMAT ${average}) || average_disp=${average}
|
||||
# c=0; spca=''; spc1=`expr 6 - ${#average_disp}`; until [ ${c} = ${spc1} ]; do spca="${spca} "; c=`expr ${c} + 1`; done
|
||||
# if [ "${average_disp}" == "" ]; then
|
||||
# averagedisp="${idsCL[Green]}"
|
||||
# elif [ $(bc -l <<< "${average} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${average} < ${temp_crit}") -eq 1 ]; then
|
||||
# averagedisp="${idsCL[Yellow]}${average}"
|
||||
# elif [ $(bc -l <<< "${average} >= ${temp_crit}") -eq 1 ]; then
|
||||
# averagedisp="${idsCL[LightRed]}${average_disp}"
|
||||
# else
|
||||
# averagedisp="${idsCL[Green]}${average_disp}"
|
||||
# fi
|
||||
# echo -e "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Sensor Offline /${spca}${averagedisp}${GAUGESH}${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
|
||||
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
|
||||
reading="${lclr}${lmd}${spct}${temp_f_disp}${GAUGESH}"
|
||||
else
|
||||
temp_f=""
|
||||
temp_f_disp=" "
|
||||
lclr="${idsCL[Yellow]}"
|
||||
lmd=""
|
||||
reading="${idsCL[Yellow]}Sensor Offline "
|
||||
fi
|
||||
|
||||
|
||||
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 ... "
|
||||
average=$(AVERAGETEMP ${SENSOR} ${avgdays})
|
||||
([ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]) && average_disp=$(IDS_NUMBER_FORMAT ${average}) || average_disp=${average}
|
||||
c=0; spca=''; spc1=`expr 6 - ${#average_disp}`; until [ ${c} = ${spc1} ]; do spca="${spca} "; c=`expr ${c} + 1`; done
|
||||
if [ "${average_disp}" == "" ]; then
|
||||
averagedisp="${idsCL[Green]}"
|
||||
elif [ $(bc -l <<< "${average} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${average} < ${temp_crit}") -eq 1 ]; then
|
||||
averagedisp="${idsCL[Yellow]}${average}"
|
||||
elif [ $(bc -l <<< "${average} >= ${temp_crit}") -eq 1 ]; then
|
||||
averagedisp="${idsCL[LightRed]}${average_disp}"
|
||||
else
|
||||
averagedisp="${idsCL[Green]}${average_disp}"
|
||||
fi
|
||||
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${reading} ${idsCL[Default]}/${spca}${averagedisp}${GAUGESH}"
|
||||
fi
|
||||
if ([ "${average}" != "" ] || [ "${temp_f}" != "" ]) && [[ "${SENSOR}" != *"FAN"* ]]; then
|
||||
tmp="${spct}${temp_f_disp}${GAUGESH}"
|
||||
[ "${average}" != "" ] && fws=11 || fws=21
|
||||
c=0; spc=''; spc1=`expr ${fws} - ${#tmp}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
|
||||
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
|
||||
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
|
||||
echo -en "${idsCL[Default]}${spc}[${spcw}${idsCL[Yellow]}${temp_warn_disp}${GAUGESH}${idsCL[Default]} /${spcc}${idsCL[LightRed]}${temp_crit_disp}${GAUGESH}=>${idsCL[Default]} ]"
|
||||
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ] && [[ "${SENSOR}" != *"-ProbeXXX" ]]; then
|
||||
INFO=$(curl -m 8 -s --get -d "deviceid=${PW_SENSOR_DEVICEID[${SENSOR}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php)
|
||||
echo -e " - $(echo ${INFO} | jq -r '.device0 .obs[].timestamp')"
|
||||
else
|
||||
echo
|
||||
fi
|
||||
else
|
||||
echo -e "${idsCL[Default]}"
|
||||
fi
|
||||
|
||||
echo
|
||||
last_sensor=${SENSOR}
|
||||
fi
|
||||
@@ -193,6 +174,7 @@ CHECKTEMP(){
|
||||
fi
|
||||
|
||||
if [ "${TTYPE}" != "sensors" ]; then
|
||||
GAUGESH="°F"
|
||||
DIVIDER . yellow ${PRI_WIDTH}
|
||||
if [ "${avgdays}" != "noavg" ]; then
|
||||
echo -e "${idsCL[LightYellow]}ESXI HOST TEMPERATURE(S) Current / ${idsCL[LightYellow]}${avgdays_disp}AVG ${idsCL[Yellow]}warning${idsCL[Default]} / ${idsCL[LightRed]}critical${idsCL[Default]}"
|
||||
@@ -201,12 +183,12 @@ CHECKTEMP(){
|
||||
fi
|
||||
DIVIDER . yellow ${PRI_WIDTH}
|
||||
for SENSOR in ${PW_SENSOR_ORD[@]}; do
|
||||
# if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "esxi" ] && ([ "${search}" == "" ] || [[ "${SENSOR,,}" = *"${search,,}"* ]]) && ([ "${STYPE}" = "" ] || ([ "${STYPE}" = "mainsite" ] && [[ "${PW_HOST_ADDRESSES[${SENSOR}]}" = *"10.10."* ]]) || ([ "${STYPE}" = "offsite" ] && [[ "${PW_HOST_ADDRESSES[${SENSOR}]}" = *"10.2.1."* ]]) ) && ([ "${TTYPE}" != "fans" ] || ([ "${TTYPE}" == "fans" ] && [[ "${SENSOR}" = *"Room"* ]]) ); then
|
||||
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "esxi" ] && ([ "${search}" == "" ] || [[ "${SENSOR,,}" = *"${search,,}"* ]]) && ([ "${STYPE}" = "" ] || ([ "${STYPE}" = "mainsite" ] && [[ "${PW_HOST_ADDRESSES[${SENSOR}]}" = *"10.10."* ]]) || ([ "${STYPE}" = "offsite" ] && [[ "${PW_HOST_ADDRESSES[${SENSOR}]}" = *"10.2.1."* ]]) ); then
|
||||
vHOSTiDRACIP=${PW_HOST_IDRACS[${SENSOR}]}
|
||||
vHOSTIP=${PW_HOST_ADDRESSES[${SENSOR}]}
|
||||
vHOSTNAME=${PW_ESXI_HOST_NAMES[${vHOSTiDRACIP}]}
|
||||
|
||||
|
||||
([ "${TTYPE}" == "fans" ] && [ "${SENSOR}" == "iDS-vMS-Host6" ]) && echo -e "${idsCL[LightYellow]}${SENSOR} PSU is not compatible, Fans are instead synced with 'iDS-vMS-Host7'${idsCL[Default]}"
|
||||
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR} Host Sensors ${idsST[Reset]}${idsCL[White]}[${vHOSTiDRACIP}]"
|
||||
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
|
||||
@@ -216,7 +198,7 @@ CHECKTEMP(){
|
||||
echo -en "${idsCL[LightCyan]} Getting FanSpeed..."
|
||||
fi
|
||||
[ ! -f ${PW_TMPFOLDER}/.fanspeed.${SENSOR}.${cdt} ] && until [ -f ${PW_TMPFOLDER}/.fanspeed.${SENSOR}.${cdt} ]; do tmp=tmp; done
|
||||
RPM=$(snmpwalk -v 1 -c public -t 2 ${PW_HOST_IDRACS[${SENSOR}]} .1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.3 -O vq)
|
||||
RPM=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.3 -O vq)
|
||||
[ "${avgdays}" != "noavg" ] && fan_average=$(bc <<< "scale=0; $(ROUNDHALVES $(bc <<< "scale=3; $(AVERAGETEMP ${SENSOR} ${avgdays} FanSpeed)/10"))*10/1")
|
||||
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR} Host Sensors ${idsST[Reset]}${idsCL[White]}[${vHOSTiDRACIP}]"
|
||||
[ "${SENSOR}" == "iDS-vMS-Host6" ] && cSENSOR="iDS-vMS-Host7" || cSENSOR=${SENSOR}
|
||||
@@ -243,6 +225,10 @@ CHECKTEMP(){
|
||||
|
||||
# if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ] && [ "$(CHECK_HOST ${vHOSTIP})" != "false" ]; then
|
||||
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
|
||||
temp_warn=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.11.1.${t} -O vq | sed -e 's/"//g')
|
||||
temp_warn=`echo "scale=1; ${temp_warn}/10" | bc`; temp_warn=`echo $(bc <<< "scale=2; ((${temp_warn}*(9/5))+32)/1") | awk '{print int($1+0.5)}'`
|
||||
temp_crit=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.10.1.${t} -O vq | sed -e 's/"//g')
|
||||
temp_crit=`echo "scale=1; ${temp_crit}/10" | bc`; temp_crit=`echo $(bc <<< "scale=2; ((${temp_crit}*(9/5))+32)/1") | awk '{print int($1+0.5)}'`
|
||||
vHOST_TEMPNAMES=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.8 -O vq | sed -e 's/"//g' | sed -e 's/ Temp//g')
|
||||
IFS=$'\n'
|
||||
read -rd '' -a vHOST_TEMPNAMES <<<"${vHOST_TEMPNAMES}"
|
||||
@@ -252,17 +238,51 @@ CHECKTEMP(){
|
||||
t=1
|
||||
for sensorname in "${vHOST_TEMPNAMES[@]}"; do
|
||||
if [ "${TTYPE}" != "fans" ] || ([ "${TTYPE}" == "fans" ] && [[ "${sensorname}" = *"Exhaust"* ]]); then
|
||||
temp_c=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.${t} -O vq | sed -e 's/"//g')
|
||||
temp_c=`echo "scale=1; ${temp_c}/10" | bc`
|
||||
temp_warn=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.11.1.${t} -O vq | sed -e 's/"//g')
|
||||
temp_warn=`echo "scale=1; ${temp_warn}/10" | bc`
|
||||
temp_crit=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.10.1.${t} -O vq | sed -e 's/"//g')
|
||||
temp_crit=`echo "scale=1; ${temp_crit}/10" | bc`
|
||||
|
||||
c=0; spc=''; spc1=`expr ${cw} - ${#sensorname} - 1`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
|
||||
[ "${avgdays}" != "noavg" ] && echo -en "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Calculating ${avgdays_disp} average ... "
|
||||
reading=$(CHECKTEMPSENSOR ${SENSOR} ${temp_c} ${temp_warn} ${temp_crit} ${sensorname// /_} ${avgdays} ${TTYPE})
|
||||
[ "${avgdays}" != "noavg" ] && echo -en "\r\033[K"
|
||||
echo -e "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${reading}"
|
||||
temp_f=$(CHECKTEMPSENSOR ${SENSOR})
|
||||
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
|
||||
c=0; spct=''; spc1=`expr 6 - ${#temp_f}`; until [ ${c} = ${spc1} ]; do spct="${spct} "; c=`expr ${c} + 1`; done
|
||||
reading="${lclr}${lmd}${spct}${temp_f}${GAUGESH}"
|
||||
echo -en "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${reading}"
|
||||
|
||||
if [ "${avgdays}" != "noavg" ]; then
|
||||
echo -en " / ${idsCL[Yellow]}Calculating ${avgdays_disp} average ... "
|
||||
average=$(AVERAGETEMP ${SENSOR} ${avgdays} ${sensorname// /_})
|
||||
([ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]) && average_disp=$(IDS_NUMBER_FORMAT ${average}) || average_disp=${average}
|
||||
c=0; spca=''; spc1=`expr 6 - ${#average_disp}`; until [ ${c} = ${spc1} ]; do spca="${spca} "; c=`expr ${c} + 1`; done
|
||||
if [ "${average_disp}" == "" ]; then
|
||||
averagedisp="${idsCL[Green]}"
|
||||
elif [ $(bc -l <<< "${average} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${average} < ${temp_crit}") -eq 1 ]; then
|
||||
averagedisp="${idsCL[Yellow]}${average}"
|
||||
elif [ $(bc -l <<< "${average} >= ${temp_crit}") -eq 1 ]; then
|
||||
averagedisp="${idsCL[LightRed]}${average_disp}"
|
||||
else
|
||||
averagedisp="${idsCL[Green]}${average_disp}"
|
||||
fi
|
||||
echo -en "\r\033[K${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${reading} ${idsCL[Default]}/${spca}${averagedisp}${GAUGESH}"
|
||||
fi
|
||||
|
||||
if [ "${average}" != "" ] || [ "${temp_f}" != "" ]; then
|
||||
tmp="${spct}${temp_f}${GAUGESH}"
|
||||
[ "${average}" != "" ] && fws=11 || fws=21
|
||||
c=0; spc=''; spc1=`expr ${fws} - ${#tmp}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
|
||||
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
|
||||
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
|
||||
echo -e "${idsCL[Default]}${spc}[${spcw}${idsCL[Yellow]}${temp_warn}${GAUGESH}${idsCL[Default]} /${spcc}${idsCL[LightRed]}${temp_crit}${GAUGESH}=>${idsCL[Default]} ]"
|
||||
else
|
||||
echo -e "${idsCL[Default]}"
|
||||
fi
|
||||
|
||||
if [ "${TTYPE}" == "fans" ]; then
|
||||
if [ -f ${PW_TMPFOLDER}/.lastfancheck/${cSENSOR}.gl ]; then
|
||||
FSC="${idsCL[LightGreen]}"
|
||||
@@ -302,27 +322,6 @@ CHECKTEMP(){
|
||||
}
|
||||
|
||||
CHECKTEMPSENSOR(){
|
||||
if [ "${PW_THRESHOLDS[${1}]}" != "" ]; then
|
||||
echo ${PW_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
|
||||
echo ${PW_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
|
||||
fi
|
||||
if [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then
|
||||
GAUGESH="'%"
|
||||
elif [ "${PW_SENSOR_TYPE[${1}]}" == "system" ] && [[ "${1}" = *"FAN"* ]]; then
|
||||
GAUGESH="'R"
|
||||
else
|
||||
GAUGESH="°F"
|
||||
fi
|
||||
# if [ "${6}" != "noavg" ]; then
|
||||
# [ "${6}" != "" ] && [[ "${6}" =~ ^[0-9]+$ ]] && avgdays=${6} || avgdays=3d
|
||||
# if [ "${PW_SENSOR_TYPE[${1}]}" != "esxi" ]; then
|
||||
# average=$(AVERAGETEMP ${1} ${avgdays})
|
||||
# else
|
||||
# average=$(AVERAGETEMP ${1} ${avgdays} ${5})
|
||||
# fi
|
||||
# else
|
||||
# average=''
|
||||
# fi
|
||||
|
||||
TIMEOUT=0
|
||||
if [ "${PW_SENSOR_TYPE[${1}]}" == "mqtt" ]; then
|
||||
@@ -355,9 +354,8 @@ CHECKTEMPSENSOR(){
|
||||
|
||||
fi
|
||||
elif [ "${PW_SENSOR_TYPE[${1}]}" == "esxi" ]; then
|
||||
temp_c=${2}
|
||||
temp_warn=`echo $(bc <<< "scale=2; ((${3}*(9/5))+32)/1") | awk '{print int($1+0.5)}'`
|
||||
temp_crit=`echo $(bc <<< "scale=2; ((${4}*(9/5))+32)/1") | awk '{print int($1+0.5)}'`
|
||||
temp_c=$(snmpwalk -v 1 -c public -t 2 ${PW_HOST_IDRACS[${1}]} .1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.${t} -O vq | sed -e 's/"//g')
|
||||
temp_c=`echo "scale=1; ${temp_c}/10" | bc`
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then
|
||||
if [ "${1}" == "Powerwall-CPU-Usage" ]; then
|
||||
@@ -393,70 +391,12 @@ CHECKTEMPSENSOR(){
|
||||
# echo -en ""
|
||||
|
||||
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}
|
||||
# c=0; spca=''; spc1=`expr 6 - ${#average_disp}`; until [ ${c} = ${spc1} ]; do spca="${spca} "; c=`expr ${c} + 1`; done
|
||||
# if [ "${average_disp}" == "" ]; then
|
||||
# averagedisp="${idsCL[Green]}"
|
||||
# elif [ $(bc -l <<< "${average} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${average} < ${temp_crit}") -eq 1 ]; then
|
||||
# averagedisp="${idsCL[Yellow]}${average}"
|
||||
# elif [ $(bc -l <<< "${average} >= ${temp_crit}") -eq 1 ]; then
|
||||
# averagedisp="${idsCL[LightRed]}${average_disp}"
|
||||
# else
|
||||
# averagedisp="${idsCL[Green]}${average_disp}"
|
||||
# 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 [ "${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]}]"
|
||||
#
|
||||
# el
|
||||
|
||||
elif [ ${TIMEOUT} -eq 1 ]; then
|
||||
echo -en "${idsCL[Yellow]}Sensor Timeout${idsCL[Default]}"
|
||||
else
|
||||
echo -en "${idsCL[Yellow]}Sensor Offline${idsCL[Default]}"
|
||||
fi
|
||||
# [ "${average}" != "" ] && echo -en " /${spca}${averagedisp}${GAUGESH}"
|
||||
# if [ "${average}" != "" ] || ([ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]) && [[ "${1}" != *"FAN"* ]]; then
|
||||
# tmp="${spct}${temp_f_disp}${GAUGESH}"
|
||||
# [ "${average}" != "" ] && fws=11 || fws=21
|
||||
# c=0; spc=''; spc1=`expr ${fws} - ${#tmp}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
|
||||
# [ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
|
||||
# [ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
|
||||
# echo -en "${idsCL[Default]}${spc}[${spcw}${idsCL[Yellow]}${temp_warn_disp}${GAUGESH}${idsCL[Default]} /${spcc}${idsCL[LightRed]}${temp_crit_disp}${GAUGESH}=>${idsCL[Default]} ]"
|
||||
# [ "${PW_SENSOR_TYPE[${1}]}" == "lacrosse" ] && [[ "${1}" != *"-ProbeXXX" ]] && echo -e " - $(echo ${INFO} | jq -r '.device0 .obs[].timestamp')" || echo
|
||||
# fi
|
||||
}
|
||||
AVERAGETEMP(){
|
||||
temptotal=0
|
||||
|
||||
Reference in New Issue
Block a user