APC MasterSwitch Controllers
============================

Our racks have APC MasterSwitch units installed.  These allow us to turn 
on and off the power to particular plugs.  While the BMC is ususally a better
way to do power control, some machines (old 1U servers) do not have BMCs, or
the BMC may be the problem.

There are two APC units, one for each rack.  They are apc-left and apc-right, 
labeled by which rack they are in as you face the front.  

Magellan's Scripting
--------------------

``/usr/local/bin/set-power`` knows how to manipulate the controllers we use.
It is exported via remctl running on Magellan.

If you need to know the password to a strip controller, use
``/usr/local/bin/set-power.show-password`` on Magellan.  It knows how to use
the HMAC-based password scheme we use.

APC Configuration
-----------------

The controllers can be accessed via serial or telnet (we keep the web
interfaces disabled).  Once you're there, log in with username apc and password
derived via our scheme.  You are then able to navigate a menu.

Naming outlets
~~~~~~~~~~~~~~

Once you get to a list of outlets, you'll note that they can be named
(and some are).  Each outlet should be named for the machine which is plugged
in to it.  To rename an outlet, starting just after selecting the outlet:

* Press 2 - configure
* Press 1 - Outlet Name
* Type in the new name
* Press 5 - Accept Changes

And you're done.  Keeping the names of the outlets up to date will be
extraordinarily helpful in not missing if someone needs to force reboot a
server.

Factory Restore Over The Network
--------------------------------

Thanks to http://mccltd.net/blog/?p=36 for this section.

.. warning:: **Do not put your APC MasterSwitch controllers on public
   networks**.  This can not be stated emphatically enough.

Telnetting to your APC device, or connect over the serial port, and using the
password ``TENmanUFactOryPOWER`` (very clever; any user name will do) will get
you the ``Factory Menu``.  Entering ``13`` will bring you to an EEPROM dumping
tool which accepts hex addresses; usernames and passwords will be readable near
``1d0``.

Apparently it is also always possible to use ``apc`` as both the user and
password within the first 30 seconds of the device being powered on.  Oi.