NUT

This is the the open source standard and while more complex than the APC tool, it much more powerful. It works with most models of UPS devices and can communicate over the network so that several systems can share a UPS and all handle events cleanly.

Installation

Ubuntu's LTS will have an older version that's not always compatible with newer UPS units, such as the Tripp Lite SmartPro (SMART500RT1U) for example. Add a repo to get an updated version


sudo add-apt-repository ppa:clepple/nut 
sudo apt-get update
sudo apt-get install nut

Configuration

Define the UPS device

sudo vim /etc/nut/ups.conf

[tripplite]
        driver = tripplite_usb
        port = auto

Configure the USB rules

lsusb

...
Bus 003 Device 003: ID 09ae:0001 Tripp Lite 
...

sudo vim /etc/udev/rules.d/90-nut-ups.rules

 tripplite 09ae:0001
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="09ae", ATTR{idProduct}=="0001", MODE="0660", GROUP="nut"

sudo service udev restart


Define the Service Account and the Monitor

sudo vim /etc/nut/upsd.users

[upsmon]
        password=XXXXX
        upsmon master


sudo vim /etc/nut/upsmon.conf

...
...
MONITOR tripplite@localhost 1 upsmon XXXXX master


Test

sudo upsd


sudo upsc tripplite@localhost



Troubleshooting

data for ups is stale - check driver




















A clean shutdown during a prolonged power loss requires two things; a smart UPS and monitoring software.

The best choice for monitoring software is nut. There are others; Apcupsdpoweralert, PowerChute for Linux, etc. Nut however is the most universally applicable, more flexible and more likely to have the expertise you develop in it be reusable. It's also open source.

There are many tutorials, such as here

After configuring it, don't forget to set the BIOS behavior for power restoration after power loss to 'restart'. Otherwise, the clean shutdown you just did will stick until you manually turn the unit back on.

Some things I noticed during the configuration

After doing the initial config and test the driver you see this error
sudo ./upsdrvctl start
Network UPS Tools - UPS driver controller 2.4.1
Network UPS Tools - Generic HID driver 0.34 (2.4.1)
USB communication driver 0.31
Can't claim USB device [09ae:3012]: could not detach kernel driver from interface
 0: Operation not permitted

Driver failed to start (exit status=1)

Near as I can tell this is because you need to specify a -u root like so on some systems (such as ubuntu 9.10)
$ sudo upsdrvctl -u root start

Also, after the first configuration of the upsd, you'll see this filling your /var/log/daemon.log

usbhid-ups[2635]: Got disconnected by another driver

The service seems to be working, but this appears every 4 seconds. I do not know the cause but rebooting seems to clear this.




Troubleshooting

To see the various packages if the one above doesn't work, check

https://launchpad.net/ubuntu/+ppas?name_filter=nut






Comments