Update powerwall.sh

This commit is contained in:
2023-12-11 21:56:25 -06:00
parent 143cf29fb3
commit a13e437c90

View File

@@ -547,18 +547,18 @@ CHECKPOWER(){
rm -f ${PW_TMPFOLDER}/*.hostpower* rm -f ${PW_TMPFOLDER}/*.hostpower*
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
-avg) avgdays=${2};; -a|-avg) avgdays=${2};;
-offsite) STYPE=offsite;; -o|-offsite) STYPE=offsite;;
-mainsite) STYPE=mainsite;; -m|-mainsite) STYPE=mainsite;;
-hosts) PTYPE=hosts;; -e|-esxi) PTYPE=esxi;;
-power) PTYPE=power;; -p|-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 ([ "${STYPE}" == "" ] || [ "${STYPE}" == "mainsite" ]) && [ "${PTYPE}" != "hosts" ]; then if ([ "${STYPE}" == "" ] || [ "${STYPE}" == "mainsite" ]) && [ "${PTYPE}" != "esxi" ]; 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}"
@@ -696,7 +696,7 @@ CHECKPOWER(){
fi fi
if ([ "${STYPE}" == "" ] || [ "${STYPE}" == "offsite" ]) && [ "${PTYPE}" != "hosts" ]; then if ([ "${STYPE}" == "" ] || [ "${STYPE}" == "offsite" ]) && [ "${PTYPE}" != "esxi" ]; then
DIVIDER . yellow 75 DIVIDER . yellow 75
echo -e "${idsCL[Yellow]}Offsite Power Information ${avgdayshdr}" echo -e "${idsCL[Yellow]}Offsite Power Information ${avgdayshdr}"
@@ -2311,11 +2311,22 @@ fi
checktemp) CHECKTEMP ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};; checktemp) CHECKTEMP ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};;
checkpower) CHECKPOWER ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};; checkpower) CHECKPOWER ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};;
check) check)
if [ "${2}" = "power" ]; then case ${2} in
CHECKPOWER ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} power) CHECKPOWER ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};;
elif [ "${2}" = "temp" ]; then temp) CHECKTEMP ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};;
CHECKTEMP ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} -h|-help)
fi echo -e "Usage: ${idsCL[Yellow]}[powerwall or pw] check {type} {flags} ${idsCL[Default]} {"
width=35
printf "%-${width}s- %s\n" " {type}" "{power / temp} To check either power or temperatures"
printf "%-${width}s- %s\n" " -a|-avg {#days}" "Show average values for X number of days"
printf "%-${width}s- %s\n" " -m|-mainsite" "Narrow to Mainsite Equipment"
printf "%-${width}s- %s\n" " -o|-offsite" "Narrow to Offsite Equipment"
printf "%-${width}s- %s\n" " -p|-power" "Narrow to Power Equipment"
printf "%-${width}s- %s\n" " -e|-esxi" "Narrow to ESXi Hosts"
echo -e "}\n"
exit 0
;;
esac
;; ;;
test) CHECKTEMP ${2} ${3};; test) CHECKTEMP ${2} ${3};;
iscsi-vm-shutdown) iscsi-vm-shutdown)