Apcupsd is the daemon which will monitor your UPS to shutdown the system when the UPS' power is going to fail. The homepage for apcupsd, http://www.apcupsd.com/, has very helpful documentation for doing complicated setups.
- An APC UPS. Apcupsd works with most of APC's Smart-UPS models as well as most simple signalling models such a Back-UPS, and BackUPS-Office.
First of all, we have to install apcupsd package. Install the
apcupsd package in the Synaptic Package Manager. See SynapticHowto. If you want to see the stat of the UPS through the browser, you can also install
Edit the file
/etc/apcupsd/apcupsd.conf which by default includes good comments on usage:
UPSCABLEyou have to specify the type of cable connecting the UPS to your computer. Read the comments in the file to see which possibilities you have. For example, if the UPS used is the APC Back-UPS ES 700V, you have to write
- You must also look for and modify the
UPSTYPE. The comments in the file describes the different possibilities available. You may choose the appropriate one. Again, from our example of an APC Back-UPS ES 700V, you would write
- The final setting you must fix is
DEVICE. As the comments note, with a
usbtype UPS apcupsd can autodetect the device, so you should comment out the
DEVICEsetting (by putting a '#' in front of it). Otherwise, you will need to know which
/devnode your device is connected to. If your UPS cable is a serial type then your device may be something like
Then you must edit the file
/etc/default/apcupsd and change the
no of the
ISCONFIGURED with a
Once you have apcupsd configured, running and the device connected to your computer you will be able to check on the status of the device using the
apcaccess command. Output from the command will vary based on the type of UPS you have. Most likely, the better the UPS the more detailed the information you will get.
Optionally, if you want your computer to reboot after a power fail, you must edit the
/etc/init.d/halt due a bug that it has. You must change the
The following applies to Drapper Drake (LTS 6.06), but does not apply to most Ubuntu default setups, where /usr is simply part of the root filesystem. You only need to do this if the /usr filesystem has a separate entry in /etc/fstab:
- You need to uncomment the line 10 in file "/etc/apcupsd/killpower" which means changing "mount -n -o ro /usr" to "mount -n -o ro /usr"
- This will ensure that the shared libraries libcrypto.so.0.9.8, libnetsnmp.so.9, libstdc++.so.6 and libz.so.1 are visible to apcupsd after shutdown when it runs "/etc/apcupsd/apccontrol killpower" to shut off the ups power otherwise the UPS will stay on and your system will not automatically reboot when utility power returns.
The following changes to a Ubuntu system should allow APCUPSD-CGI web interface to be accessible. Note that for this to work you MUST have Apache2 installed and configured properly for your Ubuntu system. Start by installing the apcupsd-cgi package with: sudo apt-get install apcupsd-cgi This will drop several files into /usr/lib/cgi-bin/apcuspd. For this to work you MUST have CGI enabled in your Apache configuration and the CGI directory should be pointed at /usr/lib/cgi-bin/ The only thing left is to go to the web address: http://localhost/cgi-bin/apcupsd/multimon.cgi