Monday, December 24, 2007

HOWTO set up NUT 2.2.0 on Gentoo Linux for Tripp Lite OMNI1000LCD USB UPS

Last December after a significantly power outage, I purchased a Tripp Lite OMNI1000LCD USB UPS from Costco. I spent awhile integrating it with my Gentoo distro running on my home server. I found that Network-UPS Tools (NUT for short) was the best way to go. I would recommend them and their mailing list if you are interested in getting anything running -- I've been lurking on their mailing-list for 12 months now and it is one of the most helpful lists I've seen in my days.

Back in December of 2006, I had no choice but to get a development tree and compile it and integrate that with Portage (see old HOWTO link ). Today NUT version 2.2.0 is in the tree but all architectures are marked as in 'testing'. That is the tilde in front of them : ~alpha ~amd64 ~ppc ~sparc ~x86 ~x86-fbsd when you look at portage nut package . unmasking this package will be much easier than my last experience of integrating my own build in portage (overlaying).

I've been running on this 2.2.0 package for a couple months and I declare it seems good to me.

If you want to unmask it and test it yourself that is simple:

(1) add the following line to the file /etc/portage/package.keywords
=sys-power/nut-2.2.0 ~x86

This will allow you to install this package.

(2) emerge nut with the hal flag
USE="hal" emerge nut

(3) Configure NUT

- the OMNI1000LCD is working fine with the new usbhid-ups driver

Now that we've made this build, you can follow the steps at the wiki:
Gentoo HOWTO NUT (Network UPS Tools)

You'll get to start after the Install Software section. Yes, you'll need the usbhid-ups driver. I am pasting my last instructions with the appropriate substitutions for the OMNI1000LCD for NUT 2.2.0.

I added the bit about adding a MONITOR line to uspmon.conf. This is necessary for upsmon to work

Configuring

Go to /etc/nut . Open ups.conf. Add to this file every UPS you want to monitor. Mine looks like this:

# [powerware]
# driver = bcmxcp
# port = /dev/ttyS0
# desc = "Server, adsl, 3com"


Change the values to something that fit's your configuration better and save. If you have a USB connection to your UPS, your entry might look like

[OMNI1000LCD]
driver = usbhid-ups
port = auto
desc = "Tripp Lite OMNI1000LCD USB"

Open upsd.conf. This file contains access-policy to the UPS's you have.

To only allow the same computer to connect to them, the file should look like this:

ACL all 0.0.0.0/0
ACL localhost 127.0.0.1

ACCEPT localhost
REJECT all


The ACL-lines are used to add hosts. The syntax is ACL name IP. If the name is placed after ACCEPT connections from there are accepted, if it's placed under REJECT, connections are rejected. This sort of reminds me of a hosts.allow file?

Next open upsd.users. This file contains accounts for users who can make modifications. The following line grants access to the user server to everything. This isn't integrated with particular logins from my observation. So you can make-up a new user/pass and run with that. The only place one needs to remember this if you are setting properties through NUT on the UPS.


[server]
password = changeme
allowfrom = localhost
actions = SET
instcmds = ALL
upsmon master


Next take a look at upsmon.conf. This is the UPS Monitor configuration. A scan through this file is going to answer more questions than me writing about it. It is pretty simple, but the below three changes are all I needed to make.

1. in Gentoo, the nut package uses the 'nut' user, so ensure this is in there.
RUN_AS_USER nut
2. The UPS to monitor
MONITOR OMNI1000LCD@localhost 1 server changeme master
3. for those of us with a measly single UPS for our home network you'll need this line:
MINSUPPLIES 1



Next if you want look at upssched.conf too, it may be interesting if you want to schedule events. This will be useful if you want to automate something like "30 seconds after the power is out, send an email via SMTP." I currently am not interested in this

Finishing

Now, start the upsd and upsmon service:

/etc/init.d/upsd start
/etc/init.d/upsmon start

This should identify if there is some still wrong.
If nothing is wrong add them to the default runlevel

rc-update add upsd default
rc-update add upsmon default

If you didn't get any error when you started the services you seemed to configure it right. Else, have a look at the error output and think what might be wrong. One error I got was the permissions of the serialport, which is easy fixed with adding nut to the tty-group.

Testing

You'll be using tools upsc and upscmd

Test upsc and see if your UPS replies:

upsc yourupsname@yourupshost ups.status
specifically from above conf: upsc OMNI1000LCD@localhost ups.status

If you get "OL" (On Line) everything is working good (if it is on the line and not battery).

To see every command your UPS supports, type

upscmd -l OMNI1000LCD@localhost

A full status looks like the below.

#upsc OMNI1000LCD@localhost
battery.charge: 100
battery.type: PbAc
battery.voltage: 13.4
battery.voltage.nominal: 12.0
driver.name: usbhid-ups
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.2.0
driver.version.data: TrippLite HID 0.1 (experimental)
driver.version.internal: 0.30
input.frequency: 59.8
input.voltage: 117.2
input.voltage.nominal: 120
output.frequency.nominal: 60
output.voltage.nominal: 120
ups.beeper.status: disabled
ups.delay.reboot: 65535
ups.delay.shutdown: 65535
ups.mfr: Tripp Lite
ups.model: TRIPP LITE UPS
ups.power.nominal: 1000
ups.productid: 2005
ups.serial: 692195 B
ups.status: OL CHRG
ups.test.result: 0
ups.vendorid: 09ae

If you've typed that command and gotten a similar response you are on the winning side of this conf.

(4) UPSMON conf
At this point you have the default configuration for the monitoring. If you want to do something aside from a straight shutdown on the battery level reaching a critical level I highly recommend reading up here: Network UPS

Keywords: Tripp Lite, USB UPS, Tripp Lite Gentoo, Tripp Lite OMNI1000LCD, USB HID UPS Linux, Gentoo HID UPS, gentoo NUT 2.2.0 portage overlay, Gentoo UPS NUT, Tripp Lite Linux, Tripp Lite OMNI1000LCD Gentoo, Tripp Lite OMNI1000LCD Linux, Tripp Lite OMNI1000LCD UPS.

5 comments: