[Plugin] NUT v2 - Network UPS Tools


dmacias

Recommended Posts

amazing

I have no clear idea what I did , but now it is working. restarted, reconfigured...

 

my FSP FP1000  UPS is configured with Blazer_usb. 

 

ups.conf:

[ups]
driver = blazer_usb
port = auto

vendor = "INNO TECH"
bus = "002"

 

upsmon.conf:

MONITOR [email protected] 1 monuser monpass master
SHUTDOWNCMD "/sbin/poweroff"
POWERDOWNFLAG /etc/nut/no_killpower
NOTIFYFLAG ONBATT SYSLOG+EXEC
NOTIFYFLAG ONLINE SYSLOG+EXEC
NOTIFYCMD "/usr/sbin/nut-notify"
 

 

 

Key Value Key Value
battery.charge 100 battery.voltage 27.10
battery.voltage.high 26.00 battery.voltage.low 20.80
battery.voltage.nominal 24.0 device.type ups
driver.name blazer_usb driver.parameter.bus 002
driver.parameter.pollinterval 2 driver.parameter.port auto
driver.parameter.synchronous no driver.parameter.vendor INNO TECH
driver.version 2.7.4 driver.version.internal 0.12
input.current.nominal 5.0 input.frequency 50.0
input.frequency.nominal 50 input.voltage 230.8
input.voltage.fault 230.8 input.voltage.nominal 220
output.voltage 230.8 ups.beeper.status enabled
ups.delay.shutdown 30 ups.delay.start 180
ups.load 33 ups.productid 5161
ups.status Online ups.type offline / line interactive
ups.vendorid 0665  
Link to comment
  • 2 weeks later...

guys

 

I am experiencing a problem.  the USB device the UPS is connected to is resetting occasionally. see bellow.

it seams that the reset is affecting the controller and all the USB devices on it are disconnecting. 

 

 

what can I do ?  whats the reason for it?  is it intentional or a bug?  

how can I investigate what it is?

 

Dec 18 19:49:07 Tower kernel: usb 2-1.2: reset low-speed USB device number 11 using ehci-pci
Dec 18 19:49:13 Tower kernel: usb 2-1.2: USB disconnect, device number 11
Dec 18 19:49:13 Tower kernel: usb 2-1.2: new low-speed USB device number 13 using ehci-pci
Dec 18 19:49:13 Tower kernel: hid-generic 0003:0665:5161.0007: hiddev0,hidraw0: USB HID v1.00 Device [INNO TECH USB to Serial] on usb-0000:00:1d.0-1.2/input0 

Link to comment
guys
 
I am experiencing a problem.  the USB device the UPS is connected to is resetting occasionally. see bellow.
it seams that the reset is affecting the controller and all the USB devices on it are disconnecting. 
 
 
what can I do ?  whats the reason for it?  is it intentional or a bug?  
how can I investigate what it is?
 
Dec 18 19:49:07 Tower kernel: usb 2-1.2: reset low-speed USB device number 11 using ehci-pci
Dec 18 19:49:13 Tower kernel: usb 2-1.2: USB disconnect, device number 11
Dec 18 19:49:13 Tower kernel: usb 2-1.2: new low-speed USB device number 13 using ehci-pci
Dec 18 19:49:13 Tower kernel: hid-generic 0003:0665:5161.0007: hiddev0,hidraw0: USB HID v1.00 Device [iNNO TECH USB to Serial] on usb-0000:00:1d.0-1.2/input0 
What driver are you using now? Did you try what I posted before with the custom driver?
Link to comment

