Update powerwall.sh

This commit is contained in:
2023-11-04 11:20:16 -05:00
parent 23fee31415
commit 92b90a4a09

View File

@@ -17,7 +17,7 @@ VERBOSE=false
CHECKTEMP(){
start=`date +%s`
cw=30;
cw=25;
echo
[ "${1}" != "" ] && [ "${1}" != "noavg" ] && [[ "${1}" =~ ^[0-9]+$ ]] && avgdays=${1} || avgdays=3
# echo -e "${idsCL[Yellow]}Sensor Temperature(s) ${idsCL[Green]}normal${idsCL[Default]} /${idsCL[Yellow]}warning${idsCL[Default]}/ ${idsCL[Red]}critical${idsCL[Default]}"
@@ -36,7 +36,7 @@ CHECKTEMP(){
[ "${1}" != "noavg" ] && echo -en "${idsCL[Yellow]}Pulling data and calculating averages for '${SENSOR}' ..." || echo -en "${idsCL[Yellow]}Pulling data for '${SENSOR}' ..."
if [ "$(CHECK_HOST ${vHOSTIP})" != "false" ]; then
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')
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')
# # iDS-vMS-Offsite Fan Issue Workaround
# if [ "${vHOSTiDRACIP}" == "10.2.1.21" ]; then
@@ -102,8 +102,7 @@ CHECKTEMPSENSOR(){
if [ "${PW_SENSOR_TYPE[${1}]}" != "esxi" ]; then
average=$(AVERAGETEMP ${PW_SENSOR_ID[${1}]} ${avgdays})
else
AVERAGETEMP ${PW_SENSOR_ID[${1}]} ${avgdays} ${5}
# average=$(AVERAGETEMP ${PW_SENSOR_ID[${1}]} ${avgdays} ${5})
average=$(AVERAGETEMP ${PW_SENSOR_ID[${1}]} ${avgdays} ${5})
fi
else
average=''
@@ -176,9 +175,7 @@ AVERAGETEMP(){
else
WHERE="sensorid=${sensorid}"
fi
echo "HERE: ${1} - ${2} - ${3} - ${entityid}"
while IFS=$'\t' read date temp hum ;do
temptotal=$(bc <<< "scale=1; ${temptotal}+${temp}")
((logsfound++))