[Plugin] NUT v2 - Network UPS Tools


dmacias

Recommended Posts

On 5/28/2019 at 4:56 PM, cybrnook said:

@TechMed

 

I'm switching it up a bit. I actually installed NUT on my pfsense gateway now, and have all my devices ( 2 x unraid and 1 x Synology) all checking in as clients to the gateway now :-). Figure gateway is nonvolatile, and would likely be the last to go down in my rack.

@cybrnook can you please explain the steps required to setup NUT on pfsense?  I've got NUT running just fine and talking to the UPS, but I can't manage to get unRAID to connect as a client.  I've added a slave user to upsd.users.  I was thinking maybe it needs a LISTEN directive to allow an incoming connection from unRAID, but that just breaks the connection between pfSENSE NUT <-> UPS.  I was thinking it needs a MODE=netserver in nut.conf, but seems I'm missing a step there.

 

I would love get them talking, seems like I'm overlooking something simple.  If you've got the Synology connection working too, I would love to see that as well.  Seems like that needs to be routed through SNMP?


THANKS

Edited by mikegeezy
Link to comment
3 hours ago, mikegeezy said:

@cybrnook can you please explain the steps required to setup NUT on pfsense?  I've got NUT running just fine and talking to the UPS, but I can't manage to get unRAID to connect as a client.  I've added a slave user to upsd.users.  I was thinking maybe it needs a LISTEN directive to allow an incoming connection from unRAID, but that just breaks the connection between pfSENSE NUT <-> UPS.  I was thinking it needs a MODE=netserver in nut.conf, but seems I'm missing a step there.

 

I would love get them talking, seems like I'm overlooking something simple.  If you've got the Synology connection working too, I would love to see that as well.  Seems like that needs to be routed through SNMP?


THANKS

I added a firewall rule for the redirect from IP (pfsense as 192.168.1.1) to localhost (127.0.0.1). Not sure it's %100 needed, but wanted to be safe:

image.thumb.png.1c5cd289212cfdd73a41838c15ec1a74.png

 

pfSense settings ( I am using the ups/secret combo as I have a synology on my network, and they are hard coded for that):

image.thumb.png.6b50df309dbb8d03e21eccf12ddb3f0a.png

 

Unraid client settings:

image.thumb.png.9c2cb69e9e6772499b017995dc9fadb6.png

 

For Synology, choose "Synology UPS server" and then just point it to the IP of pfSense and it should connect since all the prerequisites are already met.

Edited by cybrnook
  • Like 1
Link to comment

@cybrnook  My dude thanks very much for the post, that got it going!

 

The hangup on my end was the firewall rule, once I put that in place the unRAID box connected immediately.  Synology didn't connect right off the bat, so I started digging around in /usr/syno/etc/ups and realized there are configuration options that aren't really exposed in the control panel GUI (like the UPS name)

 

14 hours ago, cybrnook said:

( I am using the ups/secret combo as I have a synology on my network, and they are hard coded for that)

Clever trick to setup pfSense with what Synology is looking for.  Above comment makes more sense to me now.

 

All this had me scratching my head on why it wouldn't connect without the firewall rule, so I went back and added a LISTEN 192.168.1.1 to upsd.conf.  And that appears to be working with the firewall rule disabled.

 

Link to comment

Hi @MandalorePatriot,

Not sure if this is helpful at all, but I had the same situation with a CyberPower (CP) unit.

Found out from support the CP unit software had to run on the server; no Docker exists for it that I am aware of.

I am 99% certain you are going to run into the same thing, unless someone knows of a Docker to run the APC network software.

No USB?Serial at all huh? No RJ11 acting as the Serial port either?

Link to comment
3 hours ago, TechMed said:

Hi @MandalorePatriot,

Not sure if this is helpful at all, but I had the same situation with a CyberPower (CP) unit.

Found out from support the CP unit software had to run on the server; no Docker exists for it that I am aware of.

I am 99% certain you are going to run into the same thing, unless someone knows of a Docker to run the APC network software.

No USB?Serial at all huh? No RJ11 acting as the Serial port either?

After looking again, it has a USB port. Thanks for convincing me to look again! 😃

Link to comment
  • 1 month later...

Hello! I just installed a new UPS with NUT, however I don't see the battery level being reported, can you please help me diagnose what could be the problem?

 

How would I tell the server to shut down itself when its running on UPS without battery level?

 

NAS NUTsettings.png

 

EDIT: Solved, got it running on blazer_usb.

 

I just don't see runtime left now. Any way to make that avalible?

Edited by Arandomdood
Link to comment
On 10/24/2019 at 5:15 AM, soupn said:

do you guys recommend any eaton/apc models to work with unraid?

You've probably not waiting for an answer two months later, but I'm here and I can offer this. The Eaton 5S1500LCD works flawlessly with UnRaid using the NUT plugin discussed in this thread. I used it for a long time with just my UnRaid server, and just today added my pfsense machine as a client, switching the plugin to network server mode. After some fiddling, pfsense can see it. 

 

