Update powerwall.sh
This commit is contained in:
28
powerwall.sh
28
powerwall.sh
@@ -1568,6 +1568,33 @@ HOSTPOWER(){
|
|||||||
echo -e "\n"
|
echo -e "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PDUCONTROL(){
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-port) PORTSEL=${2};;
|
||||||
|
esac
|
||||||
|
shift 1
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
DIVIDER . yellow 75
|
||||||
|
echo -e "${idsCL[Yellow]}APC-PDU Power Control"
|
||||||
|
DIVIDER true yellow 75
|
||||||
|
|
||||||
|
if [ "${PORT}" == "" ]; then
|
||||||
|
PORT_DESC=$(snmpwalk -t 1 -r 0 -v 1 -c public ${PW_APCPDU_IP} .1.3.6.1.4.1.318.1.1.12.3.3.1.1.2 -O vq 2> /dev/null | sed -e 's/"//g')
|
||||||
|
IFS=$'\n'
|
||||||
|
read -rd '' -a PORT_DESC <<<"${PORT_DESC}"
|
||||||
|
unset IFS
|
||||||
|
p=1
|
||||||
|
for port in "${PORT_DESC[@]}"; do
|
||||||
|
portpower=$(snmpwalk -t 1 -r 0 -v 1 -c public ${PW_APCPDU_IP} .1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.${p} -O vq 2> /dev/null | sed -e 's/"//g')
|
||||||
|
[ ${portpower} -eq 1 ] && portpower_disp="${idsCL[Green]}ON" || portpower_disp="${idsCL[LightRed]}OFF"
|
||||||
|
[ ${p} -lt 10 ] && pp=" ${p}" || pp=${p}
|
||||||
|
echo -e "${ii}) ${idsCL[LightCyan]}${port} - ${portpower_disp}${idsCL[Default]}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
LOGROTATE(){
|
LOGROTATE(){
|
||||||
STOPALL_SERVICES
|
STOPALL_SERVICES
|
||||||
lm=`expr $(date +'%m') - 1`
|
lm=`expr $(date +'%m') - 1`
|
||||||
@@ -1696,6 +1723,7 @@ fi
|
|||||||
shutdownhost) SHUTDOWN_SERVER ${2};;
|
shutdownhost) SHUTDOWN_SERVER ${2};;
|
||||||
shutdown_servers) SHUTDOWN_SERVERS ${2} ${3};;
|
shutdown_servers) SHUTDOWN_SERVERS ${2} ${3};;
|
||||||
hostpower) HOSTPOWER ${2} ${3};;
|
hostpower) HOSTPOWER ${2} ${3};;
|
||||||
|
pdu) PDUCONTROL ${2} ${3};;
|
||||||
|
|
||||||
get-snapshots) GET_SNAPSHOTS;;
|
get-snapshots) GET_SNAPSHOTS;;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user