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

    Beta test of new NUT UPS package

    Scheduled Pinned Locked Moved pfSense Packages
    114 Posts 15 Posters 39.5k 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.
    • w0wW
      w0w
      last edited by

      I have reinstalled package completely and now it's a bit different error appears.
      Looked at nut.sh
      You forgot to remove ampersand at /usr/local/sbin/upsdrvctl start & 
      when I remove it, all is working as it should!

      some_new.jpg
      some_new.jpg_thumb

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

        Yes, that makes much more sense, and what I was expecting to see.

        Removing the ampersand was a testing item to ensure I understood what was happening on your system. I wasn't intending to remove it from the production package as it is required to support the startup retry.

        The thing that I fixed was the service status issue (the restart vs start button at the top). The "Failed to retrieve status" is kind of a fact of life because it is taking a very long time to initialize via SNMP. About the only thing that I could do about that is to have it report "pending", but then you would still have to press refresh in the page because the UI pages don't auto-refresh.

        1 Reply Last reply Reply Quote 0
        • w0wW
          w0w
          last edited by

          Hmm… startup retry? Why do we need that?

          Without ampersand, all working.

          
           Aug 2 09:35:23 	upsd 	5793 	User monuser@::1 logged into UPS [SMK-1000A]
          Aug 2 09:35:23 	upsd 	5793 	Startup successful
          Aug 2 09:35:23 	upsd 	5467 	Connected to UPS [SMK-1000A]: snmp-ups-SMK-1000A
          Aug 2 09:35:23 	upsd 	5467 	listening on 127.0.0.1 port 3493
          Aug 2 09:35:23 	upsd 	5467 	listening on ::1 port 3493
          Aug 2 09:35:21 	snmp-ups 	5221 	Startup successful
          Aug 2 09:35:14 	upsmon 	3642 	Startup successful
          Aug 2 09:35:14 	snmp-ups 	49799 	Signal 15: exiting
          Aug 2 09:35:14 	upsd 	64420 	Signal 15: exiting
          Aug 2 09:35:14 	upsd 	64420 	mainloop: Interrupted system call
          Aug 2 09:35:14 	upsd 	64420 	User monuser@::1 logged out from UPS [SMK-1000A]
          Aug 2 09:35:14 	upsmon 	48594 	Signal 15: exiting 
          
          

          With ampersand (Failed to retrieve status)

          
          Aug 2 09:39:33 	upsmon 	96136 	Communications with UPS SMK-1000A established
          Aug 2 09:39:30 	upsd 	96547 	Connected to UPS [SMK-1000A]: snmp-ups-SMK-1000A
          Aug 2 09:39:29 	snmp-ups 	97935 	Startup successful
          Aug 2 09:39:28 	upsmon 	96136 	UPS SMK-1000A is unavailable
          Aug 2 09:39:28 	upsmon 	96136 	Poll UPS [SMK-1000A] failed - Driver not connected
          Aug 2 09:39:23 	upsmon 	96136 	Communications with UPS SMK-1000A lost
          Aug 2 09:39:23 	upsmon 	96136 	Poll UPS [SMK-1000A] failed - Driver not connected
          Aug 2 09:39:23 	upsd 	96547 	User monuser@::1 logged into UPS [SMK-1000A]
          Aug 2 09:39:21 	upsd 	96547 	Startup successful
          Aug 2 09:39:21 	upsd 	96511 	Can't connect to UPS [SMK-1000A] (snmp-ups-SMK-1000A): No such file or directory
          Aug 2 09:39:21 	upsd 	96511 	listening on 127.0.0.1 port 3493
          Aug 2 09:39:21 	upsd 	96511 	listening on ::1 port 3493
          Aug 2 09:39:20 	upsmon 	95585 	Startup successful
          Aug 2 09:39:20 	snmp-ups 	5221 	Signal 15: exiting
          Aug 2 09:39:20 	upsd 	5793 	Signal 15: exiting
          Aug 2 09:39:20 	upsd 	5793 	mainloop: Interrupted system call
          Aug 2 09:39:20 	upsd 	5793 	User monuser@::1 logged out from UPS [SMK-1000A]
          Aug 2 09:39:20 	upsmon 	4091 	Signal 15: exiting 
          
          
          1 Reply Last reply Reply Quote 0
          • w0wW
            w0w
            last edited by

            Looks like this "retry" thing not working at all with SNMP connection, just causes it to re-establish twice.

            1 Reply Last reply Reply Quote 0
            • w0wW
              w0w
              last edited by

              Increased sleep
              ….......................................................
              /usr/local/sbin/upsdrvctl start &
              sleep 12
              /usr/local/sbin/upsd -u root
              ..........................................................

              
              Aug 2 09:49:14 	upsd 	31334 	User monuser@::1 logged into UPS [SMK-1000A]
              Aug 2 09:49:13 	upsd 	31334 	Startup successful
              Aug 2 09:49:13 	upsd 	31056 	Connected to UPS [SMK-1000A]: snmp-ups-SMK-1000A
              Aug 2 09:49:13 	upsd 	31056 	listening on 127.0.0.1 port 3493
              Aug 2 09:49:13 	upsd 	31056 	listening on ::1 port 3493
              Aug 2 09:49:12 	snmp-ups 	30987 	Startup successful
              Aug 2 09:49:01 	upsmon 	9616 	Startup successful
              Aug 2 09:49:01 	snmp-ups 	6655 	Signal 15: exiting
              Aug 2 09:49:01 	upsd 	7053 	Signal 15: exiting
              Aug 2 09:49:01 	upsd 	7053 	mainloop: Interrupted system call
              Aug 2 09:49:01 	upsd 	7053 	User monuser@::1 logged out from UPS [SMK-1000A]
              Aug 2 09:49:01 	upsmon 	5726 	Signal 15: exiting 
              
              

              Is it OK for you?

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

                @w0w:

                Hmm… startup retry? Why do we need that?

                It was requested: https://forum.pfsense.org/index.php?topic=114871.msg638897#msg638897

                It's necessary to address the case of the ups being unreachable at pfSense startup.

                1 Reply Last reply Reply Quote 0
                • w0wW
                  w0w
                  last edited by

                  I am sorry  :'(, but may be I have tested it in wrong way. If I unplug SNMP card from the network and then restart the service — it does not reconnects to the UPS. All I get in logs is

                  
                  endless....
                  Aug 2 10:22:46 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                  Aug 2 10:22:41 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                  Aug 2 10:22:36 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                  Aug 2 10:22:31 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                  Aug 2 10:22:26 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                  Aug 2 10:22:21 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                  Aug 2 10:22:16 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                  Aug 2 10:22:11 	upsmon 	50160 	UPS SMK-1000A is unavailable 
                  
                  

                  Looks like it does not matter sleep 1 or 12 is applied.

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

                    Do you still have maxretry and retrydelay in the advanced section?

                    https://forum.pfsense.org/index.php?topic=114871.msg640123#msg640123

                    You should be seeing a stream of messages from the snmp driver…

                    @w0w:

                    If I unplug SNMP card from the network and then restart the service — it does not reconnects to the UPS. All I get in logs is

                    
                    endless....
                    Aug 2 10:22:46 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                    Aug 2 10:22:41 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                    Aug 2 10:22:36 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                    Aug 2 10:22:31 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                    Aug 2 10:22:26 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                    Aug 2 10:22:21 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                    Aug 2 10:22:16 	upsmon 	50160 	Poll UPS [SMK-1000A] failed - Driver not connected
                    Aug 2 10:22:11 	upsmon 	50160 	UPS SMK-1000A is unavailable 
                    
                    
                    1 Reply Last reply Reply Quote 0
                    • w0wW
                      w0w
                      last edited by

                      Double checked my setup and config and found that I am an idiot.
                      maxretry=60
                      retrydelay=60
                      was placed into upsmon.conf instead of ups.conf
                      I have removed both ampersand and sleep from nut.sh
                      Testing again

                      1 Reply Last reply Reply Quote 0
                      • w0wW
                        w0w
                        last edited by

                        Looks like all working without ampersand and sleep.
                        But when ampersand removed it takes a while to load status page with disconnected UPS ;).
                        So I ask you again, is it OK for you if sleep would be 12 seconds instead of 1?
                        With this value all seems OK on my side. Reconnection after SNMP down and service restart  with SNMP online on status page is OK. No issues currently!

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

                          I really can't do a 12 second sleep in service start. The 95% case is that UPS startup takes well under 1 second. An additional delay in service start affects everyone and everything including system startup (boot). Introducing a 10+ second delay to system startup would not be generally acceptable. It also creates a situation in which there can be multiple service starts underway at the same time, which can result in all sorts of problems with nut. And of course, 12 seconds works in this specific case, but what happens when a case comes along that requires 20 seconds for UPS initialization?

                          The backgrounding for driver start is required to support initialization retries. Without backgrounding, status page load (and system startup) will hang until driver initilization completes. With the maxretry/retrydelay example previously posted, this could be 1 hour. Note that maxretry/retrydelay only affects driver initialization (startup). It does not affect disconnect/reconnect.

                          About the only thing I can do is have the status be "pending" like what is shown in the widget following system boot.

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

                            I sent out a beta 6 version to everyone. The only change is the ups “pending” change discussed above. To avoid any confusion, please delete the prior version via pkg delete prior to installing the new version.

                            If you have time to give this version a test, I would really appreciate it. I'd like to put this to bed. Thanks!

                            1 Reply Last reply Reply Quote 0
                            • w0wW
                              w0w
                              last edited by

                              
                              Aug 3 07:11:33 	pkg 		pfSense-pkg-nut-2.7.4b6 installed
                              Aug 3 07:11:33 	php 		/etc/rc.packages: Successfully installed package: nut.
                              Aug 3 07:11:33 	check_reload_status 		Syncing firewall
                              Aug 3 07:11:29 	php 		/etc/rc.packages: Starting service nut
                              Aug 3 07:11:29 	check_reload_status 		Syncing firewall
                              Aug 3 07:11:28 	php 		/etc/rc.packages: Beginning package installation for nut .
                              Aug 3 07:11:28 	pkg 		nut-2.7.4 installed
                              Aug 3 07:11:18 	pkg 		nut-2.7.4 deinstalled 
                              
                              

                              But… NUT service itself does not start automatically after installation. Only on saving config or reboot.

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

                                @w0w:

                                But… NUT service itself does not start automatically after installation. Only on saving config or reboot.

                                This is expected: https://forum.pfsense.org/index.php?topic=114871.msg643281#msg643281

                                1 Reply Last reply Reply Quote 0
                                • w0wW
                                  w0w
                                  last edited by

                                  Ok then. It works.

                                  1 Reply Last reply Reply Quote 0
                                  • w0wW
                                    w0w
                                    last edited by

                                    dennypage
                                    Thank you for reload page script also ;) Some days before I have tried similar one also but without success.

                                    1 Reply Last reply Reply Quote 0
                                    • T
                                      timotl
                                      last edited by

                                      dennypage

                                      Connected fine to my APC UPS over SNMP.
                                      It even picked up the config and converted it.
                                      The old package had all of the SNMP settings broken out so you could just fill it in.
                                      It looks like the only one really needed anymore is the community string.
                                      Might be more friendly to have a setting for it or a note in the extra arguments.

                                      All working fine for me though, but it did take a second to look for UPS instead of NUT in the services list.  :)

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

                                        @w0w:

                                        Thank you for reload page script also ;)

                                        You're welcome!

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

                                          Thanks timotl, I'm glad it worked for you. I reason I didn't put the community string as a primary part of the config is because it is optional to the driver and the majority of folk leave this as the default value (public). I'll add a note to the doc thread in the forum to make sure people know. Thanks again for your help with testing!

                                          1 Reply Last reply Reply Quote 0
                                          • S
                                            Starrbuck
                                            last edited by

                                            @dennypage:

                                            I sent out a beta 6 version to everyone. The only change is the ups “pending” change discussed above. To avoid any confusion, please delete the prior version via pkg delete prior to installing the new version.

                                            If you have time to give this version a test, I would really appreciate it. I'd like to put this to bed. Thanks!

                                            Beta 6 working fine here.

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