I have not tested to see if NUT will send a safe shutdown command to pfsense, but I am assuming it will?

 

Does the NUT plugin send a shutdown command to all clients without some other custom setting?

Link to comment
  • 1 month later...

Any ideas on how or where to begin troubleshooting NUT randomly saying that server is on battery backup and shutting down? It’s a Tripplite 1050SLT UPS. I’m positive power isn’t being lost. Did this once last week and once this week. Good news is it’s safely shutting down system; bad news is erroneously and randomly LOL. 

FED0A337-BE8D-4CB4-88A9-7C4CAA5D28F7.jpeg

5E6DECED-0963-4610-90AA-EABCC4CAD416.jpeg

DE7F586E-09EE-4FAA-90DC-1536BE76155F.jpeg

173B5148-7552-4BF5-88C9-DD82D93B6CC9.jpeg

Link to comment
  • 2 weeks later...

Hi there

 

NUT not always starting on reboot.

 

I have a common USB/Serial UPS connected via USB to my unRaid. Everything works just fine when NUT is running. 

 

However, I have now finally learned that most UPS's seem to disconnect from USB if they do not get a connection within 20s or so, then they reconnect. This is why when testing in windows you hear the connect/disconnect sounds over and over. Once the UPS gets a connection from the software/service it stays connected.

 

My problem is that after a power failure or deliberate reboot, NUT is not guaranteed to be running because it tries once and if the UPS's 20s cyce is not in sync then NUT can't connect and does not start, but the UPS will connect again seconds later, but NUT does not try again.

 

Is there a way to force NUT to keep trying to start until it succeeds, or to try longer. My logs are filled with the UPS connecting/disconnecting, once NUT starts the logging stops.

 

Its just a timing thing between NUT and the UPS so if NUT just keeps trying it will connect. 

 

Right now my server restarts after a power failure but is often then not protected cos NUT is stopped and the next power failure there is not graceful shutdown.

 

Grateful for any suggestions to get NUT to just try more than once to connect and start.

 

 Regards

Jens

Link to comment
4 hours ago, Benson said:

Shouldn't that. It seems UPS problem if NUT not communicate with UPS and USB link up/down.

Does also try Unraid build in APCUPSD ?

 

Its not a NUT "problem" nor a UPS problem it is simply a disconnect between the two ... We cannot change how the UPSs work and the connect/disconnect behaviour seems to be a very common one. 

 

If NUT simply keeps trying rather than giving up after the first attempt then this will be resolved, maybe allow for config on how often/long NUT should keep trying before sending an alert that the UPS has failed to connect.

 

Right now the server boots and no one is informed that the UPS is not connected.

Link to comment
  • 2 weeks later...

Any idea why a NUT shutdown of Unraid would take 10 minutes +, when a normal manually induced shutdown from the GUI takes 1/2 minutes? I have an Eaton 5P plugged into a Synology. UnRaid and PFsense are slaves and getting all the info. Pfsense box shuts down fine before battery dies but Unraid server (R210ii used for VMs and Docker) takes too long loses power ungracefully; meaning parity checks etc.

 

I have tested 8 to 10 times this afternoon and GUI shutdown can be accomplished quickly, NUT induced shutdown takes forever. I have a monitor plugged into the UnRaid server and can see it has begun shutting down 5 seconds after going onto UPS power but still takes too long.

 

"Waiting 90 seconds for graceful shutdown" then shows "Forcing Shutdown" for an eternity before usually losing power. UPS has ~15 minute battery.

 

I'm just trying to work out what happens differently between a GUI shutdown and a NUT slave shutdown to cause this undesirable behaviour?

 

Thanks in advance,

Edited by SpuddyUK
Link to comment

Do not have an answer for you, only two small tips too try.

i would probably have tried running unraid as master and synology/pfsense as slaves and sees how that goes, then if not ok tried pfsense as master.

 

Also when you are testing do NOT have the equipment that you are testing on (synology/unraid/pfsense) power cables in the UPS just plug them in a normal outlet, that way IF the battery runs out and the ups shutsdown the equipment still have power=no more unnecessary parity checks/powercuts.

Learned that a few weeks ago while pretty much feeling like a moron that did not think about that my self, i mean after i learned it, it is so obvious!

Edited by grizzly
Link to comment
7 hours ago, grizzly said:

Do not have an answer for you, only two small tips too try.

i would probably have tried running unraid as master and synology/pfsense as slaves and sees how that goes, then if not ok tried pfsense as master.

 

Also when you are testing do NOT have the equipment that you are testing on (synology/unraid/pfsense) power cables in the UPS just plug them in a normal outlet, that way IF the battery runs out and the ups shutsdown the equipment still have power=no more unnecessary parity checks/powercuts.

Learned that a few weeks ago while pretty much feeling like a moron that did not think about that my self, i mean after i learned it, it is so obvious!

