Network UPS Tools (NUT) For USB UPSs On CentOS 5.5
This tutorial shows how to configure and use Network UPS Tools (NUT) software with an USB (Uninterruptible Power Supply) on CentOS 5.5. NUT is a software which supports several thousand models. To check if your UPS is supported, this is the link to the HCL: http://www.networkupstools.org/stable-hcl.html
Install NUT dependencies:
yum install net-snmp-libs gd httpd
Download the latest CentOS NUT rpm release for your architecture from: http://geekery.blog.com/category/linux/nut-ups-rpms/
NOTE: you can also download NUT from EPEL repository or the tarball directly from the NUT official site (http://www.networkupstools.org/)
Install downloaded rpms:
rpm -Uvh nut-2.6.0-2geekery.$(uname -i).rpm nut-cgi-2.6.0-2geekery.$(uname -i).rpm nut-client-2.6.0-2geekery.$(uname -i).rpm powerman-2.3.5-2geekery.$(uname -i).rpm
This is the configuration for my Eaton Powerware 5115 USB UPS. Edit the driver controller configuration file, choosing the correct driver for your UPS. You can read on the HCL which is the right driver to use. My UPS it isn't officially supported, but I found that the bcmxcp_usb driver works well, so I defined a new UPS section that begins with the name of the UPS in brackets (in my case: 5115), followed by the driver (bcmxcp_usb) and the port device (with USB UPSs choose automatic port detection).
 driver = bcmxcp_usb port = auto
Now choose your NUT running mode: I chose standalone mode because the UPS is power supplying only one server, but you can also use NUT in network client/server mode.
MODE = standalone
Configure the IP address and port where upsd daemon listens for. The upsd.conf file control access to the server and some other parameters. In a standalone installation you can leave it at default configuration, listening to localhost.
LISTEN 127.0.0.1 3493
Now define a upsmon user/password in upsd.users file. The user I define is "local_mon" with password "PASSWORD" and upsmon role "master". We will use this user with the upsmon component of NUT.
[local_mon] password = PASSWORD upsmon master
Upsmon is the UPS monitor and shutdown controller that will monitor and tell how to shut down the system when necessary. Edit the MONITOR directive inserting the UPS name defined in ups.conf, followed by the IP address or hostname configured in upsd.conf and by the credentials and upsmon role defined in upsd.users. Leave the other directives to the default values specified.
MONITOR 5115@localhost 1 local_mon PASSWORD master MINSUPPLIES 1 SHUTDOWNCMD "/sbin/shutdown -h +0" POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 15 DEADTIME 15 POWERDOWNFLAG /etc/killpower RBWARNTIME 43200 NOCOMMWARNTIME 300 FINALDELAY 5
If you you installed a NUT rpm release from http://geekery.blog.com/category/linux/nut-ups-rpms/ you can find a nut udev rule file for CentOS at this path: /lib/udev/rules.d/62-nut-usbups.rules
If you are installing a USB UPS, softlink this file in udev rules directory:
ln -s /lib/udev/rules.d/62-nut-usbups.rules /etc/udev/rules.d/62-nut-usbups.rules
and reload udev rules and trigger device detection with these commands: