Enabling APC UPS on Ubuntu 9.10

After several years of using an APC UPS I had to replace the system. Previously I never used the plug to the USB from the UPS to my Linux Server. Being the tinkerer that I am I decided it was time to get it to work on the server. Fortunately this was not a hard task.

Install APCUPSD by typing
$ sudo apt-get install apcupsd apcupsd-cgi

Once installation is completed you must configure it and start it up.

The apcupsd software has no menu entry. Using the Gnome desktop, open your terminal. Applications>Accessories>Terminal.
Now type:
$sudo gedit /etc/apcupsd/apcupsd.conf

A text editor opens up. Please note that the examples shown below are from my computer and you need to adapt them to your computer. Scroll down very slightly until you reach this section:

# Defines the type of cable connecting the UPS to your computer.
# Possible generic choices for are:
# simple, smart, ether, usb
# Or a specific cable model number may be used:
# 940-0119A, 940-0127A, 940-0128A, 940-0020B,
# 940-0020C, 940-0023A, 940-0024B, 940-0024C,
# 940-1524C, 940-0024G, 940-0095A, 940-0095B,
# 940-0095C, M-04-02-2000
Change the UPSCABLE to the one that matches your particular battery backup, in this and most cases change it to usb.

Scroll down to the next section:
# To get apcupsd to work, in addition to defining the cable
# above, you must also define a UPSTYPE, which corresponds to
# the type of UPS you have (see the Description for more details).
# You must also specify a DEVICE, sometimes referred to as a port.
# For USB UPS’s, please leave the DEVICE directive blank. For
# other UPS types, you must specify an appropriate port or address.
# UPSTYPE DEVICE Description
# apcsmart /dev/tty** Newer serial character device,
# appropriate for SmartUPS models using
# a serial cable (not USB).
# usb Most new UPS’s are USB.
# A blank DEVICE setting enables
# autodetection, which is th best choice
# for most installations.
# net hostname:port Network link to a master apcupsd
# through apcupsd’s Network Information
# Server. This is used if you don’t have
# a UPS directly connected to your computer.
# snmp hostname:port:vendor:community
# SNMP Network link to an SNMP-enabled
# UPS device. Vendor is the MIB used by
# the UPS device: can be “APC”, “APC_NOTRAP”
# or “RFC” where APC is the powernet MIB,
# “APC_NOTRAP” is powernet with SNMP trap
# catching disabled, and RFC is the IETF’s
# rfc1628 UPS-MIB. Port is usually 161.
# Community is “private”.
# dumb /dev/tty** Old serial character device for use
# with simple-signaling UPSes.

Again select the right options for your ups unit
Also, note that “# usb” is not literal, so don’t type just leave a blank space.

Now click the save button in the text editor and then close it.

Now keeping your terminal open type:
$sudo gedit /etc/default/apcupsd

# Apcupsd-devel internal configuration


See the “ISCONFIGURED=no”. Change the no to yes just like in my example.

Now click the save button in the text editor and then close the editor.

Keeping your terminal open type:
$sudo /etc/init.d/apcupsd restart

Look for any errors, if you don’t see anything great.

Keeping your terminal open type:
root@tardis:/etc/init.d# tail -f /var/log/
Sat Jun 12 11:32:31 EDT 2010 apcupsd 3.14.6 (16 May 2009) debian startup succeeded

By editing the two configuration files you can change various parameters. Don’t be shy to open them up and explore!

Comments are closed.