1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
# APC Masterswitch Plus via SNMP (also can drive with apcnew.dev)
# Seems to require snmp v1
# Tricky: write 1 for on, 2 for off
specification "apc-snmp" {
timeout 10 # about 5 sec for cycle command
plug name { "1" "2" "3" "4" "5" "6" "7" "8" }
script login {
expect "snmppower> "
send "start_v1 private\n"
expect "snmppower> "
}
script logout {
send "finish\n"
expect "snmppower> "
}
# PowerNet-MIB::sPDUMasterState.0
script status_all {
send "get enterprises.318.1.1.4.2.2.0\n"
expect "enterprises.318.1.1.4.2.2.0: (On|Off)[[:space:]]+(On|Off)[[:space:]]+(On|Off)[[:space:]]+(On|Off)[[:space:]]+(On|Off)[[:space:]]+(On|Off)[[:space:]]+(On|Off)[[:space:]]+(On|Off)[[:space:]]*\n"
setplugstate "1" $1 off="Off" on="On"
setplugstate "2" $2 off="Off" on="On"
setplugstate "3" $3 off="Off" on="On"
setplugstate "4" $4 off="Off" on="On"
setplugstate "5" $5 off="Off" on="On"
setplugstate "6" $6 off="Off" on="On"
setplugstate "7" $7 off="Off" on="On"
setplugstate "8" $8 off="Off" on="On"
}
# PowerNet-MIB::sPDUOutletControl.sPDUOutletControlTable.
# sPDUOutletControlEntry.sPDUOutletCtl.<outlet:1-8>
script on {
send "set enterprises.318.1.1.4.4.2.1.3.%s i 1\n"
expect "enterprises.318.1.1.4.4.2.1.3.[1-8]: 1\n"
expect "snmppower> "
}
script off {
send "set enterprises.318.1.1.4.4.2.1.3.%s i 2\n"
expect "enterprises.318.1.1.4.4.2.1.3.[1-8]: 2\n"
expect "snmppower> "
}
script cycle {
send "set enterprises.318.1.1.4.4.2.1.3.%s i 2\n"
expect "enterprises.318.1.1.4.4.2.1.3.[1-8]: 2\n"
expect "snmppower> "
delay 5
send "set enterprises.318.1.1.4.4.2.1.3.%s i 1\n"
expect "enterprises.318.1.1.4.4.2.1.3.[1-8]: 1\n"
expect "snmppower> "
}
}
|