Friday, June 1, 2012

Apcupsd is a UPS control system that permits orderly shutdown of your computer in the event of a power failure. We will take a look at NIS (Network Information Server) server and client configuration (this is the case when a single UPS powers several computers).

Server

NIS (Network Information Server) mode allows communication between different hosts. Only one of those hosts, the server, needs to talk to the UPS directly.

Ensure device is connected and recognized. In most cases your UPS is connected to server via USB cable. In Linux you can check this by listing USB devices (provided by usbhid driver):

deby1:~# ls /dev/usb/
hiddev0

If your device is no connected, most likely, you will get a message like this:

ls: cannot access /dev/usb/: No such file or
directory

Note, in our case the UPS device is available at /dev/usb/hiddev0.

Install UPS monitoring software. Apcupsd is a software designed to control APC UPS devices, let get it installed:

Notifications

You are able receive a number of notification events, e.g. power failure, etc (see a complete list of events here). By default apcupsd calls script located at /etc/apcupsd/apccontrol. This script echo some events to user console, as well as shuts down host per doshutdown event. You can easily extend this script to email you events. Here is the script (file /usr/local/sbin/notify.sh):

About Me

- Since 1999 in IT. Software architect, business analyst and team lead with a well-balanced combination of business, management and technical skills.
- Solid understanding of the software engineering process, its underlying principles and best practices. Extensive experience in implementing, using, and mentoring teams utilizing Scrum. Technical leading teams of 4 – 20, multi-project target and cross teams.
- Much experience with human-factor usability design for GUIs.
- Excellent communication skills and extensive customer contact.