Update power.inc.sh

This commit is contained in:
2024-01-12 19:20:45 -06:00
parent 32edda3ddd
commit c988bebb62

View File

@@ -866,16 +866,15 @@ PDUCONTROL(){
PORT_POWER=$(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 -O vq 2> /dev/null | sed -e 's/"//g')
IFS=$'\n'
read -rd '' -a PORT_DESC <<<"${PORT_DESC}"
read -rd '' -a PORT_POWER <<<"${PORT_POWER}"
unset IFS
p=1
for port in "${!PORT_DESC[@]}"; do
echo "HERE: $port - ${PORT_POWER[${port}]} - ${PORT_DESC[${port}]}"
p=$(expr ${port} + 1)
[ ${PORT_POWER[${p}]} -eq 1 ] && portpower_disp="${idsCL[Green]}ON" || portpower_disp="${idsCL[LightRed]}OFF"
[ ${p} -lt 10 ] && pp=" ${p}" || pp=${p}
# c=0; spc=''; spc1=`expr 28 - ${#port}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
spc=" "
# echo -e "${pp}) ${idsCL[LightCyan]}${PORT_DESC[${port}]}${spc}${idsCL[Default]}: ${portpower_disp}${idsCL[Default]}"
# ((p++))
done
echo -e ""