I didnt try. :(

I was afraid to break it...  

sometimes when I reboot the UPS is not recognized and there is no connection. I need to reboot again. 

I think there is some timing issue when the UPS is expecting a response from the driver and not getting it. So there is a "miscommunication" happens.

right now its blazer_usb driver.

 

P.S

I have the x9dai supermicro board and although the chipset has 2 USB2 controllers on it, they designed it in such a way that ALL the usb ports are connected via one controller only. so when it is getting a reset, all the usb devices are getting a reset. 

even the USB flash I am booting from is on it as well. so I am happy that it does not affect the overall server.  it just disables the keyboard and mouse I have on the bluetooth dongle passed through to OSX VM. 

unless I can solve this reset problem , i will need to get a PCI USB controller 

 

Bus 1 --> 0000:00:1a.0 (IOMMU group 9)
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 2 --> 0000:00:1d.0 (IOMMU group 14)
Bus 002 Device 014: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0
Bus 002 Device 005: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 002 Device 013: ID 0665:5161 Cypress Semiconductor USB to Serial
Bus 002 Device 003: ID 03f0:8c11 Hewlett-Packard Deskjet F4500 series
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Edited by dadarara
Link to comment
6 hours ago, dadarara said:

actually I notice something . the reset is affecting  ONLY the bluetooth and the UPS .  

you can see the Device # is getting sequentially increased numbering  (now it 14 and 13)

all the other USB devices stay the same 

Maybe there's too much power draw with the bluetooth.

Link to comment

I'm attempting to get NUT working with my APC SmartUPS RT 1500. After install the plugin is able to auto detect the proper driver (Usbhid-ups) but when I start the server it looks like I'm not getting any comms.

 

i2uljq.jpg

 

I saw an earlier post about killing apcupsd so I tried that.

root@Brunnhilde:~# /etc/rc.d/rc.nut stop
Writing nut config
Updating permissions...
Stopping the UPS services... 
Network UPS Tools upsd 2.7.4
fopen /var/run/nut/upsd.pid: No such file or directory
Network UPS Tools - UPS driver controller 2.7.4
Can't open /var/run/nut/usbhid-ups-auto.pid: No such file or directory
root@Brunnhilde:~# ps aux | grep ups
root      1004  0.0  0.0   9640  1820 pts/1    S+   13:38   0:00 grep ups
root     12165  0.0  0.0   4240    72 ?        Ss   03:08   0:00 runsv cups
root     12169  0.0  0.0 162052  3708 ?        Sl   03:08   0:00 /usr/sbin/cupsd -f -c /config/cups/cupsd.conf
root     12624  0.0  0.0   6528   764 ?        S    03:08   0:00 inotifywait -m /config/cups/ppd -e create -e moved_to -e close_write

Restarted the NUT server but no change. What am I missing?

Link to comment
4 minutes ago, dmacias said:

What does it say when you run rc.nut start?

 

root@Brunnhilde:~# /etc/rc.d/rc.nut start
Writing nut config
Updating permissions...
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
Duplicate driver instance detected! Terminating other driver!
Using subdriver: APC HID 0.96
nut upsd is running...
nut upsmon is running...
                                                                               
Broadcast message from root@Brunnhilde (somewhere) (Sun Dec 24 14:21:58 2017): 
                                                                               
UPS [email protected] is unavailable       

NUT was running when I ran this command. No change though after running it.

Link to comment
2 minutes ago, wgstarks said:

Never mind :D

Rebooted the unraid server and all is good now. Not sure why that was necessary but not complaining.

I'm not sure either. Maybe udev rules. I just disabled nut and setup the built in apcupsd.  Apcupsd wouldn't work till I rebooted. However I could stop it and install nut which worked. I was gonna suggest to try a custom driver apcsmart or apcsmart-old.

Link to comment
actually I notice something . the reset is affecting  ONLY the bluetooth and the UPS .  

you can see the Device # is getting sequentially increased numbering  (now it 14 and 13)

all the other USB devices stay the same 

I don't know if you figured it out but I just swapped my Cyberpower 1350 for a Tripp Lite 1200 rack mountable UPS. I got the same constant usb disconnects and increasing device number. disabling both of these solved it for me.

 

Advanced/Chipset Configuration/PCH-IO Configuration/XHCI Hand-off

Advanced/Chipset Configuration/PCH-IO Configuration/XHCI Mode

 

Essentially disabling usb 3.0.

 

Edit: I still get usb disconnects but when I start nut, they stop.

Link to comment
On 12/26/2017 at 4:53 PM, realies said:

Have the USB resets been addressed? There's some functionality in master that I am hoping to see in unRAID.

I just compiled the latest from GitHub. But it does the same thing as the last time. When the server is restarted and the nut driver loads, other usb devices get reset. This is very bad for unRAID as it resets the flash drive and the boot process stops. Unless powered down properly from the command line it can cause corruption of the flash drive too.

Link to comment
13 hours ago, realies said:

Thanks for testing. Could this be reported to the repo? I am currently unable to reproduce, but remember that when the UPS was passed through to a Win10 VM it did reconnect every now and again.

There's 2 different things going on here. I never got disconnects with my Cyberpower but the ASRock board I was using didn't have usb 3.0. The new Supermicro board does have usb 3.0. My new Tripp Lite does get disconnects. This is without nut installed. So it's either a Tripp Lite problem or kernel problem. I have read of similar problems on the freenas board. However if I disable usb 3.0 I still get sequential disconnects but as soon as I connect it to the nut usb driver it stops and nut works.   This is with nut 2.7.4. Also it stops if I add the UPS to a vm.

 

The other problem is every time I've compiled the latest nut It causes the flash drive to reset. This happen on both boards and both UPS's. There's a nut-2.7.5pre package in my NUT-unRAID repo if you want to try it but be warned and make a backup first. It's messed up the mbr a couple times and I've have to format and recreate the unRaid flash drive. I think the problem may be in their conversion of nut to libusb1.0. but I'm not sure.

Edited by dmacias
  • Upvote 1
Link to comment

I installed Nut so that I could use the server functions to shutdown other computers also connected to the same UPS. So far I have been completely unable to get nit working on the other machines. I’ve reached the point where I’m ready to just call the project a failure and move on.

 

What do I need to do to switch back to the built in apcupsd package? Will just uninstalling the nut plugin take care of it?

Link to comment
1 hour ago, wgstarks said:

I installed Nut so that I could use the server functions to shutdown other computers also connected to the same UPS.

What about the apcupsd network functions didn't work for you? I control all my VM's and several physical machines using apcuspd host on my main unraid box.

Link to comment
39 minutes ago, jonathanm said:

What about the apcupsd network functions didn't work for you? I control all my VM's and several physical machines using apcuspd host on my main unraid box.

Haven't tried it with apcupsd yet. That's my next project. Not sure how complicated it will be to install it on pfsense. I know pfsense has a nut plugin, that's why I tried it first. Couldn't get nut to install on my Macs though.

Link to comment

It seems nut package has been updated to 2.7.5-pre. Is this replacing the old binary and can the update be reflected in the changelog?

 

Update: usbhid-ups stayed 2.7.4, great to see Nominal Power and UPS Load (W) working on Eaton!

 

Update: As discussed in the package repository, ups.power.nominal/100*battery.charge does not produce the expected results.

 

When using Eaton 5E 650i with the NUT v2 plugin, it reports:

 

Nominal Power: 650

UPS Load: 253

UPS Load %: 39

 

Eaton UPS Companion (attached to a Win10 VM) reports:

 

Output Load: 203W

Usage: 39%

 

Looking into the changes made to estimate Eaton's realpower when it is not available, I am proposing a similar change to the NUT v2 plugin until 2.7.5 or newer are deployed without any issues.

Edited by realies
Link to comment

Since it's not possible to create an issue in the repository, I'm writing one here.


Consider parsing the whole output of `upsc ups` to a key-value pair array instead of iterating through the keys and making use-cases for individual keys. This way the output from the ups service would be more easily accessible which eases refactoring and introducing new functionality. Would be exciting to see a separation between the front and back end too.

 

In regards to the above, this should be sufficient to generate the array:

exec("/usr/bin/upsc ups 2>/dev/null", $stdout);
print_r(array_reduce($stdout, function($carry, $line) {
 list($key, $value) = explode(":", $line, 2);
 $carry[trim($key)] = trim($value);
 return $carry;
}, []));

A demo can be seen here.

Edited by realies
Link to comment
  • Rysz featured this topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.