Update powerwall.sh

This commit is contained in:
2023-12-03 12:11:18 -06:00
parent 1fccd01207
commit f98f4d47f4

View File

@@ -744,8 +744,9 @@ CHECKPOWER(){
IFS=$'\n'
read -rd '' -a HOST_WATT_SENSORS <<<"${HOST_WATT_SENSORS}"
unset IFS
PS1='0.0'; PS2='0.0'; HOST_WATTS=0
if [ "${HOST_WATT_SENSORS}" != "" ]; then
found=0; PS1='0.0'; PS2='0.0'
found=0
for s in {1..5}; do
DP=$(snmpwalk -t 1 -r 0 -v 1 -c public ${PW_HOST_IDRACS[${SENSOR}]} iso.3.6.1.4.1.674.10892.5.4.600.30.1.8.1.${s} | sed 's/.*: //')
if [[ "${DP}" = *"System Board"* ]]; then
@@ -762,7 +763,7 @@ CHECKPOWER(){
[ "${PS1}" != "0.0" ] && PS1=`echo "scale=1; ${PS1}/10" | bc` && (( $(bc <<<"${PS1} < 1") )) && [[ "${PS1}" = *"."* ]] && PS1="0${PS1}"
[ "${PS2}" != "0.0" ] && PS2=`echo "scale=1; ${PS2}/10" | bc` && (( $(bc <<<"${PS2} < 1") )) && [[ "${PS2}" = *"."* ]] && PS2="0${PS2}"
HOST_AMPS=`echo "scale=1; ${PS1}+${PS2}" | bc`
[[ "${HOST_WATTS}" = *"Timeout"* ]] && HOST_WATTS_disp="${idsCL[LightRed]}Host Offline" || HOST_WATTS_disp="${idsCL[Green]}${HOST_AMPS}'amps - `IDS_NUMBER_FORMAT ${HOST_WATTS}`'watts"
HOST_WATTS_disp="${idsCL[Green]}${HOST_AMPS}'amps - `IDS_NUMBER_FORMAT ${HOST_WATTS}`'watts"
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"