Network UPS Tools (NUT) For USB UPSs On CentOS 5.5 - Page 2

UPS Web Monitoring (nut-cgi)

Configure this file to let CGI programs access the UPS info:

vi /etc/ups/hosts.conf
MONITOR 5115@localhost 1 local_mon PASSWORD master

Create a Apache config file for the cgi installed with the nut-cgi package:

vi /etc/httpd/conf.d/ups-cgi.conf
ScriptAlias /nut-cgi-bin/ "/var/www/nut-cgi-bin/"
<Directory "/var/www/nut-cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all


Start UPS Daemon

Now you can try to start your NUT installation with this command:

/etc/init.d/ups start

If the start process is OK, check ups info with this command (use your ups.conf ups name instead of 5115):

upsc 5115

You can also check which instant command are supported by your UPS with this command:

upscmd -l 5115@localhost
Instant commands supported on UPS [5115]:
shutdown.return - Turn off the load and return when power is back
shutdown.stayoff - Turn off the load and remain off
test.battery.start - Start a battery test

You can start a battery test (if supported) with this command:

upscmd -u local_mon -p PASSWORD 5115 test.battery.start

You can also check the web monitoring page with a web browser: http://<upshost>/nut-cgi-bin/upsstats.cgi


Troubleshooting For Common USB Problems

If nut has problems to start check logs:

cat /var/log/messages

Many problems with USB UPSs are related to udev and device rights permission.

1) If you see these messages in /var/log/messages

udevd[513]: add_to_rules: unknown key 'ATTR{idProduct}'
udevd[513]: add_to_rules: unknown key 'ATTR{idVendor}'
udevd[513]: add_to_rules: unknown key 'ATTR{idProduct}'
udevd[513]: add_to_rules: unknown key 'SUBSYSTEMS'

You have a udev rule file that uses directives newer than the udev program version you have.

On CentOS 5.5 try to substitute "ATTR" with "SYSFS" and "SUBSYSTEMS" with "BUS".

In the "ACTION" directive use only "add" not "change":

	OK:	ACTION!="add", GOTO="nut-usbups_rules_end"
	ERROR:	ACTION!="add|change", GOTO="nut-usbups_rules_end"

2) Check usb device right permissions: Run the lsusb command:

Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 003 Device 005: ID 06da:0002 Phoenixtec Power Co., Ltd UPS
Bus 003 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 006 Device 001: ID 0000:0000
Bus 007 Device 001: ID 0000:0000

You can see from the preceding output that my usb ups is connected to the usb bus 3 device 5 and has this VendorID=06da and ProductID=0002

Grep VendorID and ProductID from nut udev rule file to see if your ups has already a rule to manage it:

grep "06da" /etc/udev/rules.d/62-nut-usbups.rules | grep 0002
SYSFS{idVendor}=="06da", SYSFS{idProduct}=="0002", MODE="664", GROUP="uucp"

I found that a rule is already present in the udev rule file: it sets file mode 664 and group ownership to uucp group to the usb device linked to the ups.

If a rule is not present for your device, copy the one above and changing VendorID and ProductID with those you found with lsusb command.

Check that device permissions are set like udev rule specify:

ls -l /dev/bus/usb/003/005
crw-rw-r-- 1 root uucp 189, 260 Mar 23 23:06 /dev/bus/usb/003/005
Share this page:

0 Comment(s)