Thanks for the info. 

 

This morning I have tested the following, Unraid (R210ii) as NUT master, Synology as NUT slave, PFsense as NUT slave.

Same issue occurs, if not a few minutes worse. Setup NUT on unraid to shutdown after 1 minute on battery. pfsense seems to start it's shutdown sequence at the same time. Synology, I set to after 45 seconds on battery.

Synology and pfsense automatically go off nicely within 2 minutes of power being lost to UPS. UnRaid hangs at both the "Waiting up to 90 seconds for graceful shutdown..." and "Forcing Shutdown". For around 12-15 minutes before powering off. If I "Shutdown" in the gui, the R210ii is off within 2 minutes.

 

I can try pfsense being the NUT master, but with similar experiences being had with synology being the NUT master, and now same with unraid server being NUT master, I'm inclined to believe it wont make a difference. Something in the NUT unraid plugin shutdown sequence is causing the delay.

 

Anyway I can troubleshoot this lengthy delay?

 

NUT-UPS-UNRAID.GIF

Edited by SpuddyUK
added pic
Link to comment

Ok. So i'm further along.

 

I shutdown all my docker containers manually and turned docker off under Settings > Docker. I also manually shut down my single Windows Server 2016 VM.

 

Pulled the mains on my UPS and everything shutdown perfectly, INCLUDING Unraid (R210ii). Seems Docker and/or VM are causing the long 12+ minute delays during NUT induced shutdown. Next question is I guess why and what can I do about it? Can I add something to a nut conf somewhere to forcefully kill docker/vm instances?

Link to comment
4 hours ago, SpuddyUK said:

Ok. So i'm further along.

 

I shutdown all my docker containers manually and turned docker off under Settings > Docker. I also manually shut down my single Windows Server 2016 VM.

 

Pulled the mains on my UPS and everything shutdown perfectly, INCLUDING Unraid (R210ii). Seems Docker and/or VM are causing the long 12+ minute delays during NUT induced shutdown. Next question is I guess why and what can I do about it? Can I add something to a nut conf somewhere to forcefully kill docker/vm instances?

Been on this for the past 2 days and I think I've just got to the bottom of it.

 

I tried with docker disabled but VM Manager enabled, same issue.

I tried with VM disabled but docker enabled, same issue.

Both turned off and NUT successfully powers down Unraid within 2 mins.

Turned both back on and issue starts again.

 

However! My wireless usb/mouse combo, has a little dongle. Unraid was doing it's hanging at "forcing shutdown" (usually 10+ minutes) trick. I unplugged the dongle during this to use elsewhere and immediately unraid completed it's shutdown and powered off, like within 10 seconds. It could be there is an issue between this little dongle and docker/vm manager which is preventing NUT from rebooting in a timely fashion.

 

Could be coincidence but unlikely. I'll hold my judgement for now as I'm just waiting for the UPS to get it's charge up (couple hours) then i'll be testing again with no dongle and both docker and VM manager enabled.

 

I'll report back later! Thanks for help.

Link to comment
  • 4 weeks later...
On 2/17/2020 at 11:26 AM, SpuddyUK said:

Been on this for the past 2 days and I think I've just got to the bottom of it.

 

I tried with docker disabled but VM Manager enabled, same issue.

I tried with VM disabled but docker enabled, same issue.

Both turned off and NUT successfully powers down Unraid within 2 mins.

Turned both back on and issue starts again.

 

However! My wireless usb/mouse combo, has a little dongle. Unraid was doing it's hanging at "forcing shutdown" (usually 10+ minutes) trick. I unplugged the dongle during this to use elsewhere and immediately unraid completed it's shutdown and powered off, like within 10 seconds. It could be there is an issue between this little dongle and docker/vm manager which is preventing NUT from rebooting in a timely fashion.

 

Could be coincidence but unlikely. I'll hold my judgement for now as I'm just waiting for the UPS to get it's charge up (couple hours) then i'll be testing again with no dongle and both docker and VM manager enabled.

 

I'll report back later! Thanks for help.

 

If you still have this problem, you can try to change the SHUTDOWNCMD argument in upsmon.conf to "/sbin/init 0".

Link to comment
  • 2 weeks later...

Hello,

 

Im trying to configure NUT to connect to my Networked Eaton 5P 850 using SNMP. But when i configure it and try to start the service i see this:

 

Writing nut config
Updating permissions...
Network UPS Tools - UPS driver controller 2.7.4.1
/usr/libexec/nut/snmp-ups: error while loading shared libraries: libcrypto.so.1: cannot open shared object file: No such file or directory
Driver failed to start (exit status=127)

Any idea?

Link to comment

Hello good, could you tell me why the NUT service does not start me, the autodetec detects the sai well but I do not want to start the service and put the generic UPS configuration as indicated and tried to restart the server and nothing attached screenshot

PS Excuse me my inlges I use the translator

Sin título.jpg

Link to comment
  • 2 weeks later...
  • 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.