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

    NUT package (2.8.0 and below)

    Scheduled Pinned Locked Moved UPS Tools
    1.2k Posts 128 Posters 4.1m 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.
    • K
      kevindd992002 @Gertjan
      last edited by

      @gertjan said in NUT package:

      @kevindd992002 said in NUT package:

      when NUT initiates a shutdown, does it only send commands to the local and remote monitors or does it also send a shutdown command to the UPS?

      NUT, the server, the one that is connected to one or multiple 'local' UPS, polls the status of the UPS. Somthing like every 5 seconds : the UPS doesn't send anything.

      The NUT server doesn't send to it's clients. The clients do the same thing : they poll the NUT server every xx seconds.

      So, NUT as a process can have a 'local UPS' or a remote, other NUT process as a souce. This means that the code for NUT as a server or as a client is the same. Only the source changes.

      A local UPS isn't necessary a local serial or USB device, it can even be a IP based SNMP or any other remotely access type of thing.

      I've read a lot of the manual yesterday ( the source code, as it is available for everybody ) and i'm pretty sure NUT server and client are only polling the 'upstream' info. This can be another NUT installation, or an UPS.
      ( still not 100 % convinced, though )

      Btw : NUT won't shut down the UPS.
      The UPS exposes variables in it's status record that indicate what the battery situation is ( a percentage) and a value where it goes "down". That will be the moment that the outlets go down.
      Up to NUT to to it's thing : shutting down locally.
      So, NUT itself will never 'see' that the UPS goes down. As it shuts down the device it's running ion => it shuts down itself ;)

      Also : NUT is not a program, it a collections of device and interface dependant drivers, server & client programs, tools etc.

      And again : I'm not a NUT specialist at all, but I have a couple of UPSs around me for ages now. @work and @home.

      I see, thanks for the detailed explanation. So as soon as pfsense (my NUT server), shuts down, it's all up to the UPS when to shut off power from its outlets? When does this usually happen? If I remember correctly, the UPS does not wait for its battery to be depleted before doing this. If that's the case, how does the UPS know when to do this? At what point, after a blackout, does it happen?

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

        @kevindd992002 said in NUT package:

        it's all up to the UPS when to shut off power from its outlets?

        Yep.
        Mostly to protect battery, as discharging it to much will affect the life span.
        I guess there isn't even a relay or switch on the outlets of an UPS, the DC to AC convert, just before the transfo, it just stops.

        @kevindd992002 said in NUT package:

        When does this usually happen?

        The internal logic of the UPS maintains a table of battery tension and current over time. This tables helps to predict the battery behaviour over time. Everything is done to get a maximum of load unload cycles out of a battery.
        Classic Lead accid batteries have far less then 1000 cycles.

        @kevindd992002 said in NUT package:

        not wait for its battery to be depleted before doing this

        Noop. The UPS protects it's own battery for doing that. Depending on the type of battery used, depleting it will kill it.

        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
        • dennypageD
          dennypage @Gertjan
          last edited by

          @gertjan At the end of the shutdown process, the NUT master does send a command to the UPS to kill the power (after a delay).

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

            @dennypage said in NUT package:

            At the end of the shutdown process, the NUT master does send a command to the UPS to kill the power (after a delay).

            Aha : I hope there is some known delay then, because when NUT sends that command, the host system is still running.
            System can take their time to shut down (to really power or cold mode).

            Thanks, because you said so, my brain started to help me to finding this : https://networkupstools.org/docs/user-manual.pdf page 35 and further on "NUT outlets management".

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

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

              @kevindd992002 said in NUT package:

              If I remember correctly, when we were discussing this a few years ago, we came to a conclusion that ignorelb is needed for the warning/low battery thresholds override to work.

              You are correct. Thank you for reminding me.

              Ignorelb code reference here.

              1 Reply Last reply Reply Quote 1
              • K
                kevindd992002 @Gertjan
                last edited by kevindd992002

                @gertjan said in NUT package:

                @dennypage said in NUT package:

                At the end of the shutdown process, the NUT master does send a command to the UPS to kill the power (after a delay).

                Aha : I hope there is some known delay then, because when NUT sends that command, the host system is still running.
                System can take their time to shut down (to really power or cold mode).

                Thanks, because you said so, my brain started to help me to finding this : https://networkupstools.org/docs/user-manual.pdf page 35 and further on "NUT outlets management".

                Yes, that's the ups.shutdown.delay that you see in your post above. It's also what @dennypage mentioned to me in the past.

                Your APC and both my APC and EATON UPS'es have a default value of 20 seconds.

                K 1 Reply Last reply Reply Quote 0
                • K
                  kevindd992002 @kevindd992002
                  last edited by kevindd992002

                  @dennypage so I can write to the ups.delay.shutdown variable with upsrw but the values do not persist after a NUT service restart. Do you know of a away to have the modification persist?

                  Also, I tried removing all the overrides + ignorelb and let the UPS use its default low battery threshold of 60%. At 60% it sent an FSD and waited for 3 minutes of HOSTSYNC. Then it waited for the default 20 secs ups.delay.shutdown. As soon as it turned off power from its outlets, it starting back up again even though it still in battery mode (no mains) and beeping.

                  GertjanG H dennypageD 3 Replies Last reply Reply Quote 0
                  • GertjanG
                    Gertjan @kevindd992002
                    last edited by

                    @kevindd992002 said in NUT package:

                    so I can write to the ups.delay.shutdown variable with upsrw but the values do not persist after a NUT service restart.

                    Same observation here.

                    When I set "ups.shutdown.delay" to 25 (it was 20) the UPS (on pfSense) show the new value :

                    eda0f430-35e0-4203-a7a0-58164b84c2f2-image.png

                    But : did it get 'written' to the UPS ??

                    Restaring NUT gve me the old '20'. back.
                    Like NUT 'resets' the UPS to default values ?
                    No a big issue, I guess it's possible to send values to the UPS on "NUT" start-up.

                    I know now I can actually send commands to the UPS :

                    [2.5.2-RELEASE][admin@pfsense.local.net]/root: upscmd ups test.battery.start.quick
                    Username (root): admin
                    Password:
                    OK
                    

                    The UPS did the battery test.

                    I wonder if :

                    upscmd ups load.off
                    

                    works ;)

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

                    K dennypageD 2 Replies Last reply Reply Quote 0
                    • K
                      kevindd992002 @Gertjan
                      last edited by

                      @gertjan said in NUT package:

                      @kevindd992002 said in NUT package:

                      so I can write to the ups.delay.shutdown variable with upsrw but the values do not persist after a NUT service restart.

                      Same observation here.

                      When I set "ups.shutdown.delay" to 25 (it was 20) the UPS (on pfSense) show the new value :

                      eda0f430-35e0-4203-a7a0-58164b84c2f2-image.png

                      But : did it get 'written' to the UPS ??

                      Restaring NUT gve me the old '20'. back.
                      Like NUT 'resets' the UPS to default values ?
                      No a big issue, I guess it's possible to send values to the UPS on "NUT" start-up.

                      I know now I can actually send commands to the UPS :

                      [2.5.2-RELEASE][admin@pfsense.local.net]/root: upscmd ups test.battery.start.quick
                      Username (root): admin
                      Password:
                      OK
                      

                      The UPS did the battery test.

                      I wonder if :

                      upscmd ups load.off
                      

                      works ;)

                      Yeah, it looks like upsrw only writes at runtime. Not sure how to make it persist.

                      For upcsmd and load.off, that command is considered "dangerous" as per the statement here :)

                      1 Reply Last reply Reply Quote 0
                      • H
                        hda @kevindd992002
                        last edited by hda

                        @kevindd992002 said in NUT package:

                        @dennypage so I can write to the ups.delay.shutdown variable with upsrw but the values do not persist after a NUT service restart. Do you know of a away to have the modification persist?

                        My UPS is EATON Ellipse PRO 650

                        Settings master pfSense-box Advanced Additional upsmon.conf:
                        HOSTSYNC 60

                        Settings master pfSense-box Advanced Additional ups.conf:
                        (this makes settings permanent for UPS, ondelay >> offdelay)
                        offdelay 30
                        ondelay 60

                        Setting client/slave XP-box upsmon.conf:
                        shutdown -s -t 0

                        Simulation:
                        /usr/local/sbin/upsmon -c fsd

                        Reality in action:

                        1 s shutdown action start master pfSense-box & HOSTSYNC(max.60)
                        1 s announce shutdown on slave XP-box & shutdown action start XP-box

                        (23 s) pfSense-box kill-signal to UPS, start UPS offdelay(30)
                        (23 s) pfSense-box Halted, waiting on HOSTSYNC(max.60) for XP-box

                        40 s XP-box power-off, therefore takes 40 s
                        43 s pfSense-box power-off (XP-box signals DEAD to pfSense-box)

                        53 s UPS power-off, offdelay(30) expired (started when pfSense-box Halted)

                        83 s UPS power-on, ondelay(60) expired, booting pfSense-box etc.

                        Source of more information:
                        "https://dan.langille.org/2020/09/07/monitoring-your-ups-using-nut-on-freebsd/"

                        K 1 Reply Last reply Reply Quote 0
                        • K
                          kevindd992002 @hda
                          last edited by

                          @hda said in NUT package:

                          @kevindd992002 said in NUT package:

                          @dennypage so I can write to the ups.delay.shutdown variable with upsrw but the values do not persist after a NUT service restart. Do you know of a away to have the modification persist?

                          My UPS is EATON Ellipse PRO 650

                          Settings master pfSense-box Advanced Additional upsmon.conf:
                          HOSTSYNC 60

                          Settings master pfSense-box Advanced Additional ups.conf:
                          (this makes settings permanent for UPS, ondelay >> offdelay)
                          offdelay 30
                          ondelay 60

                          Setting client/slave XP-box upsmon.conf:
                          shutdown -s -t 0

                          Simulation:
                          /usr/local/sbin/upsmon -c fsd

                          Reality in action:

                          1 s shutdown action start master pfSense-box & HOSTSYNC(max.60)
                          1 s announce shutdown on slave XP-box & shutdown action start XP-box

                          (23 s) pfSense-box kill-signal to UPS, start UPS offdelay(30)
                          (23 s) pfSense-box Halted, waiting on HOSTSYNC(max.60) for XP-box

                          40 s XP-box power-off, therefore takes 40 s
                          43 s pfSense-box power-off (XP-box signals DEAD to pfSense-box)

                          53 s UPS power-off, offdelay(30) expired (started when pfSense-box Halted)

                          83 s UPS power-on, ondelay(60) expired, booting pfSense-box etc.

                          Source of more information:
                          "https://dan.langille.org/2020/09/07/monitoring-your-ups-using-nut-on-freebsd/"

                          Thanks for that information!

                          Why does the offdelay start at 23s?

                          For the upsmon fsd simulation test, does the UPS automatically turn its outlets ON immediately after turning them off?

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

                            @kevindd992002 said in NUT package:

                            Also, I tried removing all the overrides + ignorelb and let the UPS use its default low battery threshold of 60%.

                            60%? That doesn't make much sense to me. Default low battery is usually 5-15%.

                            You probably should reach out to the UPS manufacturer to discuss their intended behavior.

                            K 1 Reply Last reply Reply Quote 0
                            • H
                              hda @kevindd992002
                              last edited by hda

                              @kevindd992002 said in NUT package:

                              Thanks for that information!

                              Why does the offdelay start at 23s?

                              For the upsmon fsd simulation test, does the UPS automatically turn its outlets ON immediately after turning them off?

                              Concluded later from my pfSense log:

                              -:03:14 request FSD
                              -:03:30 power-down by root
                              -:03:37 syslogd exiting on signal 15

                              total 23 s

                              As you can read, 83 - 53 = 30 sec before UPS turns on again.

                              It is important that "ONdelay" is longer than "OFFdelay".

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

                                @gertjan said in NUT package:

                                When I set "ups.shutdown.delay" to 25 (it was 20) the UPS (on pfSense) show the new value :

                                But : did it get 'written' to the UPS ??
                                Restaring NUT gve me the old '20'. back.
                                Like NUT 'resets' the UPS to default values ?
                                No a big issue, I guess it's possible to send values to the UPS on "NUT" start-up.

                                If you are using usb (usbhid-ups), I believe the answer is yes, they are reset every time. See the Extra Arguments section in the NUT documentation.

                                @kevindd992002 if you are using usb, you may want to consider using -1 for ondelay based on the feedback you get from your UPS vendor.

                                1 Reply Last reply Reply Quote 0
                                • K
                                  kevindd992002 @dennypage
                                  last edited by

                                  @dennypage said in NUT package:

                                  @kevindd992002 said in NUT package:

                                  Also, I tried removing all the overrides + ignorelb and let the UPS use its default low battery threshold of 60%.

                                  60%? That doesn't make much sense to me. Default low battery is usually 5-15%.

                                  You probably should reach out to the UPS manufacturer to discuss their intended behavior.

                                  Yeah, I know 5-15% is the default value for my APC UPS. Not sure what's up with this Eaton. @hda can you confirm what is the default low battery threshold for your Eaton UPS?

                                  @hda said in NUT package:

                                  @kevindd992002 said in NUT package:

                                  Thanks for that information!

                                  Why does the offdelay start at 23s?

                                  For the upsmon fsd simulation test, does the UPS automatically turn its outlets ON immediately after turning them off?

                                  Concluded later from my pfSense log:

                                  -:03:14 request FSD
                                  -:03:30 power-down by root
                                  -:03:37 syslogd exiting on signal 15

                                  total 23 s

                                  As you can read, 83 - 53 = 30 sec before UPS turns on again.

                                  It is important that "ONdelay" is longer than "OFFdelay".

                                  The turn on sequence for this test only happens because of the fsd simulation, right? When a real blackout occurs, the UPS turns off itself (plus its outlets) and will only turn back on when the mains come back, correct?

                                  @dennypage said in NUT package:

                                  @gertjan said in NUT package:

                                  When I set "ups.shutdown.delay" to 25 (it was 20) the UPS (on pfSense) show the new value :

                                  But : did it get 'written' to the UPS ??
                                  Restaring NUT gve me the old '20'. back.
                                  Like NUT 'resets' the UPS to default values ?
                                  No a big issue, I guess it's possible to send values to the UPS on "NUT" start-up.

                                  If you are using usb (usbhid-ups), I believe the answer is yes, they are reset every time. See the Extra Arguments section in the NUT documentation.

                                  @kevindd992002 if you are using usb, you may want to consider using -1 for ondelay based on the feedback you get from your UPS vendor.

                                  Ahh, that's interesting. For all these parameters/variables, what does a -1 value mean? Disabled? And yes, I'm using usb and the usbhid-ups driver.

                                  H dennypageD 2 Replies Last reply Reply Quote 0
                                  • H
                                    hda @kevindd992002
                                    last edited by hda

                                    @kevindd992002 said in NUT package:

                                    Not sure what's up with this Eaton. @hda can you confirm what is the default low battery threshold for your Eaton UPS?

                                    My EATON has battery low default 20%

                                    Can set it in ups.conf with "lowbatt = 20"

                                    K 1 Reply Last reply Reply Quote 0
                                    • K
                                      kevindd992002 @hda
                                      last edited by

                                      @hda said in NUT package:

                                      @kevindd992002 said in NUT package:

                                      Not sure what's up with this Eaton. @hda can you confirm what is the default low battery threshold for your Eaton UPS?

                                      My EATON has battery low default 20%

                                      Can set it in ups.conf with "lowbatt = 20"

                                      Ok. Then mine is definitely weird at 60%. Without any kind of manual settings modification, does your Eaton UPS work as it should with NUT? Just wondering.

                                      GertjanG H 2 Replies Last reply Reply Quote 0
                                      • GertjanG
                                        Gertjan @kevindd992002
                                        last edited by

                                        @kevindd992002 said in NUT package:

                                        Then mine is definitely weird at 60%

                                        How old is the battery ?
                                        It can understand that an older battery hasn't the same discharge time. Ones the battey mode is activated, it will drain much faster. To compensate, this percentage would need to be higher.
                                        Totally depleting a battery is a big no-no.

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

                                        K 1 Reply Last reply Reply Quote 0
                                        • K
                                          kevindd992002 @Gertjan
                                          last edited by

                                          @gertjan said in NUT package:

                                          @kevindd992002 said in NUT package:

                                          Then mine is definitely weird at 60%

                                          How old is the battery ?
                                          It can understand that an older battery hasn't the same discharge time. Ones the battey mode is activated, it will drain much faster. To compensate, this percentage would need to be higher.
                                          Totally depleting a battery is a big no-no.

                                          2 years or so. I see. Is this generally true for all brands? How can I test for sure?

                                          1 Reply Last reply Reply Quote 0
                                          • H
                                            hda @kevindd992002
                                            last edited by hda

                                            @kevindd992002 said in NUT package:

                                            Without any kind of manual settings modification, does your Eaton UPS work as it should with NUT?

                                            UPS out-of-the-box & NUT is probably not suitable for anyone.
                                            My EATON is doing fine as I want & tell it with NUT conf-files.
                                            The simulation with FSD is comparable with realtime BATTERY-LOW behaviour.
                                            Read my previous post about my setup and experience.

                                            Again with offdelay(), NUT can claim/secure UPS battery-running-time
                                            even when all boxes are already killed.

                                            The offdelay countdown starts when NUT master (pfSense) finalises its shutdown (halting).
                                            I think max. HOSTSYNC-time cannot override offdelay-time.

                                            So you have to tune, match (offdelay_seconds) with (=)
                                            (slowest_slave_shutdown_seconds - master(pfSense)_shutdown_seconds + your_safety_margin_seconds).
                                            This time reservation must fit in the remaining time for lowbatt %.

                                            N.B. if slave boxes cannot finalise with the standard/default offdelay-time (=15 ? =20 ?),
                                            then your UPS will cut-out too early (or it already ran out of "juice" earlier).

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