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 54 55 56 57
|
# Baytech RPC3-NC via SNMP (also can drive with baytech-rpc3-nc.dev)
#
# Snmp v1 or v2c works.
#
# N.B. Occasionally snmp agent locks up and must be restarted by telnet or
# serial: ;;;;; then Network Interface Module Login, then Unit Reset.
#
# Example device entry:
# device "b" "baytech-snmp" "/usr/sbin/snmppower -h 192.168.1.95|&"
specification "baytech-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_v2c private\n"
expect "snmppower> "
}
script logout {
send "finish\n"
expect "snmppower> "
}
script status_all {
send "get enterprises.4779.1.3.5.5.1.13.2.1\n"
expect "enterprises.4779.1.3.5.5.1.13.2.1: (0|1),(0|1),(0|1),(0|1),(0|1),(0|1),(0|1),(0|1)\n"
setplugstate "1" $1 off="0" on="1"
setplugstate "2" $2 off="0" on="1"
setplugstate "3" $3 off="0" on="1"
setplugstate "4" $4 off="0" on="1"
setplugstate "5" $5 off="0" on="1"
setplugstate "6" $6 off="0" on="1"
setplugstate "7" $7 off="0" on="1"
setplugstate "8" $8 off="0" on="1"
expect "snmppower> "
}
script on {
send "set enterprises.4779.1.3.5.3.1.3.1.%s i 1\n"
expect "enterprises.4779.1.3.5.3.1.3.1.[1-8]: 1\n"
expect "snmppower> "
}
script off {
send "set enterprises.4779.1.3.5.3.1.3.1.%s i 0\n"
expect "enterprises.4779.1.3.5.3.1.3.1.[1-8]: 0\n"
expect "snmppower> "
}
script cycle {
send "set enterprises.4779.1.3.5.3.1.3.1.%s i 0\n"
expect "enterprises.4779.1.3.5.3.1.3.1.[1-8]: 0\n"
expect "snmppower> "
delay 5
send "set enterprises.4779.1.3.5.3.1.3.1.%s i 1\n"
expect "enterprises.4779.1.3.5.3.1.3.1.[1-8]: 1\n"
expect "snmppower> "
}
}
|