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 33.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.
    • S
      Starrbuck
      last edited by

      No hurry.  It freaked me out for a bit until I figured out I was causing it by going to Snort first.  ;)

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

        I'm not sure how long the release will take to go through the system, so I sent out a beta4 with the url fix. This should be the same as the pending release except for the version number. If you come across any other issues, please do let me know. Again, thank you for your help!

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

          Sure thing, glad to help.

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

            I can report that all is working.
            But I want report some strange issue, if you are just updating your previous beta then NUT service refuses to start automatically, widget just reports that UPS need attention and you must reboot or wait while it reconnects.

            Jul 28 19:29:06 upsd 57399 - I've manually pushed start service button on UPS page

            
            Jul 28 19:29:16 	upsmon 	58301 	Communications with UPS SMK-1000A established
            Jul 28 19:29:15 	upsd 	57956 	Connected to UPS [SMK-1000A]: snmp-ups-SMK-1000A
            Jul 28 19:29:13 	snmp-ups 	59689 	Startup successful
            Jul 28 19:29:11 	upsmon 	58301 	UPS SMK-1000A is unavailable
            Jul 28 19:29:11 	upsmon 	58301 	Poll UPS [SMK-1000A] failed - Driver not connected
            Jul 28 19:29:06 	upsmon 	58301 	Communications with UPS SMK-1000A lost
            Jul 28 19:29:06 	upsmon 	58301 	Poll UPS [SMK-1000A] failed - Driver not connected
            Jul 28 19:29:06 	upsd 	57956 	User monuser@::1 logged into UPS [SMK-1000A]
            Jul 28 19:29:06 	upsmon 	58073 	Startup successful
            Jul 28 19:29:06 	upsd 	57956 	Startup successful
            Jul 28 19:29:06 	upsd 	57399 	Can't connect to UPS [SMK-1000A] (snmp-ups-SMK-1000A): No such file or directory
            Jul 28 19:29:06 	upsd 	57399 	listening on 127.0.0.1 port 3493
            Jul 28 19:29:06 	upsd 	57399 	listening on ::1 port 3493
            Jul 28 19:29:06 	upsd 	57399 	upsd.conf: invalid directive maxage = 25
            Jul 28 19:27:52 	pkg 		pfSense-pkg-nut-2.7.4b4 installed
            Jul 28 19:27:52 	php 		/etc/rc.packages: Successfully installed package: nut.
            Jul 28 19:27:52 	check_reload_status 		Syncing firewall
            Jul 28 19:27:51 	upsmon 	27988 	Communications with UPS SMK-1000A lost
            Jul 28 19:27:51 	upsmon 	27988 	Poll UPS [SMK-1000A] failed - Driver not connected
            Jul 28 19:27:51 	upsd 	27378 	User monuser@::1 logged into UPS [SMK-1000A]
            Jul 28 19:27:51 	upsmon 	27815 	Startup successful
            Jul 28 19:27:51 	upsd 	27378 	Startup successful
            Jul 28 19:27:51 	upsd 	26835 	Can't connect to UPS [SMK-1000A] (snmp-ups-SMK-1000A): No such file or directory
            Jul 28 19:27:51 	upsd 	26835 	listening on 127.0.0.1 port 3493
            Jul 28 19:27:51 	upsd 	26835 	listening on ::1 port 3493
            Jul 28 19:27:51 	upsd 	26835 	upsd.conf: invalid directive maxage = 25
            Jul 28 19:27:51 	php 		/etc/rc.packages: Starting service nut
            Jul 28 19:27:51 	snmp-ups 	86120 	Signal 15: exiting
            Jul 28 19:27:51 	upsd 	61866 	Signal 15: exiting
            Jul 28 19:27:51 	upsd 	61866 	mainloop: Interrupted system call
            Jul 28 19:27:51 	upsd 	61866 	User monuser@::1 logged out from UPS [SMK-1000A]
            Jul 28 19:27:51 	upsmon 	62862 	Signal 15: exiting
            Jul 28 19:27:51 	php 		/etc/rc.packages: Stopping service nut
            Jul 28 19:27:51 	check_reload_status 		Syncing firewall
            Jul 28 19:27:51 	php 		/etc/rc.packages: Beginning package installation for nut . 
            
            

            Don't look at "maxage = 25" it's already fixed ;)

            Also when I push restart service it restarts and "UPS Status" shows me same alert "Status Alert: The UPS requires attention", if I just hit refresh button in browser — everything coming back to normal state.

            Sample log after pushing restart service:

            
            Jul 28 19:47:35 	upsmon 	90347 	Communications with UPS SMK-1000A established
            Jul 28 19:47:34 	upsd 	89700 	Connected to UPS [SMK-1000A]: snmp-ups-SMK-1000A
            Jul 28 19:47:32 	snmp-ups 	14241 	Startup successful
            Jul 28 19:47:30 	upsmon 	90347 	UPS SMK-1000A is unavailable
            Jul 28 19:47:30 	upsmon 	90347 	Poll UPS [SMK-1000A] failed - Driver not connected
            Jul 28 19:47:25 	upsmon 	90347 	Communications with UPS SMK-1000A lost
            Jul 28 19:47:25 	upsmon 	90347 	Poll UPS [SMK-1000A] failed - Driver not connected
            Jul 28 19:47:25 	upsd 	89700 	User monuser@::1 logged into UPS [SMK-1000A]
            Jul 28 19:47:25 	upsmon 	90280 	Startup successful
            Jul 28 19:47:25 	upsd 	89700 	Startup successful
            Jul 28 19:47:25 	upsd 	88694 	Can't connect to UPS [SMK-1000A] (snmp-ups-SMK-1000A): No such file or directory
            Jul 28 19:47:25 	upsd 	88694 	listening on 127.0.0.1 port 3493
            Jul 28 19:47:25 	upsd 	88694 	listening on ::1 port 3493
            Jul 28 19:47:25 	snmp-ups 	23316 	Signal 15: exiting
            Jul 28 19:47:25 	upsd 	11392 	Signal 15: exiting
            Jul 28 19:47:25 	upsd 	11392 	mainloop: Interrupted system call
            Jul 28 19:47:25 	upsmon 	11755 	upsmon parent: read
            Jul 28 19:47:25 	upsd 	11392 	User monuser@::1 logged out from UPS [SMK-1000A]
            Jul 28 19:47:25 	upsmon 	11893 	Signal 15: exiting 
            
            

            Am I missing something or my configuration is wrong elsewhere?

            I have attached one.

            conf_nut.jpg
            conf_nut.jpg_thumb

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

              The service being stopped on update is expected. The package install is being done outside of pfSense and there is nothing which calls for a start the service after.

              I'll have a look at the other issue shortly.

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

                w0w, can you check something for me please?

                Edit /usr/local/etc/rc.d/nut.sh and remove the ampersand from the end of the line where the driver is started:

                /usr/local/sbin/upsdrvctl start

                Then perform the service restart test. Thanks.

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

                  It does not change anything visually on  Services/UPS/Status — it shows "Status Alert: The UPS requires attention". But log looks much better.

                  
                  Jul 29 18:04:30 	upsd 	76451 	User monuser@::1 logged into UPS [SMK-1000A]
                  Jul 29 18:04:30 	upsmon 	76948 	Startup successful
                  Jul 29 18:04:30 	upsd 	76451 	Startup successful
                  Jul 29 18:04:30 	upsd 	76213 	Connected to UPS [SMK-1000A]: snmp-ups-SMK-1000A
                  Jul 29 18:04:30 	upsd 	76213 	listening on 127.0.0.1 port 3493
                  Jul 29 18:04:30 	upsd 	76213 	listening on ::1 port 3493
                  Jul 29 18:04:30 	snmp-ups 	76099 	Startup successful
                  Jul 29 18:04:23 	snmp-ups 	87584 	Signal 15: exiting
                  Jul 29 18:04:23 	upsd 	88014 	Signal 15: exiting
                  Jul 29 18:04:23 	upsd 	88014 	mainloop: Interrupted system call
                  Jul 29 18:04:23 	upsd 	88014 	User monuser@::1 logged out from UPS [SMK-1000A]
                  Jul 29 18:04:23 	upsmon 	88636 	Signal 15: exiting 
                  
                  

                  Should we call Services/UPS/Status page refresh with some delay or  use some flag memory that /usr/local/etc/rc.d/nut.sh have done it's job already?

                  1 Reply Last reply Reply Quote 0
                  • D
                    DownloadDeviant
                    last edited by

                    I'm not testing this but was hoping I could add some food for thought. Just speaking from my personal experience from running about 5 different pfSense routers for myself, my small business and a family member's small biz. I've used NUT and my typical setup is to have it remotely access the UPS connected directly to my Synology and/or FreeNAS devices. Obviously, because I'm dealing with small spaces and cannot have a dedicated UPS for every device.

                    My biggest headache has been when things go bad. Example - A pfSense router goes whacky and a fresh install then restore from backup config has to be performed. Typically, this is simple enough. However, I've always had trouble with NUT causing odd behavior with the recovery. I've had to manually edit the config file and remove all traces of NUT content.  For the record, I've learned to create backup configs that do not include package data

                    I'd like to see this new version play nice on recovery if a config does happen to include package data…if possible.

                    Also, I'm very excited to see a new version and continued development of this package! Thanks DennyPage!

                    System: pfSense 2.4.3p1 - ZFS CPU: AMD Athlon 5350 (Kabini) MOBO: ASRock AM1H-ITX HD: 60GB SSD Patriot Inferno RAM: G.SKILL 8GB DDR3 2133 NIC: Intel I350-T2 PS: Lite-On 75W AC PACKAGES: Cron, NUT

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

                      Yea, that makes sense. Theres a bit of a catch-22 as the async startup for the driver is required to support the use of startup retry (maxretry/retrydelay) in ups.conf. It's taking a long time for the initial connect to the SNMP UPS.

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

                        Beta 4 appears to have the same problem with Snort.

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

                          Can you confirm the checksum on the following files please?

                          32332 22 /usr/local/www/nut_settings.php
                          14138 5 /usr/local/www/nut_status.php
                          47031 3 /usr/local/pkg/nut.xml
                          3633 12 /usr/local/pkg/nut/nut.inc

                          @Starrbuck:

                          Beta 4 appears to have the same problem with Snort.

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

                            I uninstalled and reinstalled the package and it's ok now.

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

                              Kinda figured that would do it. Thanks for confirming.

                              @Starrbuck:

                              I uninstalled and reinstalled the package and it's ok now.

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

                                This modification works for me.

                                
                                $status = nut_ups_status();
                                if ($status['_alert']) {
                                	sleep(10);
                                	$status = nut_ups_status();
                                		if ($status['_alert']) {
                                		print_info_box("Status Alert: The UPS requires attention", "alert-danger");
                                }
                                }
                                
                                

                                The other issue I have — head.inc does not show restart service button anymore after successful  restart, but if I  unplug cable from SNMP card then it shows.

                                some_bug.jpg_thumb
                                some_bug.jpg

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

                                  
                                  $status = nut_ups_status();
                                  if ($status['_alert']) {
                                  	sleep(10);
                                  }
                                  
                                  $pgtitle = array(gettext("Services"), gettext("UPS"), gettext("Status"));
                                  include("head.inc");
                                  $tab_array = array();
                                  $tab_array[] = array(gettext("UPS Status"), true, "/nut_status.php");
                                  $tab_array[] = array(gettext("UPS Settings"), false, "/nut_settings.php");
                                  display_top_tabs($tab_array);
                                  
                                  $status = nut_ups_status();
                                  		if ($status['_alert']) {
                                  		print_info_box("Status Alert: The UPS requires attention", "alert-danger");
                                  }
                                  
                                  

                                  This way both problems fixed, with buttons and wait for service be ready on page load.

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

                                    Yea, there isn't much ill that a 10 second sleep doesn't fix. However I don't think I can introduce a 10 second sleep in the UX. It creates a delay in communicating the error condition for local UPSs.

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

                                      @dennypage:

                                      Yea, there isn't much ill that a 10 second sleep doesn't fix. However I don't think I can introduce a 10 second sleep in the UX. It creates a delay in communicating the error condition for local UPSs.

                                      Sleep activated only if first $status query return '_alert', else NO DELAY applied. In normal condition if I understand your
                                      nut.inc correctly this never should return '_alert' if connection is OK, it does not matter local or remote connection established.

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

                                        It introduces a ten second delay in all alert circumstances. However the issue we are trying to address only occurs on service start and only with a slow (remote) UPS.

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

                                          Btw, forgot to ask this earlier: Is the use of v2c a holdover from the prior NUT package, or did you explicitly configure it? Have you tried running without it?

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

                                            @dennypage:

                                            It introduces a ten second delay in all alert circumstances. However the issue we are trying to address only occurs on service start and only with a slow (remote) UPS.

                                            I am not sure are we talking about the same thing? I have tested it with firefox and it works as it should in UX. If UPS connection is OK and established there is no delay in loading status page, I mean delay is less then 1 second and if there is a problem with connection (cable unplugged or whatever), then it returns "Status Alert: The UPS requires attention" as it should be but after 10 seconds delay or returns UPS data if connection is established during this 10sec sleep. Why sleep should be called in all alert circumstances? I don't understand. I am sorry. I am not an PHP programmer, but if logiс is the same for all languages I know. If I do something wrong, then feel free to tell me :)

                                            @dennypage:

                                            Btw, forgot to ask this earlier: Is the use of v2c a holdover from the prior NUT package, or did you explicitly configure it? Have you tried running without it?

                                            It's not from prior, it's required for some other clients on network.

                                            EDIT:
                                            Now I understand what you mean, forgive me please for my stupidity. Looked deeply into nut.inc
                                            Yes we need some other way to fix it.

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