[SOLVED] NUT-Plugin (Network UPS Tools) not working

Started by paul_, March 31, 2025, 06:32:38 PM

Previous topic - Next topic
Hi everyone,

I have a new APC BR900G-GR UPS, and I want to set up my OPNsense as the NUT server to manage shutdowns for my two servers and the firewall in the event of a power outage. I've tried configuring it with both the USBHID-Driver and APCSMART-Driver, but neither seems to provide any data, and the Diagnostics page remains empty.
What I can see is that nut_daemon isn´t starting(see attached picture) - is there any log I could check?

If anyone has any suggestions or insights, it would be greatly appreciated.

Thanks & best regards,
Paul

I am not using version 25.1 (I use 24-19-2) but I believe that the OPNsense NUT plugin can only take one of two roles: standalone or netclient. On my version I see this as the help text of 'Service Mode' on Services->Nut->Configuration->General Settings.

I believe that this means that nut on OPNsense can only be the Secondary and not the Primary (using the definitions from RFC 9271). Though of course it can be used in Standalone mode.

I don't believe that you can do what you ask.


If you configure it as standalone you can use it as a server for other clients.

Use a NAT port forwarding rule for port 3493 on the interface where you have clients, forward to 127.0.0.1. Works great.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: Patrick M. Hausen on March 31, 2025, 07:46:14 PMIf you configure it as standalone you can use it as a server for other clients.

Use a NAT port forwarding rule for port 3493 on the interface where you have clients, forward to 127.0.0.1. Works great.

I configured it like this, but still I can´t see anything in Diagnostics...Port Forwarding is also configured

Check the usb-type, only one entry must be ticked.

Best regards
Stefan

Quote from: iRobot on March 31, 2025, 08:33:44 PMCheck the usb-type, only one entry must be ticked.

Best regards
Stefan
These are my settings, and I only ticked one, but it still doesn´t work. LAso with port auto it didn´t work.


Best regards
Paul

Two different things. First you need to get your communication with the UPS up and running, then you can connect other clients.

Can't help with the former, sorry. I use Cyberpower SNMP based communication throughout. Too many problems with USB.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

April 01, 2025, 12:17:47 AM #7 Last Edit: April 01, 2025, 12:37:48 AM by OPNenthu
Try adding "pollonly=enabled" in USBHID-Driver settings as a first tweak.  I remember reading somewhere that it helps with certain models, and this option can be set directly from the NUT plugin UI.

Some other suggestions I came across might require you to go into config files:

ups.conf: Add the global driver options to the top of the file: "pollinterval = 2" and "maxretry = 3".  The former might be default but the latter defaults to 1 (at least in the Debian nut package).  Might have to play with these.

upsmon.conf: Add "DEADTIME 25" (again might have to play with this, it should be a multiple of POLLFREQ) and try toggling "RUN_AS_USER root" by commenting/uncommenting it. The latter is mentioned in https://forum.netgate.com/topic/149032/must-the-ups-nut-daemon-be-run-as-root/3.

Sorry if these waste your time. I had initial instability connecting my CyberPower to a Raspberry Pi with usbhid (connection kept flapping), but a combination of these fixed it.  I haven't taken the time to isolate.

Side note: most Cyberpower models have 2 flaws that I consider critical for a UPS.
1. they usually fail to report that the batteries are no longer up to their task. A self-test or power outage in that state will end up with the unit powering off.
2. they won't start if they are not connected to a functioning power outlet. IOW, forget about turning the unit off at night in case of long outage. You won't be able to turn it back on until power is restored.

Since connecting my APC UPS to OPN was on my to-do list, I took the opportunity to look at the docs.
The NUT site seems to recommend auto for the port, possibly filtering on other criteria in cases where multiple UPS are used.

Quote from: EricPerl on April 01, 2025, 01:10:31 AMSide note: most Cyberpower models have 2 flaws that I consider critical for a UPS.
1. they usually fail to report that the batteries are no longer up to their task. A self-test or power outage in that state will end up with the unit powering off.

