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

    NUT dashboard widget

    Scheduled Pinned Locked Moved UPS Tools
    43 Posts 5 Posters 5.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic was forked from QNAP recognizing NUT dennypage
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      FrankZappa @dennypage
      last edited by

      @dennypage Wow! Didn't expect it that fast. Love it! Is there any way to display when and why UPS went to battery last time?

      Thanks for making this.

      F dennypageD 2 Replies Last reply Reply Quote 0
      • F
        FrankZappa @FrankZappa
        last edited by

        @FrankZappa Also, I really like the colors to make it pop in the dashboard. If the battery is not charged to 100% does the bar graph change to yellow, and maybe once it gets down to 50% can it turn red? Just thought it would look cool (not that I want my battery to ever get down to 50%). Thanks

        F 1 Reply Last reply Reply Quote 0
        • F
          FrankZappa @FrankZappa
          last edited by

          @FrankZappa Mine is showing the wrong battery date and I don't have the last test. Other than that, it looks great.
          3f5f1d26-ee48-4a60-ba8a-dfc70be37953-image.png

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

            @FrankZappa said in NUT dashboard widget:

            Wow! Didn't expect it that fast. Love it!

            Glad you like it. I had some time...

            @FrankZappa said in NUT dashboard widget:

            Is there any way to display when and why UPS went to battery last time?

            I don't believe this is reported. I have a fairly high end APC, and I don't have it. Best alternative is enabling notifications and then you'll get a real-time notification of transfers.

            @FrankZappa said in NUT dashboard widget:

            I really like the colors to make it pop in the dashboard. If the battery is not charged to 100% does the bar graph change to yellow, and maybe once it gets down to 50% can it turn red?

            The battery bar is red below 50%, yellow below 75%, otherwise green. Same for the summary icon, which shows plug, battery (with levels), and unknown. Even if the UPS is on line, if the UPS reports that the battery needs replacing, or if the UPS is overloaded, the plug icon will remain red.

            The load bar is green below 95%, yellow below 99%, and red above.

            @FrankZappa said in NUT dashboard widget:

            Mine is showing the wrong battery date and I don't have the last test.

            The 2001/09/25 date kinda looks like a "never been set" value. Look for "battery.date" in Services / UPS / UPS Status. This is what is reported to/by NUT. What do you see there?

            For test info, look for "ups.test.date" and/or "ups.test.result" in Services / UPS /UPS Status. Are these being reported by the UPS to NUT?

            F T 2 Replies Last reply Reply Quote 0
            • F
              FrankZappa @dennypage
              last edited by

              @dennypage Thanks dennypage. Here's a screenshot of everything I have.
              7074717a-e238-4700-b97b-7799530905d3-image.png

              dennypageD 2 Replies Last reply Reply Quote 0
              • T
                tgl
                last edited by

                I'm not sure what "battery.date" is really meant to be, but it reads as 2001/09/25 on my APC UPSes too. Maybe it identifies the age of the design? Anyway, these fields seem considerably more plausible as the real age of the one I'm looking at:

                battery.mfr.date: 2022/04/13
                ups.mfr.date: 2022/04/13

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

                  @dennypage said in NUT dashboard widget:

                  For test info, look for "ups.test.date" and/or "ups.test.result" in Services / UPS /UPS Status. Are these being reported by the UPS to NUT?

                  A field like "ups.test.date" could only get populated accurately if the UPS contains an RTC. I've owned a lot of UPSes over the years, and never seen any indication that they have settable clocks. The date fields they do output all look like burned-in-at-the-factory values.

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

                    @FrankZappa So, your battery date really does show as 2001/09/25. I believe this means that it was not set at the factory. Looks like the apcupsd widget was reporting the UPS manufacture date rather than the battery install date.

                    To set the battery date, you can (hopefully) use upsrw.

                    Use

                    upsrw -l UPSNAME
                    

                    to see what variables you can write in the UPS. The variable you are looking for is "battery.date".

                    Your "ups.test.result" shows that no self test has been run on the UPS. For higher end APC UPSs, this is done by automatic timer. For lower end UPSs, you have to trigger it manually. If you do that, you will have to write the test date yourself--look for variable "ups.test.date" in the upsrw output.

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

                      @tgl said in NUT dashboard widget:

                      I'm not sure what "battery.date" is really meant to be, but it reads as 2001/09/25 on my APC UPSes too.

                      See note above. It just means that it wasn't set at factory or at the point of initial install (which requires a UPS that has time capability).

                      If the UPS doesn't have time capability, then you are responsible for maintaining this field by hand when you initially install and/or change batteries.

                      If your UPS has a network management card, this would be handled automatically. My current APC is like this.

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

                        @FrankZappa Forgot to mention. To run a self-test, would use upscmd. To see a list of commands the UPS will accept, use:

                        upscmd -l UPSNAME
                        

                        Most likely, the command will be:

                        upscmd UPSNAME test.battery.start
                        
                        1 Reply Last reply Reply Quote 0
                        • T
                          tgl @dennypage
                          last edited by

                          @dennypage said in NUT dashboard widget:

                          See note above. It just means that it wasn't set at factory or at the point of initial install (which requires a UPS that has time capability).

                          On mine, it's not settable period. "upsrw -l" claims to be able to set "battery.mfr.date", but not any other kind of date.

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

                            @tgl What brand/model?

                            FWIW, "ups.mfr.date" is a standard field, but I don't recall ever seeing "battery.mfr.date"

                            T 1 Reply Last reply Reply Quote 0
                            • T
                              tgl @dennypage
                              last edited by

                              @dennypage
                              APC Back-UPS Pro BR1500MS2

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

                                @tgl Please post Services / UPS / Status.

                                T 1 Reply Last reply Reply Quote 0
                                • T
                                  tgl @dennypage
                                  last edited by

                                  @dennypage said in NUT dashboard widget:

                                  @tgl Please post Services / UPS / Status.

                                  I don't actually have NUT installed on my router (yet); this UPS is connected to a Linux server. "upsc" reports what I suppose you want:

                                  battery.charge: 100
                                  battery.charge.low: 10
                                  battery.charge.warning: 50
                                  battery.date: 2001/09/25
                                  battery.mfr.date: 2022/04/13
                                  battery.runtime: 4152
                                  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 1500MS2
                                  device.serial: 0B2216N04901  
                                  device.type: ups
                                  driver.name: usbhid-ups
                                  driver.parameter.offdelay: 50
                                  driver.parameter.ondelay: 60
                                  driver.parameter.pollfreq: 100
                                  driver.parameter.pollinterval: 10
                                  driver.parameter.port: auto
                                  driver.parameter.synchronous: auto
                                  driver.version: 2.8.0
                                  driver.version.data: APC HID 0.98
                                  driver.version.internal: 0.47
                                  driver.version.usb: libusb-1.0.23 (API: 0x1000107)
                                  input.sensitivity: medium
                                  input.transfer.high: 147
                                  input.transfer.low: 88
                                  input.voltage: 124.0
                                  input.voltage.nominal: 120
                                  ups.beeper.status: disabled
                                  ups.delay.shutdown: 50
                                  ups.firmware: 969.e2 .D
                                  ups.firmware.aux: e2     
                                  ups.load: 10
                                  ups.mfr: American Power Conversion
                                  ups.mfr.date: 2022/04/13
                                  ups.model: Back-UPS RS 1500MS2
                                  ups.productid: 0002
                                  ups.realpower.nominal: 900
                                  ups.serial: 0B2216N04901  
                                  ups.status: OL
                                  ups.test.result: No test initiated
                                  ups.timer.reboot: 0
                                  ups.timer.shutdown: -1
                                  ups.vendorid: 051d
                                  
                                  dennypageD 1 Reply Last reply Reply Quote 0
                                  • dennypageD
                                    dennypage @tgl
                                    last edited by

                                    @tgl two quick questions:

                                    • Output of upsrw -l
                                    • Version of NUT
                                    T 1 Reply Last reply Reply Quote 0
                                    • T
                                      tgl @dennypage
                                      last edited by

                                      @dennypage

                                      Sure:

                                      $ upsrw -l xxx_ups
                                      [battery.charge.low]
                                      Remaining battery level when UPS switches to LB (percent)
                                      Type: STRING
                                      Maximum length: 10
                                      Value: 10
                                      
                                      [battery.mfr.date]
                                      Battery manufacturing date
                                      Type: STRING
                                      Maximum length: 10
                                      Value: 2022/04/13
                                      
                                      [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: 147
                                      
                                      [input.transfer.low]
                                      Low voltage transfer point (V)
                                      Type: STRING
                                      Maximum length: 10
                                      Value: 88
                                      
                                      [ups.delay.shutdown]
                                      Interval to wait after shutdown with delay command (seconds)
                                      Type: STRING
                                      Maximum length: 10
                                      Value: 50
                                      
                                      

                                      The Linux machine is running RHEL8, and its relevant packages are

                                      $ rpm -qa | grep ^nut
                                      nut-2.8.0-3.el8.x86_64
                                      nut-client-2.8.0-3.el8.x86_64
                                      $ rpm -qa | grep ^libusb
                                      libusb-0.1.5-12.el8.x86_64
                                      libusbx-devel-1.0.23-4.el8.x86_64
                                      libusbx-1.0.23-4.el8.x86_64
                                      libusb-devel-0.1.5-12.el8.x86_64
                                      libusbmuxd-1.0.10-9.el8.x86_64
                                      
                                      dennypageD 1 Reply Last reply Reply Quote 0
                                      • F
                                        FrankZappa @dennypage
                                        last edited by

                                        @dennypage Hmmmm, tried to change the battery date but was asked for a password. Huh?

                                        e3cb8abd-d85c-4a7b-8c65-3f741fd71856-image.png

                                        GertjanG dennypageD 2 Replies Last reply Reply Quote 0
                                        • GertjanG
                                          Gertjan @FrankZappa
                                          last edited by

                                          @FrankZappa

                                          Use the real command line, console or SSH for this - option 8.

                                          Start with :

                                          cat /usr/local/etc/nut/upsd.users
                                          

                                          and if all goes well, you see the 'user 'admin, and the password to use.

                                          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 @FrankZappa
                                            last edited by

                                            @FrankZappa said in NUT dashboard widget:

                                            Hmmmm, tried to change the battery date but was asked for a password. Huh?

                                            Yes, writing requires an authorized NUT user. The actual command you will want is:

                                            upsrw -s battery.date=2024/05/20 -u admin -p PASSWORD QNAPUPS
                                            

                                            The admin password is automatically generated when you save the NUT configuration. As @Gertjan notes, you can find the current password in /usr/local/etc/nut/upsd.users.

                                            Btw, be sure the date is in the same locale format as upsc outputs.

                                            It's easiest to do this all in an ssh session.

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