APC Master Switch SNMP Control
From KoshWiki
Contents |
Origin
Quite a while ago I had to write a script to remotely control the ports on a AP9212 APC Masterswitch, I have long since lost the code but, I had to recreate the process for a new AP7951.
I grabbed the freebsd package "apcpwr"[1] to get the values again.
Description
An APC Masterswitch is a remote controlled powerboard with the ability to turn points on and off (or reboot) via http/telnet/snmp (and now https/ssh and some others)
SNMP, the way of the tiger
A console to turn a port on and off is snazzy, if you want to script it, wget just won't cut it.
Using the closest linux box with the snmp tools installed
The following command would restart (or delayed start) port 20
# snmpset -v 1 -c community hostname 1.3.6.1.4.1.318.1.1.4.4.2.1.3.20 i 3 SNMPv2-SMI::enterprises.318.1.1.4.4.2.1.3.20 = INTEGER: 3
We can also set the name of the outlet (in this case "Outlet 1" changes to "really cool outlet 1")
# snmpset -v 1 -c community hostname 1.3.6.1.4.1.318.1.1.12.3.4.1.1.2.1 s "really cool outlet 1" SNMPv2-SMI::enterprises.318.1.1.12.3.4.1.1.2.1 = STRING: "really cool outlet 1"
Stuff the Explanation, give me OIDs
| Outlet Names | 1.3.6.1.4.1.318.1.1.12.3.4.1.1.2. |
| Power Control and Status | 1.3.6.1.4.1.318.1.1.4.4.2.1.3. |
| Textual State of Ports (one long string) | 1.3.6.1.4.1.318.1.1.4.2.2.0 |
Values for Control
| On | 1 |
| Off | 2 |
| Reboot | 3 |
