Update power.inc.sh

This commit is contained in:
2024-01-13 10:00:00 -06:00
parent 8a845abf2c
commit 4cfedf6f31

View File

@@ -307,13 +307,11 @@ CHECKPOWER(){
elif [ "$(ipmitool -I lanplus -H ${PW_HOST_IDRACS[${SENSOR}]} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" chassis power status | grep off)" != "" ]; then
HOST_WATTS_disp="${idsCL[LightRed]}Host powered down"
HOST_WATTS=-1
elif [ "${HOST_WATTS}" == "0" ]; then
HOST_WATTS_disp="${idsCL[Yellow]}Host PSU not capable"
HOST_WATTS=-2
else
HOST_WATTS_disp="${idsCL[LightRed]}Could not pull data"
fi
[ "${HOST_WATTS}" == "" ] && HOST_WATTS=0
@@ -335,7 +333,7 @@ CHECKPOWER(){
fi
fi
# if [ ${HOST_WATTS} -gt 0 ]; then
if [ "${avgdays}" != "" ]; then
if [ "${avgdays}" != "" ] && [ ${HOST_WATTS} -ne -2 ]; then
echo -en "${idsCL[LightYellow]} Calculating average ...${idsCL[Default]}"
average=$(AVERAGEPOWER ${PW_POWERSENSOR_ID[${SENSOR}]} ${avgdays} both)
average_amp=$(echo ${average} | cut -d'~' -f 1)