OPNsense Forum

Archive => 21.1 Legacy Series => Topic started by: s4rs on March 25, 2021, 02:10:45 am

Title: [Solved] Getting NUT Client to work
Post by: s4rs on March 25, 2021, 02:10:45 am
I have a nut server running and trying to attach my opnsense system to it. I installed the NUT service but it won't start. Not sure what I am missing. BTW if I drop into the console and run uspc <myupsname@nutserveraddress:port> I get the UPS status as expected. So I must be doing something wrong in the setup panel.

What I have:

General Setting:

Enable Nut - checked
Service Mode - netclient
Name - deltec-PRA1500 (UPS Name on the NUT Server)
Listen Address - 127.0.0.1 (I also tried <NUT server ip>

UPS Type:

Netclient
Enabled Checked
IP Address <NUT Server IP address>
Username <blank>
Password <blank>
Title: Re: Getting NUT Client to work
Post by: mimugmail on March 25, 2021, 06:47:02 am
Do you see in packet capture If it even tries to connect?
Title: Re: Getting NUT Client to work
Post by: s4rs on March 25, 2021, 10:37:42 am
Again from the Opnsense console I am able to run uspc <myupsname@nutserveraddress:port>  and get a reply from the NUT server. So this is a setup issue in the GUI. I am not sure what I am missing.
Title: Re: Getting NUT Client to work
Post by: s4rs on March 25, 2021, 12:23:57 pm
I think I see the issue. My NUT server uses listening port 3493. When look at :/usr/local/etc/nut/upsmon.conf it shows a listening port of 1. I need to know how to add the listening port since there is no way to add it in the gui. 

from upsmon.conf

MONITOR deltec-PRA1500@192.168.1.42 1   slave
Title: Re: Getting NUT Client to work
Post by: gpb on March 25, 2021, 01:50:47 pm
That listening port 1 is the same thing I have using a cyberpower ups (not a port actually, see edit at the bottom).

MONITOR qnapups@192.168.1.214 1 admin 123456 slave

I know with nut the name has to match exactly as well as the password.  In my example above, I had to use qnapups for the user, admin as the user and 123456 as the password.  You don't have a password it appears.  QNAP is involved in my setup and it's a static setting so basically, anyone using a QNAP NAS with NUT likely has this setting (unless they customized it).

My settings in the OPNsense GUI are service mode = netclient, name = qnapups, listen address = 192.168.1.214 (nut server address...in my case a raspberry pi).  On the second tab I have port = auto, but enable is UNchecked...likely not applicable in netclient mode.

Since you're missing a password, NUT may not be parsing the line correctly...guessing here.  Now the question is how did I enter the password, from the looks of it I manually edited this file that says not to as it might get overwritten in the future.  Might try adding a placeholder password to see if that changes anything if you don't have a legit password.

EDIT: From the documentation...section 6.3.

https://networkupstools.org/docs/user-manual.chunked/ar01s06.html

If it’s just monitoring this UPS over the network, and some other system is the master:
MONITOR myupsname@mybox 1 monuser mypass slave
The number "1" here is the power value. This should always be set to 1 unless you have a very special (read: expensive) system with redundant power supplies.
Title: Re: Getting NUT Client to work
Post by: s4rs on March 25, 2021, 02:53:48 pm
You were right on. I had to add a user and password. Once I did that it worked. Thanks..
Title: Re: [Solved] Getting NUT Client to work
Post by: gpb on March 25, 2021, 03:01:54 pm
You were right on. I had to add a user and password. Once I did that it worked. Thanks..

Glad that did it.   :)

@mimugmail Do you know if there's much effort to add a password field (and maybe the power value field too to make it complete) in the GUI?  I can put a request in on github if you think it's worthwhile...let me know.  Thx!

EDIT: For anyone finding this thread...this is actually not an issue, see the description on the page linked below.  Make sure to choose netclient on the second tab...or whatever applies.

https://docs.opnsense.org/manual/how-tos/nut.html