Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    NUT Package (2.8.1 and above)

    Scheduled Pinned Locked Moved UPS Tools
    288 Posts 40 Posters 133.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      endy66 @dennypage
      last edited by

      @dennypage said in NUT Package (2.8.1 and above):

      @endy66 said in NUT Package (2.8.1 and above):

      After a few restarts of the NUT service on my pfSense it's there in the log. However the second login doesn't have an explicit IP address.

      upsd 81154 User client-xx1@192.168.1.xx logged into UPS [CyberPower_USV]
      upsd 81154 User client-xx2@::1 logged into UPS [CyberPower_USV]

      "::1" is an IP address. It's the IPv6 version of localhost, equivalent to 127.0.0.1 in IPv4.

      Hm this is weird because this user is connecting from a different host, so shouldn't it be anything other than a "localhost" address?

      dennypageD 1 Reply Last reply Reply Quote 0
      • dennypageD
        dennypage @endy66
        last edited by

        @endy66 said in NUT Package (2.8.1 and above):

        Hm this is weird because this user is connecting from a different host, so shouldn't it be anything other than a "localhost" address?

        Referring to post #2 in this thread, how are you allowing remote connections? Are you using option 1 (NAT/Port forward)? Or are you using option 2 (LISTEN)?

        E 1 Reply Last reply Reply Quote 0
        • E
          endy66 @dennypage
          last edited by

          @dennypage said in NUT Package (2.8.1 and above):

          @endy66 said in NUT Package (2.8.1 and above):

          Hm this is weird because this user is connecting from a different host, so shouldn't it be anything other than a "localhost" address?

          Referring to post #2 in this thread, how are you allowing remote connections? Are you using option 1 (NAT/Port forward)? Or are you using option 2 (LISTEN)?

          I'm using option 2 (LISTEN).

          dennypageD 1 Reply Last reply Reply Quote 0
          • dennypageD
            dennypage @endy66
            last edited by

            @endy66 Please post the contents of these files:

            /usr/local/etc/nut/upsmon.conf
            /usr/local/etc/nut/upsd.conf
            /usr/local/etc/nut/upsd.users
            
            E 1 Reply Last reply Reply Quote 0
            • E
              endy66 @dennypage
              last edited by endy66

              @dennypage said in NUT Package (2.8.1 and above):

              @endy66 Please post the contents of these files:

              /usr/local/etc/nut/upsmon.conf
              /usr/local/etc/nut/upsd.conf
              /usr/local/etc/nut/upsd.users
              

              Here's the content of these 3 files. Passwords are masked. Monitor password of the upsmon.conf matches the one from the [admin] section of the upsd.users.

              upsmon.conf

              MONITOR CyberPower_USV 1 local-monitor *************** master
              SHUTDOWNCMD "/sbin/shutdown -p +0"
              POWERDOWNFLAG /etc/killpower
              

              upsd.conf

              LISTEN 127.0.0.1
              LISTEN ::1
              
              
              LISTEN 192.168.1.1
              

              upsd.users

              [admin]
              password=***************
              actions=set
              instcmds=all
              [local-monitor]
              password=***************
              upsmon master
              
              
              [client-xx1]
              password = ***************
              upsmon slave
              
              [client-xx2]
              password = ***************
              upsmon slave
              
              dennypageD 1 Reply Last reply Reply Quote 0
              • dennypageD
                dennypage @endy66
                last edited by

                @endy66 And the output of

                netstat -a -n | grep 3493
                

                please.

                E 1 Reply Last reply Reply Quote 0
                • E
                  endy66 @dennypage
                  last edited by

                  @dennypage said in NUT Package (2.8.1 and above):

                  @endy66 And the output of

                  netstat -a -n | grep 3493
                  

                  please.

                  netstat -a -n | grep 3493
                  tcp4       0      0 192.168.1.1.3493       192.168.1.8.33624      ESTABLISHED
                  tcp6       0      0 ::1.3493               ::1.2785               ESTABLISHED
                  tcp6       0      0 ::1.2785               ::1.3493               ESTABLISHED
                  tcp4       0      0 192.168.1.1.3493       *.*                    LISTEN
                  tcp6       0      0 ::1.3493               *.*                    LISTEN
                  tcp4       0      0 127.0.0.1.3493         *.*                    LISTEN
                  
                  dennypageD 1 Reply Last reply Reply Quote 0
                  • dennypageD
                    dennypage @endy66
                    last edited by

                    @endy66 In the output I see one local connection and one remote connection.

                    The local connection will be upsmon, and is the one that is on ::1.2785 -> ::1.3493. This will be user local-monitor. You can easily confirm this with

                    sockstat -c | grep 3493
                    

                    The local upsmon connection should generate a log entry like this,

                    Feb  1 08:01:20 fw upsd[45590]: User local-monitor@::1 logged into UPS [CyberPower_USV]
                    

                    however you did not show such a log entry. Given that you clearly have a local upsmon connection, there absolutely should be a corresponding log entry.

                    The remote connection is on 192.168.1.8.33624 -> 192.168.1.1.3493. This presumably is one of your client-xx users.

                    In sort, your config files are good. Your netstat output is good, with one remote connection [there is no second remote connection]. The only thing is that I cannot reconcile your configuration files and netstat output with the log entries that you posted.

                    Is it possible that you made configuration changes between when the logs were taken and when the config files / netstat output were taken?

                    E 1 Reply Last reply Reply Quote 0
                    • E
                      endy66 @dennypage
                      last edited by

                      @dennypage

                      @dennypage said in NUT Package (2.8.1 and above):

                      @endy66 In the output I see one local connection and one remote connection.

                      The local connection will be upsmon, and is the one that is on ::1.2785 -> ::1.3493. This will be user local-monitor. You can easily confirm this with

                      sockstat -c | grep 3493
                      

                      The local upsmon connection should generate a log entry like this,

                      Feb  1 08:01:20 fw upsd[45590]: User local-monitor@::1 logged into UPS [CyberPower_USV]
                      

                      however you did not show such a log entry. Given that you clearly have a local upsmon connection, there absolutely should be a corresponding log entry.

                      The remote connection is on 192.168.1.8.33624 -> 192.168.1.1.3493. This presumably is one of your client-xx users.

                      In sort, your config files are good. Your netstat output is good, with one remote connection [there is no second remote connection]. The only thing is that I cannot reconcile your configuration files and netstat output with the log entries that you posted.

                      Is it possible that you made configuration changes between when the logs were taken and when the config files / netstat output were taken?

                      I've re-checked everything and you're right indeed, I might have missed something. The log only shows the local and one remote connection

                      User local-monitor@::1 logged into UPS [CyberPower_USV]
                      User client-xx1@192.168.1.8 logged into UPS [CyberPower_USV]
                      

                      So the second user is missing, but I'm clearly able to receive all the values on it. This client is a Home Assistant instance with the NUT client package and I see all the things. And I also used the second login I specified in upsd.users.

                      dennypageD 1 Reply Last reply Reply Quote 0
                      • dennypageD
                        dennypage @endy66
                        last edited by

                        @endy66 said in NUT Package (2.8.1 and above):

                        So the second user is missing, but I'm clearly able to receive all the values on it. This client is a Home Assistant instance with the NUT client package and I see all the things.

                        This one?

                        Network UPS Tools (NUT) integration

                        E 1 Reply Last reply Reply Quote 0
                        • E
                          endy66 @dennypage
                          last edited by

                          @dennypage said in NUT Package (2.8.1 and above):

                          @endy66 said in NUT Package (2.8.1 and above):

                          So the second user is missing, but I'm clearly able to receive all the values on it. This client is a Home Assistant instance with the NUT client package and I see all the things.

                          This one?

                          Network UPS Tools (NUT) integration

                          Yes exactly.

                          dennypageD 1 Reply Last reply Reply Quote 0
                          • dennypageD
                            dennypage @endy66
                            last edited by

                            @endy66 That's what I thought.

                            The short version is that you are wasting your time trying to set up a username/password for a remote HA client because the HA integration doesn't use it. You don't need to enter a username/password when you set up the integration.

                            Since you asked, here's the longer version...

                            You won't see a login from the integration because it isn't a NUT client, and doesn't actually send a LOGON command to upsd. The NUT HA integration doesn't even send the username and password for remote connections. And even if it did send the username/password, upsd would not attempt to validate it until a command (such as LOGON or an instant command) is sent by the client.

                            NUT allows read-only access to ups information without a login which is how the HA integration is written. It connects every 60 seconds (default), polls current status, and disconnects. An actual NUT monitoring client is different. It connects, sends username and password, then issues a LOGIN command to attach to the UPS. It remains connected and polls the UPS on a frequent interval (usually less than 15 seconds).

                            For upsd, the difference is significant. A logged in client is something that upsd is responsible for, and it will monitor the client connection and wait for the client to disconnect before initiating its own shutdown. A non logged in client is expected to be something like a web page. Information display only.

                            I believe that the only time the username/password for HA NUT is used is if you are running the dedicated HA OS and want to be able to issue instant commands to the UPS. Entertainingly, even though it has not sent a LOGIN command, the HA integrations always sends a LOGOUT command before disconnecting from upsd. Very polite. 😊

                            E 1 Reply Last reply Reply Quote 1
                            • E
                              endy66 @dennypage
                              last edited by

                              @dennypage said in NUT Package (2.8.1 and above):

                              @endy66 That's what I thought.

                              The short version is that you are wasting your time trying to set up a username/password for a remote HA client because the HA integration doesn't use it. You don't need to enter a username/password when you set up the integration.

                              Since you asked, here's the longer version...

                              You won't see a login from the integration because it isn't a NUT client, and doesn't actually send a LOGON command to upsd. The NUT HA integration doesn't even send the username and password for remote connections. And even if it did send the username/password, upsd would not attempt to validate it until a command (such as LOGON or an instant command) is sent by the client.

                              NUT allows read-only access to ups information without a login which is how the HA integration is written. It connects every 60 seconds (default), polls current status, and disconnects. An actual NUT monitoring client is different. It connects, sends username and password, then issues a LOGIN command to attach to the UPS. It remains connected and polls the UPS on a frequent interval (usually less than 15 seconds).

                              For upsd, the difference is significant. A logged in client is something that upsd is responsible for, and it will monitor the client connection and wait for the client to disconnect before initiating its own shutdown. A non logged in client is expected to be something like a web page. Information display only.

                              I believe that the only time the username/password for HA NUT is used is if you are running the dedicated HA OS and want to be able to issue instant commands to the UPS. Entertainingly, even though it has not sent a LOGIN command, the HA integrations always sends a LOGOUT command before disconnecting from upsd. Very polite. 😊

                              Thank you so much for this detailed explanation! I didn't knew that there's such a difference or even that the HA integration isn't a "real" NUT client and it also works that different. Then I'll remove the second user from my pfSense.
                              However the integration on HA still helps for notifying if there's a power outtage, even if it's not instant. The server where HA (a VM) runs on, has proper NUT integration (the first client), so it still can shut down properly. I just wondered what's going on as I haven't seen any "login" logs in the pfSense box. Now I know. Thanks again so much for your awesome support, appreciate it a lot!

                              dennypageD 1 Reply Last reply Reply Quote 1
                              • dennypageD
                                dennypage @endy66
                                last edited by

                                @endy66 said in NUT Package (2.8.1 and above):

                                Thank you so much for this detailed explanation!

                                You're welcome.

                                However the integration on HA still helps for notifying if there's a power outtage, even if it's not instant.

                                Just FYI, HA may miss the power outage completely if it is shorter than the polling interval.

                                E 1 Reply Last reply Reply Quote 0
                                • E
                                  endy66 @dennypage
                                  last edited by

                                  @dennypage said in NUT Package (2.8.1 and above):

                                  Just FYI, HA may miss the power outage completely if it is shorter than the polling interval.

                                  That's true yes. I set up a delay of some seconds because I only need a notification if it's a real / longer power outage, otherwise my UPS will just kick in and since it has the capacity to provide power for almost an hour, it's okay to get the norification a bit delayed.

                                  dennypageD 1 Reply Last reply Reply Quote 0
                                  • dennypageD
                                    dennypage @endy66
                                    last edited by

                                    @endy66 Cool. Just wanted to make sure you were aware.

                                    GertjanG 1 Reply Last reply Reply Quote 1
                                    • whoami TMW
                                      whoami TM
                                      last edited by whoami TM

                                      This post is deleted!
                                      1 Reply Last reply Reply Quote 0
                                      • I
                                        incith
                                        last edited by

                                        I dunno what happened. I just updated to 2.8.2_1 and now my tripplite USB connection isn't working.

                                        [nutdev1]
                                        driver = "tripplite_usb"
                                        port = "auto"
                                        vendorid = "09AE"
                                        productid = "0001"
                                        product = "TRIPP LITE SMART500RT1U"
                                        vendor = "Tripp Lite"
                                        bus = "000"
                                        device = "002"
                                        busport = "005"
                                        ###NOTMATCHED-YET###bcdDevice = "000A"

                                        D 1 Reply Last reply Reply Quote 1
                                        • D
                                          DanBlackaz @incith
                                          last edited by

                                          @incith I just did the package upgrade and although the service appeared to be working, it wasn't.

                                          I went to Services -> UPS and UPS Status brought up errors, but then I went to the "UPS Settings" tab and everything looked fine so just pressed Save at the bottom and service is running fine. Maybe try pressing the Save button from the settings page and see if this works for you?

                                          1 Reply Last reply Reply Quote 0
                                          • GertjanG
                                            Gertjan @dennypage
                                            last edited by

                                            @dennypage

                                            NUT Package (2.8.1 and above)

                                            and now its

                                            NUT Package (2.8.1 and above - and back again)

                                            as I received a message from my pfSense :

                                            Notifications in this message: 1
                                            ================================
                                            
                                            13:01:10 The following updates are available and can be installed using System > Package Manager:
                                            
                                            nut: 2.8.2_1 ==> 2.8.2 (downgrade)
                                            

                                            So the update is a downgrade ?

                                            Or is 2.8.2 a more recent as 2.8.2_1 because the name (numbering) changed ?

                                            No "help me" PM's please. Use the forum, the community will thank you.
                                            Edit : and where are the logs ??

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.