2

I have a PowerWalker VI 850 LCD ups connected to a Raspberry Pi Model B+ via USB. I have been trying to use NUT to monitor it, with lots of problems. First, it seems that the protocol detection wasn't working right, and I've since specified protocol = mustek and that seems to have partially stabilized it--now every time I start the nut-driver service it actually connects.

However, another quirk is that for some reason the USB device keeps changing (e.g. from /dev/bus/usb/001/005 at boot to 006 or 007) without warning or apparent cause. I tried to work around this by adding a SYMLINK parameter to my udev rule:

ACTION=="add", \
SUBSYSTEM=="usb", \
ATTR{idVendor}=="0665", ATTR{idProduct}=="5161", \
SYMLINK+="powerwalkerups" \
MODE="0660", GROUP="nut"

Which makes sure /dev/powerwalkerups always points to the right bus device. But--it seems, at least--whenever the USB device magically changes, the nut-driver loses it connection and I get the wonderful "data stale" message. Just, now whenever I restart it, it will actually connect up properly with a good protocol and works. But I have to manually systemctl restart nut-driver.

Is there an automatic way to make NUT try restarting the driver if the data goes stale? Or can someone recommend a watchdog type process that will do this for me? Since the service doesn't actually stop, systemd doesn't see the service as failed. How can I try to restart the service at least once to see if that resolves connectivity?

(Or, any idea how to stop it from disconnecting in the first place?)

UPDATE

Uptime on my NUT host is now 5 days and the USB device has wiggled all the way up from 005 to 012. So, I'm running Icinga2 on another host, and I'm going to look into making it restart the service...but that requires SSH access from the Icinga host to the NUT host :-P. Better ideas?

0

Figured something out... since my problem was connected to the USB device changing, and I already had a udev rule above, I added a RUN statement to it like so:

ACTION=="add", \                                                                                       
SUBSYSTEM=="usb", \                                                                                    
ATTR{idVendor}=="0665", ATTR{idProduct}=="5161", \                                                     
SYMLINK+="powerwalkerups", \                                                                           
MODE="0660", GROUP="nut", \                                                                            
RUN+="/bin/systemctl restart nut-driver"

This restarts nut-driver not when the data goes stale but when the USB device gets reconnected (or whatever you call what it's doing). This seems to have solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.