2 CONFIG
="/etc/vzt/vzt-pductl.cfg"
11 echo "$0: pdu control tool"
12 echo "Usage: $0 <lsall/ls/reboot> <pdu_host> [options]"
14 echo "list all socket status on pdu00.qa"
15 echo " $0 lsall pdu00.qa"
16 echo "get 15th socket power status on pdu00.qa"
17 echo " $0 ls pdu00.qa 15"
18 echo "reboot 15th socket pdu00.qa"
19 echo " $0 reboot pdu00.qa 15"
24 #######################################################################
25 ################### pdu speciffic functions section ###################
28 function power_net_mib
35 lsall
) snmptable
-c private
-v 1 $pdu_host -m +PowerNet-MIB \
36 rPDUOutletStatusTable
;;
37 ls ) snmpget
-c private
-v 1 -m +PowerNet-MIB
$pdu_host \
38 rPDUOutletControlOutletCommand.
$host;;
39 reboot
) snmpset
-c private
-v 1 -m +PowerNet-MIB
$pdu_host \
40 rPDUOutletControlOutletCommand.
$host = immediateReboot
;;
41 on
) snmpset
-c private
-v 1 -m +PowerNet-MIB
$pdu_host \
42 rPDUOutletControlOutletCommand.
$host = immediateOn
;;
43 off
) snmpset
-c private
-v 1 -m +PowerNet-MIB
$pdu_host \
44 rPDUOutletControlOutletCommand.
$host = immediateOff
;;
45 * ) echo "Unknown action";
54 while read name cfg_func
;do
55 if [ "$name" == "$PDU_HOST" ];then
56 $cfg_func $PDU_HOST $ACTION $@
61 echo "Cant find $PDU_HOST in $CONFIG file"