Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > db8d50b45fb15e865b7becf99650beea > files > 19

powerman-2.3.25-1.mga7.armv7hl.rpm

# 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> "
	}		
}