UPS Monitoring

One of the things that I just hadn’t got around to after migrating to the new server was restoring my UPS monitoring.  The first time I set it up, it seemed pretty involved – partly because the version of Ubuntu I was using (Dapper) needed some special USB configuration.  Now that my server is on a more recent level of Ubuntu, it just works like it is supposed to.

The Ubuntu Community Documentation is well done and covers all the details.  Basically I needed to install apcupsd.  Reading through the known Linux USB issues listed on the APCUPSD site made my scratch my head a bit.  It tells you to check the file /proc/bus/usb/devices to see if the USB device is recognized.  My Ubuntu install doesn’t have this, I suspect it is due to usbfs not running.  The lsusb utility seems to find the device just fine:


$ lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 001: ID 0000:0000

So I figured I’d install and see what happened.

sudo apt-get install apcupsd apcupsd-cgi

You’ll note that I installed the CGI package as well so I can check in via the web, this is optional.  You do need to do some minor configuration, this is covered in detail by the Ubuntu Community Documentation on apcupsd.  In my case it was set UPSCABLE usb; UPSTYPE usb; and comment out DEVICE in the file /etc/apcupsd/apcupsd.conf.  Then change ISCONFIGURED to yes in the /etc/default/apcupsd file.

All that was left was to start the service:

sudo /etc/init.d/apcupsd start

and test it using apcaccess.  I’ll leave the cgi-bin setup as an exercise for the reader.

So why bother doing this at all?  Well, the apcupsd service (daemon) will shut down the machine in a controlled manner if there is an extended power failure, configured correctly it will also come back up when the power has been restored.  Logs are also generated to indicate when power failures have happened.   Knowing when, and how long the power was out is comforting.

Leave a Reply

Your email address will not be published. Required fields are marked *