UPS Setup & Documentation

Description

This page covers setting up a UPS in Ubuntu, specifically related to my setup and UPS from APC.

Prerequisites

  • A working ubuntu system
  • A supported APC UPS
  • apcupsd

Installation

First, install the apcupsd package if not already installed. This package contains the tools and daemon necessary for communicating with the APC UPS.
sudo apt-get install apcupsd

Configuration

We need to edit two files to configure and enable the apcupsd daemon.
  • The first file controls the configuration for the UPS type and port.
  • The second file controls the daemon and prevents is from running unconfigured.
Let's open the first file, containing the apcupsd configuration.
sudo nano /etc/apcupsd/apcupsd.conf
Change the following parameters (adjust as necessary for your UPS). For my UPS, I have a usb model and the below are the settings for my setup.
UPSNAME UPS550
UPSCABLE usb
UPSTYPE usb
DEVICE 
POLLTIME 60
Now we can enable the daemon to start on boot and become active by editing the following.
sudo nano /etc/default/apcupsd
Change the following parameter from 'no' to 'yes'.
ISCONFIGURED=yes
Then restart the apcupsd daemon.
sudo service apcupsd restart
If all went well, you can check the status of the apcupsd service (daemon).
sudo service apcupsd status
And you should see something like the below snippit, showing the service is active (running)
apcupsd.service - LSB: Starts apcupsd daemon
   Loaded: loaded (/etc/init.d/apcupsd)
   Active: active (running) since Mon 2016-05-02 15:40:02 NDT

Testing

To test the APC UPS driver, you will need to stop the service first, otherwise the test will be unable to connect to the UPS.
sudo service apcupsd stop
Now run the APC test program.
sudo apctest
The tests listed below are pretty self-explanatory. For more information, please refer to the Ubuntu community docs or the main apcupsd site.
Please select the function you want to perform.

1)  Test kill UPS power
2)  Perform self-test
3)  Read last self-test result
4)  View/Change battery date
5)  View manufacturing date
6)  View/Change alarm behavior
7)  View/Change sensitivity
8)  View/Change low transfer voltage
9)  View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
 Q) Quit

Select function number:
Remember to restart the UPS service once completed with apctest.
sudo service apcupsd start