Can confirm this one from recent experience. Battery tests were passing and runtime under load was reporting 20+ minutes, but in practice during a couple recent power cuts I barely got 4-5 minutes (not enough when VMs are running).  Replaced the batteries but no longer trust the metrics and thinking I should set the clients to shutdown early rather than on a battery charge threshold.

April 01, 2025, 12:08:25 PM #10 Last Edit: April 01, 2025, 08:50:27 PM by Patrick M. Hausen
Quote from: EricPerl on April 01, 2025, 01:10:31 AM1. they usually fail to report that the batteries are no longer up to their task. A self-test or power outage in that state will end up with the unit powering off.

I run weekly battery tests and switch the batteries every couple of years. Usually after twice the recommend interval the very latest. Haven't experienced that problem, yet.

Quote from: EricPerl on April 01, 2025, 01:10:31 AM2. they won't start if they are not connected to a functioning power outlet. IOW, forget about turning the unit off at night in case of long outage. You won't be able to turn it back on until power is restored.

That's bad. Definitely going to test - thanks.

But it wasn't my intention to discuss the merits or lack thereof of Cyberpower vs. APC. ;-)
In fact in the history of our company we have had more outages due to failing APC units than due to a real loss of power.

Pick your poison - it's always a mess as soon as "real hardware" gets involved.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: OPNenthu on April 01, 2025, 12:17:47 AMTry adding "pollonly=enabled" in USBHID-Driver settings as a first tweak.  I remember reading somewhere that it helps with certain models, and this option can be set directly from the NUT plugin UI.

Some other suggestions I came across might require you to go into config files:

ups.conf: Add the global driver options to the top of the file: "pollinterval = 2" and "maxretry = 3".  The former might be default but the latter defaults to 1 (at least in the Debian nut package).  Might have to play with these.

upsmon.conf: Add "DEADTIME 25" (again might have to play with this, it should be a multiple of POLLFREQ) and try toggling "RUN_AS_USER root" by commenting/uncommenting it. The latter is mentioned in https://forum.netgate.com/topic/149032/must-the-ups-nut-daemon-be-run-as-root/3.

Sorry if these waste your time. I had initial instability connecting my CyberPower to a Raspberry Pi with usbhid (connection kept flapping), but a combination of these fixed it.  I haven't taken the time to isolate.


With this in ups.conf it´s running now :-) - Thanks for your help!

[USV-Keller]
driver=usbhid-ups
pollonly=enabled
port=auto

Just one more thing where can I setup the user I can access NUT? I want to add it to Homeassistant now, but it asks for a user.

Thanks!

Quote from: paul_ on April 01, 2025, 07:32:13 PM
Quote from: OPNenthu on April 01, 2025, 12:17:47 AMTry adding "pollonly=enabled" in USBHID-Driver settings as a first tweak.  I remember reading somewhere that it helps with certain models, and this option can be set directly from the NUT plugin UI.

Some other suggestions I came across might require you to go into config files:

ups.conf: Add the global driver options to the top of the file: "pollinterval = 2" and "maxretry = 3".  The former might be default but the latter defaults to 1 (at least in the Debian nut package).  Might have to play with these.

upsmon.conf: Add "DEADTIME 25" (again might have to play with this, it should be a multiple of POLLFREQ) and try toggling "RUN_AS_USER root" by commenting/uncommenting it. The latter is mentioned in https://forum.netgate.com/topic/149032/must-the-ups-nut-daemon-be-run-as-root/3.

Sorry if these waste your time. I had initial instability connecting my CyberPower to a Raspberry Pi with usbhid (connection kept flapping), but a combination of these fixed it.  I haven't taken the time to isolate.


With this in ups.conf it´s running now :-) - Thanks for your help!

[USV-Keller]
driver=usbhid-ups
pollonly=enabled
port=auto

Just one more thing where can I setup the user I can access NUT? I want to add it to Homeassistant now, but it asks for a user.

Thanks!


Nvm found it under: /usr/local/etc/nut/upsd.users

Thanks for the help to all of you :-)