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

      @uk_dave A few questions:

      • Are you using running the current version of pfSense (2.4.5)?
      • Are you using the current version of the nut package (2.7.4_7)?
      • Do you have anything in Advanced Settings? In particular, any of these?
        • ignorelb
        • override.battery.charge.warning
        • override.battery.charge.low
        • override.battery.runtime.low
      U 1 Reply Last reply Reply Quote 0
      • U
        uk_dave @dennypage
        last edited by

        @dennypage Thanks for replying,

        Running 2.4.5-RELEASE-p1 (amd64) of pfSense and 2.7.4_7 of the NUT package.

        I'm currently doing this testing on a fresh install of pfSense, all I had added to the config was:

        USB Type: Local USB
        UPS Name: ups
        Driver: usbhid
        ups.users: [remoteuser]
        password = upsmon
        upsmon slave

        Here's my UPS: BR1500GI

        I have disabled the master / slave behaviour of the UPS so all 5x sockets on the battery backup side should be in the 'Battery backup outlets with surge protection only' mode. I was assuming that NUT tells the UPS to shutdown and therefore having 5x sockets I can use rather than 3x was preferable.

        Thanks,
        Dave

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

          @uk_dave said in NUT package:

          BR1500GI

          Can you post output of upsrw and upsc for the device please?

          U 1 Reply Last reply Reply Quote 0
          • U
            uk_dave @dennypage
            last edited by

            @dennypage Output below:

            [2.4.5-RELEASE][admin@pfSense.localdomain]/root: upsrw ups
            [battery.charge.low]
            Remaining battery level when UPS switches to LB (percent)
            Type: STRING
            Maximum length: 10
            Value: 10
            
            [battery.runtime.low]
            Remaining battery runtime when UPS switches to LB (seconds)
            Type: STRING
            Maximum length: 10
            Value: 120
            
            [input.sensitivity]
            Input power sensitivity
            Type: STRING
            Maximum length: 10
            Value: medium
            
            [input.transfer.high]
            High voltage transfer point (V)
            Type: STRING
            Maximum length: 10
            Value: 294
            
            [input.transfer.low]
            Low voltage transfer point (V)
            Type: STRING
            Maximum length: 10
            Value: 176
            
            [ups.delay.shutdown]
            Interval to wait after shutdown with delay command (seconds)
            Type: STRING
            Maximum length: 10
            Value: 20
            
            [2.4.5-RELEASE][admin@pfSense.localdomain]/root: upsc ups
            battery.charge: 100
            battery.charge.low: 10
            battery.charge.warning: 50
            battery.date: 2001/09/25
            battery.mfr.date: 2015/03/19
            battery.runtime: 771
            battery.runtime.low: 120
            battery.type: PbAc
            battery.voltage: 27.3
            battery.voltage.nominal: 24.0
            device.mfr: American Power Conversion
            device.model: Back-UPS RS 1500G
            device.serial: 3B1512X15061
            device.type: ups
            driver.name: usbhid-ups
            driver.parameter.pollfreq: 30
            driver.parameter.pollinterval: 2
            driver.parameter.port: auto
            driver.parameter.synchronous: no
            driver.version: 2.7.4
            driver.version.data: APC HID 0.96
            driver.version.internal: 0.41
            input.sensitivity: medium
            input.transfer.high: 294
            input.transfer.low: 176
            input.voltage: 245.0
            input.voltage.nominal: 230
            ups.beeper.status: disabled
            ups.delay.shutdown: 20
            ups.firmware: 878.L4 .I
            ups.firmware.aux: L4
            ups.load: 29
            ups.mfr: American Power Conversion
            ups.mfr.date: 2015/03/19
            ups.model: Back-UPS RS 1500G
            ups.productid: 0002
            ups.realpower.nominal: 865
            ups.serial: 3B1512X15061
            ups.status: OL
            ups.test.result: No test initiated
            ups.timer.reboot: 0
            ups.timer.shutdown: -1
            ups.vendorid: 051d
            [2.4.5-RELEASE][admin@pfSense.localdomain]/root:
            

            Thanks again :)

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

              I don't see anything troubling in your upsrw or upsc output.

              @uk_dave said in NUT package:

              My problem is that when power is restored, as soon as the host that talks to the UPS starts to boot up (i.e. immediately after going through POST) it triggers the UPS to go on battery (despite being plugged into the wall with AC power on) which it then stays on until the battery dies.

              More questions:

              • Are you testing by pulling mains from the UPS? Assuming yes...
              • When the pfSense shutdown occurs, is the UPS turning off the output?
              • How long are you waiting before restoring mains to the UPS?
              U 1 Reply Last reply Reply Quote 0
              • U
                uk_dave @dennypage
                last edited by

                @dennypage

                • yes, I turn the mains socket off
                • I don't believe it is, I've got a halogen lamp on a dimmer that can pull up to 435W so I've varied the load to full to bring the estimated run time down to 1 min remaining to force the shutdown process then ease up so it can last a few minutes and the UPS doesn't shut down until the battery dies... definitely longer than 20s
                • I usually wait about a minute before restoring power.
                dennypageD 1 Reply Last reply Reply Quote 0
                • dennypageD
                  dennypage @uk_dave
                  last edited by

                  @uk_dave said in NUT package:

                  I don't believe it is

                  Okay, this definitely is a problem. The last thing nut does is instruct the UPS to remove power after the configurable delay (20s by default).

                  What I would do next is to move the pfSense box to not be powered by the UPS, but still have the USB connected. Then, test the power kill command of the UPS using "upsdrvctl shutdown" or the -k option to usbhid-ups.

                  U 1 Reply Last reply Reply Quote 0
                  • 4
                    4o4rh @dennypage
                    last edited by

                    @dennypage can you help with the correct config pls.
                    I have a APC UPS master on TrueNAS box

                    I have a dumb UPS connected to pfsense and need to shutdown pfsense based on a timer triggered by the master due to the non-shared UPS.

                    I have looked at the NUT documentation and examples below but i can't figure out if i need to use the heartbeat config or not.

                    http://rogerprice.org/NUT/ConfigExamples.A5.pdf
                    https://wiki.ipfire.org/addons/nut/detailed

                    i simply want to shutdown the slave 20min after power loss, but obviously cancel the timer if the power comes back.

                    is the a way to simulate a power failure on the master to test the slave without actually cutting power to the master?

                    4 dennypageD 2 Replies Last reply Reply Quote 0
                    • U
                      uk_dave @dennypage
                      last edited by

                      @dennypage
                      Hi, I have pfSense plugged into the wall and connected to the UPS via USB.

                      running 'upsdrvctl shutdown' does indeed turn off the outputs, 20s later shutdowns the UPS which then turns back on since AC is still active to the UPS. Watching the console of pfSense it goes through:

                      • Initiating UPS shutdown
                      • UPS ups on battery
                      • UPS ups on line power

                      I wondered if somehow it had automagically fixed itself so after booting up again (successfully) I pulled the power to the UPS. pfSense shutdown correctly but the UPS outputs are still active and being powered. Left it for about 5 minutes but the UPS did not shutdown.

                      This behaviour is consistent using NUT over 3x different machines and 2x different USB cables (bought another for testing). The machines I've been testing on (each as a standalone master) are:

                      • HP T730 thin client (currently using as a test pfSense environment)
                      • Asus Chromebox running Ubuntu
                      • Supermicro pfSense machine based around a X11SCL-IF

                      Two common denominators... the UPS and me, one of them is doing something wrong I think :)
                      Cheers

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

                        @uk_dave said in NUT package:

                        I wondered if somehow it had automagically fixed itself so after booting up again (successfully) I pulled the power to the UPS. pfSense shutdown correctly but the UPS outputs are still active and being powered. Left it for about 5 minutes but the UPS did not shutdown.
                        This behaviour is consistent using NUT over 3x different machines and 2x different USB cables (bought another for testing). The machines I've been testing on (each as a standalone master) are:

                        HP T730 thin client (currently using as a test pfSense environment)
                        Asus Chromebox running Ubuntu
                        Supermicro pfSense machine based around a X11SCL-IF

                        Very weird. It seems like the the shutdown command is being ignored if the UPS is on battery. It sounds like a firmware bug, but you said that apcupsd worked correctly. I'm afraid I'm out of ideas. You might approach folk on the NUT mailing list and see what they might have to offer.

                        U 1 Reply Last reply Reply Quote 0
                        • U
                          uk_dave @dennypage
                          last edited by

                          @dennypage

                          Thanks for all your help anyway. I've sent an email to the NUT mailing list so see if anyone has any ideas.
                          Cheers

                          1 Reply Last reply Reply Quote 0
                          • 4
                            4o4rh @4o4rh
                            last edited by 4o4rh

                            @gwaitsi said in NUT package:

                            @dennypage can you help with the correct config pls.
                            I have a APC UPS master on TrueNAS box

                            I have a dumb UPS connected to pfsense and need to shutdown pfsense based on a timer triggered by the master due to the non-shared UPS.

                            I have looked at the NUT documentation and examples below but i can't figure out if i need to use the heartbeat config or not.

                            http://rogerprice.org/NUT/ConfigExamples.A5.pdf
                            https://wiki.ipfire.org/addons/nut/detailed

                            i simply want to shutdown the slave 20min after power loss, but obviously cancel the timer if the power comes back.

                            is the a way to simulate a power failure on the master to test the slave without actually cutting power to the master?

                            any of you guys can help me with the correct config for upssched and upsmon? Do i need the heartbeat for what i want to do?

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

                              @gwaitsi said in NUT package:

                              is the a way to simulate a power failure on the master to test the slave without actually cutting power to the master?

                              Look for FSD in the NUT documentation.

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

                                @gwaitsi said in NUT package:

                                I have a dumb UPS connected to pfsense and need to shutdown pfsense based on a timer triggered by the master due to the non-shared UPS.
                                ...
                                i simply want to shutdown the slave 20min after power loss, but obviously cancel the timer if the power comes back.

                                A dumb UPS isn't something supported by the NUT pfSense package. In general dumb USPs are not a good idea because there is nothing that will trigger the restart of the system when power returns.

                                4 2 Replies Last reply Reply Quote 0
                                • 4
                                  4o4rh @dennypage
                                  last edited by

                                  @dennypage an ideological argument over why it is not a good idea doesn't help solve the problem. My NAS box is 3 floors above my pfsense box (which is in the basement where there is no room for a full UPS). The dumb UPS i have, can simply replace the existing power adapter and on the PTZ i tested with, works for above 24hrs. I expect it will provide about 2-3hrs with the pfsense box, so I want to shutdown the box after about 50% capacity.

                                  The last time i had a power failure a few weeks ago, i lost my system drive on pfsense and spent the entire weekend trying to recover and get the system back to its previous state. So while it may not be ideal to go and have to manually restart in a worse case scenario, it is better than having to rebuild the system. This year we've had about 4-5 utility outages lasting up to an hour. So in all cases this year, the device would have restore power before needing to shutdown. (although, having said that. the APC UPS only lasts about an hour before shutdown - so there may have been 1 or 2 shutdowns due to the master shutting down).

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

                                    @gwaitsi said in NUT package:

                                    @dennypage an ideological argument over why it is not a good idea doesn't help solve the problem.

                                    No, it won't. But then again, there isn't anything in the pfSense NUT package that will help you solve the problem as defined.

                                    Operating within the constraints you have defined, I would just use an ssh script run from your NAS box to perform the shutdown.

                                    1 Reply Last reply Reply Quote 0
                                    • ?
                                      A Former User
                                      last edited by A Former User

                                      Over the weekend I restarted my old QNAP NAS. That left me to solve the problem of one Synology NAS and one QNAP NAS that I wanted to have run as UPS slaves to NUT on pfsense.

                                      Spent a minute looking at changing the default UPS name on both and quickly decided that wasn't going to be worth the effort.

                                      Set up a "dummy-ups" in NUT thinking that would work. That didn't work the way I thought it would, adding the lines to 'additional configuration line to ups.conf'. For some reason that prepends the additional lines not append. Bad.

                                      So, I then added the lines to 'extra arguments to driver' which appended the lines to ups.conf and that resulted in the ups.conf I wanted.

                                      You want this in the right place, after your real UPS:

                                      [qnapups]
                                      driver = dummy-ups
                                      port = ups@127.0.0.1
                                      desc = "dummy-ups in repeater mode"

                                      I now have a real UPS named ups and a replicate UPS named qnapups. I DO have additional lines to override low battery that come BEFORE the repeater configuration. If you want to do this in the GUI best to have a shell open and see what is going on in the config files in /usr/local/etc/nut.

                                      My ups.conf looks like this:

                                      [ups]
                                      driver=usbhid-ups
                                      port=auto
                                      ignorelb
                                      override.battery.charge.low = 30
                                      [qnapups]
                                      driver = dummy-ups
                                      port = ups@127.0.0.1
                                      desc = "dummy-ups in repeater mode"

                                      As best I understand (please correct me if I'm wrong) the NUT package is all but unmaintained at this point. I wonder if the best way to get things working is to install the package, stay out of the GUI and configure things by hand in the various config files.

                                      GertjanG dennypageD 2 Replies Last reply Reply Quote 0
                                      • GertjanG
                                        Gertjan @A Former User
                                        last edited by

                                        @jwj said in NUT package:

                                        That left me to solve the problem of one Synology NAS

                                        Like :

                                        c2fac968-9f62-46a7-af4d-a606754cf57f-image.png

                                        To have the Syno NAS connect to the NUT on pfSEnse as a salve :
                                        Set the IP to the IP of pfSense in which the NUT package is running.
                                        Define on pfSense the IP it has to expose it's NUT interface on :

                                        24e74987-6e38-48fd-849e-ef818f505bc2-image.png

                                        and of course tell it what user / slave could 'login".
                                        This user and password are somewhat hard coded into the NUT core files of the Syno (if I recall that correctly).

                                        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
                                        • ?
                                          A Former User @Gertjan
                                          last edited by

                                          @Gertjan Yes. Required to get things working with a Synology NAS. I had a quick look at the Marketing blurb concerning DSM 7 beta. Supposedly more control over UPS configuration. We'll see. All this hard coded stuff is a pain in the butt!

                                          Good post!

                                          1 Reply Last reply Reply Quote 0
                                          • ?
                                            A Former User
                                            last edited by A Former User

                                            For completeness I'll put my complete config.

                                            The situation is: one Synology NAS (1618+) one QNAP NAS (TS-451) both as slaves. pfsense/NUT as the master. APC Smart-UPS C 1000 usb to pfsense host.

                                            In /usr/local/etc/nut

                                            ups.conf:

                                            [ups]
                                            driver=usbhid-ups
                                            port=auto
                                            ignorelb
                                            override.battery.charge.low = 30
                                            [qnapups]
                                            driver = dummy-ups
                                            port = ups@127.0.0.1
                                            desc = "dummy-ups in repeater mode"

                                            upsd.conf:

                                            LISTEN 127.0.0.1
                                            LISTEN ::1

                                            LISTEN 192.168.40.1

                                            (Maybe I should have the IPv6 address for the VLAN the NAS are in, not sure it matters and things work fine without it.)

                                            upsd.users:

                                            [admin]
                                            password=db8075bb45efab9ee80a
                                            actions=set
                                            instcmds=all
                                            [local-monitor]
                                            password=997fae5f5b0fc09becb3
                                            upsmon master

                                            [monuser]
                                            password = secret
                                            upsmon slave

                                            upsmon.conf

                                            MONITOR ups 1 local-monitor 997fae5f5b0fc09becb3 master
                                            SHUTDOWNCMD "/sbin/shutdown -p +0"
                                            POWERDOWNFLAG /etc/killpower

                                            upssched.conf:

                                            CMDSCRIPT /usr/local/bin/upssched-cmd
                                            (And a bunch of comments, Nothing to see here)

                                            For sure there are improvements that could be made, more control over the UPS shutdown and startup when going to a low battery condition and when power returns. I'd vey much like to hear from those that know more about this :)

                                            I do suggest getting used to looking at this from the real configuration files and not just staring at the GUI. Just saying...

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