Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)copy! share!
posted in category Digital Despotism / Linux
posted at 13. Jan '16

Setting up nut for UPS

We buyed a new Ellipse instead of old MGE Ellipse 800 which didn’t make it. Setting up nut via serial cable was easier. But now it is time for using USB connection.

Our UPS is some ~MGE~ Eaton Ellipse ECO 1500 VA with connected via USB cable. On the NUT page I’ve checked compatibility and corresponding driver - ups-hid. I don’t claim every step is needed.

I’ve installed it from repository.

apt-get install nut

Now you need to configure nut config files and set correct driver. See the link above.

But it still didn’t worked. I saw errors in syslog.

TL;DR reconnect your USB cable or reboot the server if you are remote.

Debugging

# /var/log/syslog
....
Oct  9 18:54:47 n2orava upsd[15214]: Can't connect to UPS [mge] (usbhid-ups-mge): No such file or directory
....

Some people wrote my udev rules don’t work properly and permissions are wrong. Some direct sanity checking:

/lib/nut/usbhid-ups -u root -DDDDD -a mge

worked. At least a direct call works.

Update udev rules

udevadm --reload

Check udev rules

They should look like this - permission rights and owner. And correct MODE. All in working order on my system.

/lib/udev/rules.d# ls -l
...
-rw-r--r-- 1 root root  9740 dec 31  2013 52-nut-usbups.rules
...

root@n2orava:/etc/nut# lsusb
.....
Bus 002 Device 002: ID 0463:ffff MGE UPS Systems UPS
...

root@n2orava:/etc/nut# cat /lib/udev/rules.d/52-nut-usbups.rules | grep 0463
ATTR{idVendor}=="0463", ATTR{idProduct}=="0001", MODE="664", GROUP="nut"
ATTR{idVendor}=="0463", ATTR{idProduct}=="ffff", MODE="664", GROUP="nut"

OK ENOUGH OF THIS. REBOOT YOUR COMPUTER OR RECONNECT USB CABLE

Logs

This is here for searchability.

Here is nut before and after restart of the box.

Oct  9 18:54:47 n2orava upsd[15214]: Can't connect to UPS [mge] (usbhid-ups-mge): No such file or directory
Oct  9 18:59:47 n2orava upsd[15214]: Can't connect to UPS [mge] (usbhid-ups-mge): Permission denied
Oct  9 19:04:47 n2orava upsd[15214]: Can't connect to UPS [mge] (usbhid-ups-mge): Permission denied
Oct  9 19:07:46 n2orava upsd[15214]: mainloop: Interrupted system call
Oct  9 19:07:46 n2orava upsd[15214]: Signal 15: exiting
Oct  9 19:10:02 n2orava usbhid-ups[3049]: Startup successful
Oct  9 19:10:02 n2orava upsd[3051]: listening on 127.0.0.1 port 3493
Oct  9 19:10:02 n2orava upsd[3051]: listening on ::1 port 3493
Oct  9 19:10:02 n2orava upsd[3051]: Connected to UPS [mge]: usbhid-ups-mge
Oct  9 19:10:03 n2orava upsd[3053]: Startup successful
.....
Oct  9 19:21:13 n2orava upsmon[4988]: Startup successful
Oct  9 19:21:13 n2orava upsmon[4990]: Login on UPS [mge@localhost] failed - got [ERR ACCESS-DENIED]
Oct  9 19:21:22 n2orava upsd[3053]: mainloop: Interrupted system call
Oct  9 19:21:22 n2orava upsd[3053]: Signal 15: exiting
Oct  9 19:21:22 n2orava usbhid-ups[3049]: Signal 15: exiting
Oct  9 19:21:23 n2orava upsmon[4990]: Poll UPS [mge@localhost] failed - Write error: Broken pipe
Oct  9 19:21:23 n2orava upsmon[4990]: Communications with UPS mge@localhost lost
Oct  9 19:21:28 n2orava upsmon[4990]: UPS [mge@localhost]: connect failed: Connection failure: Connection refused
Oct  9 19:21:32 n2orava usbhid-ups[5026]: Startup successful
Oct  9 19:21:32 n2orava upsd[5028]: listening on 127.0.0.1 port 3493
Oct  9 19:21:32 n2orava upsd[5028]: listening on ::1 port 3493
Oct  9 19:21:32 n2orava upsd[5028]: Connected to UPS [mge]: usbhid-ups-mge
Oct  9 19:21:32 n2orava upsd[5030]: Startup successful
Oct  9 19:21:33 n2orava upsd[5030]: User upsmon@::1 logged into UPS [mge]
Oct  9 19:21:33 n2orava upsmon[4990]: Communications with UPS mge@localhost established

Here are commands for showing details about UPS once nut works properly.

root@n2orava:/etc/nut# upscmd -l mge
Instant commands supported on UPS [mge]:

beeper.disable - Disable the UPS beeper
beeper.enable - Enable the UPS beeper
beeper.mute - Temporarily mute the UPS beeper
beeper.off - Obsolete (use beeper.disable or beeper.mute)
beeper.on - Obsolete (use beeper.enable)
load.off - Turn off the load immediately
load.off.delay - Turn off the load with a delay (seconds)
load.on - Turn on the load immediately
load.on.delay - Turn on the load with a delay (seconds)
shutdown.return - Turn off the load and return when power is back
shutdown.stayoff - Turn off the load and remain off
shutdown.stop - Stop a shutdown in progress
root@n2orava:/etc/nut# upsc mge@localhost
battery.charge: 100
battery.charge.low: 20
battery.runtime: 2006
battery.type: PbAc
device.mfr: EATON
device.model: Ellipse MAX 1500
device.serial: ADPK4500B
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.vendorid: 0463
driver.version: 2.6.4
driver.version.data: MGE HID 1.31
driver.version.internal: 0.37
input.sensitivity: normal
input.transfer.boost.low: 185
input.transfer.high: 285
input.transfer.low: 165
input.transfer.trim.high: 265
input.voltage.extended: no
outlet.1.desc: PowerShare Outlet 1
outlet.1.id: 2
outlet.1.status: on
outlet.1.switchable: no
outlet.desc: Main Outlet
outlet.id: 1
outlet.switchable: no
output.frequency.nominal: 50
output.voltage: 230.0
output.voltage.nominal: 230
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.firmware: 5102AH
ups.load: 16
ups.mfr: EATON
ups.model: Ellipse MAX 1500
ups.power.nominal: 1500
ups.productid: ffff
ups.serial: ADPK4500B
ups.status: OL CHRG
ups.timer.shutdown: 0
ups.timer.start: 0
ups.vendorid: 0463

Add Comment