Update powerwall.sh

This commit is contained in:
2023-12-03 11:20:04 -06:00
parent 8622f1eb96
commit f430cc09e1

View File

@@ -531,16 +531,17 @@ CHECKPOWER(){
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
-avg) avgdays=${2};; -avg) avgdays=${2};;
-offsite) PTYPE=offsite;; -offsite) STYPE=offsite;;
-mainsite) PTYPE=mainsite;; -mainsite) STYPE=mainsite;;
-hosts) PTYPE=hosts;; -hosts) PTYPE=hosts;;
-power) PTYPE=power;;
esac esac
shift 1 shift 1
done done
[ "${avgdays}" = "0" ] && unset avgdays [ "${avgdays}" = "0" ] && unset avgdays
[ "${avgdays}" != "" ] && avgdayshdr="${avgdays}-Day-Avg" || avgdayshdr="" [ "${avgdays}" != "" ] && avgdayshdr="${avgdays}-Day-Avg" || avgdayshdr=""
if [ "${PTYPE}" == "" ] || [ "${PTYPE}" == "all" ] || [ "${PTYPE}" == "mainsite" ]; then if ([ "${STYPE}" == "" ] || [ "${STYPE}" == "mainsite" ]) && [ "${PTYPE}" != "hosts" ]; then
echo echo
DIVIDER . yellow 75 DIVIDER . yellow 75
echo -e "${idsCL[Yellow]}Mainsite Power Information ${avgdayshdr}" echo -e "${idsCL[Yellow]}Mainsite Power Information ${avgdayshdr}"
@@ -665,8 +666,7 @@ CHECKPOWER(){
fi fi
if ([ "${STYPE}" == "" ] || [ "${STYPE}" == "offsite" ]) && [ "${PTYPE}" != "hosts" ]; then
if [ "${PTYPE}" == "" ] || [ "${PTYPE}" == "all" ] || [ "${PTYPE}" == "offsite" ]; then
DIVIDER . yellow 75 DIVIDER . yellow 75
echo -e "${idsCL[Yellow]}Offsite Power Information ${avgdayshdr}" echo -e "${idsCL[Yellow]}Offsite Power Information ${avgdayshdr}"
@@ -726,7 +726,7 @@ CHECKPOWER(){
# echo # echo
fi fi
if [ "${PTYPE}" != "power" ]; then
DIVIDER . yellow 75 DIVIDER . yellow 75
echo -e "${idsCL[Yellow]}ESXi Host Power Information ${avgdayshdr}" echo -e "${idsCL[Yellow]}ESXi Host Power Information ${avgdayshdr}"
DIVIDER . yellow 75 DIVIDER . yellow 75
@@ -734,7 +734,7 @@ CHECKPOWER(){
for SENSOR in ${PW_SENSOR_ORD[@]}; do for SENSOR in ${PW_SENSOR_ORD[@]}; do
if [ "${PW_HOST_IDRACS[${SENSOR}]}" != "" ]; then if [ "${PW_HOST_IDRACS[${SENSOR}]}" != "" ]; then
gochk=0 gochk=0
if [ "${PTYPE}" == "" ] || [ "${PTYPE}" == "hosts" ] || ([ "${PTYPE}" == "mainsite" ] && [[ "${PW_HOST_IDRACS[${SENSOR}]}" = *"10.10."* ]]) || ([ "${PTYPE}" == "offsite" ] && [[ "${PW_HOST_IDRACS[${SENSOR}]}" = *"10.2.1."* ]]); then if ([ "${STYPE}" == "mainsite" ] && [[ "${PW_HOST_IDRACS[${SENSOR}]}" = *"10.10."* ]]) || ([ "${STYPE}" == "offsite" ] && [[ "${PW_HOST_IDRACS[${SENSOR}]}" = *"10.2.1."* ]]); then
gochk=1 gochk=1
fi fi
if [ ${gochk} -eq 1 ]; then if [ ${gochk} -eq 1 ]; then
@@ -787,6 +787,7 @@ CHECKPOWER(){
fi fi
fi fi
done done
fi
end=`date +%s`; runtime=$((end-start)); echo -e "\nruntime: ${runtime}" end=`date +%s`; runtime=$((end-start)); echo -e "\nruntime: ${runtime}"