Update powerwall.sh

This commit is contained in:
2023-11-04 11:29:43 -05:00
parent 6e11549ab5
commit 84a7ecc893

View File

@@ -33,7 +33,7 @@ CHECKTEMP(){
vHOSTIP=${PW_HOST_ADDRESSES[${SENSOR}]}
vHOSTNAME=${PW_ESXI_HOST_NAMES[${vHOSTiDRACIP}]}
echo -e "\r\033[K${idsCL[LightCyan]}${idsST[Bold]}${SENSOR} Host Sensors ${idsST[Reset]}${idsCL[LightCyan]}- ${vHOSTiDRACIP}${idsCL[Default]}"
[ "${1}" != "noavg" ] && echo -en "${idsCL[Yellow]}Pulling data and calculating averages for '${SENSOR}' ..." || echo -en "${idsCL[Yellow]}Pulling data 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' | sed -e 's/ Temp//g')
@@ -61,8 +61,12 @@ CHECKTEMP(){
temp_warn=`echo "scale=1; ${temp_warn}/10" | bc`
temp_crit=$(snmpwalk -v 1 -c public -t 2 10.10.2.20 .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`
reading=$(CHECKTEMPSENSOR ${SENSOR} ${temp_c} ${temp_warn} ${temp_crit} ${sensorname// /_} ${1})
c=0; spc=''; spc1=`expr ${cw} - ${#sensorname} - 1`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
[ "${1}" != "noavg" ] && [ "${1}" != "" ] && echo -en "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: Calculating ${1} Day average"
reading=$(CHECKTEMPSENSOR ${SENSOR} ${temp_c} ${temp_warn} ${temp_crit} ${sensorname// /_} ${1})
[ "${1}" != "noavg" ] && [ "${1}" != "" ] && echo -en "\r\033[K"
echo -e "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${reading}"
((t++))