Skip to content


Subversion checkout URL

You can clone with
Download ZIP
APC power switch automation
Branch: master


Markdown documentation
latest commit 0da53c7bb5
@quackenbush authored
Failed to load latest commit information.
.gitignore Added .gitignore and added README in Markdown format Update Cleaned up APC codebase Initial commit

APC Network Power Management Controller

Payton Quackenbush

Controls rebooting of APC network PDU switches with 'telnet' network interface. Tested with the AP7900, but likely works with other models.

This handles locking of the device so that parallel calls will block, since APC has a single telnet session.


  • Python 2.x
  • Python Expect (pexpect) library
  • APC with telnet network interface (tested on AP7900)


No source installation required. Just download and run.

The APC needs to be set up with telnet enabled, and using a fixed IP address. If a DHCP address is used, it may change, and you will have trouble connecting.


Power cycle (reboot) a single port

$ ./ --reboot PORT

Example: reboot power port 1

$ ./ --reboot 1

Display help

$ ./ --help

usage: [-h] [--host HOST] [-v] [--quiet] [--user USER]
              [--password PASSWORD] [--debug] [--reboot REBOOT] [--off OFF]
              [--on ON]

APC Python CLI

optional arguments:
  -h, --help           show this help message and exit
  --host HOST          Override the host
  -v, --verbose        Verbose messages
  --quiet              Quiet
  --user USER          Override the username
  --password PASSWORD  Override the password
  --debug              Debug mode
  --reboot REBOOT      Reboot an outlet
  --off OFF            Turn off an outlet
  --on ON              Turn on an outlet

Example session

$ ./ --reboot 8
Acquiring lock /tmp/apc.lock
Connecting to APC @
Logged in as user apc, version 3.7.3
APC Outlet #8 Rebooted
Something went wrong with that request. Please try again.