Installing and configuring apcupsd (UPS Management Software)

apcupsd is a Uninterruptible power supply (UPS) management software.
With apcupsd your computer on a UPS can be shutdown safely when there is a power loss. After the UPS battery is drained to a certain level we can set this software to safely shutdown the computer.
It is possible to manage only UPS which has a data port (USB, Serial, Ethernet).
This exmaple is illustrated based on a APC Back-UPS ES 500 UPS which has a USB data port.
There are alternatives available for apcupsd such as Network UPS Tools (NUT) and PowerD. I was able to successfully install and configure only apcupsd so far.
I also found that if NUT is installed, apcupsd stops working.

Install apcupsd

In /etc/default/apcupsd chane 'ISCONFIGURED=no' to 'ISCONFIGURED=yes'

Edit /etc/apcupsd/apcupsd.conf

Change the values as below,

My apcupsd.conf can be found at Downloads

Restart apcupsd

Check UPS status,

If you like a web interface where you can check UPS status, install apcupsd-cgi. Note: You need to have apache2 installed and running.

Edit /etc/apache2/apache2.conf and add line 'ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/' to it

Restart apache2

You can check the status at http://YOUR_SERVER_IP/cgi-bin/apcupsd/multimon.cgi