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

NUT dashboard widget

Scheduled Pinned Locked Moved UPS Tools
43 Posts 5 Posters 4.3k 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 May 17, 2024, 8:13 PM
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    tgl @dennypage
    last edited by May 20, 2024, 2:46 AM

    @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
    
    D 1 Reply Last reply May 20, 2024, 3:35 PM Reply Quote 0
    • F
      FrankZappa @dennypage
      last edited by May 20, 2024, 10:07 AM

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

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

      G D 2 Replies Last reply May 20, 2024, 10:30 AM Reply Quote 0
      • G
        Gertjan @FrankZappa
        last edited by May 20, 2024, 10:30 AM

        @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
        • D
          dennypage @FrankZappa
          last edited by May 20, 2024, 2:47 PM

          @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 May 20, 2024, 11:16 PM Reply Quote 0
          • D
            dennypage @tgl
            last edited by dennypage May 20, 2024, 3:40 PM May 20, 2024, 3:35 PM

            @tgl said in NUT dashboard widget:

            [battery.mfr.date]
            Battery manufacturing date
            Type: STRING
            Maximum length: 10
            Value: 2022/04/13

            This looks like a bug in the usbhid-ups driver. The UPS variable being mapped to battery.mfr.date should have been mapped to battery.date. There appear to be other bugs: on my main (new generation) APC, most of the dates and voltages disappear when switching to the USB interface (vs the SNMP interface). I'll dig into this when I have time.

            Btw, if interested you can find a list of all possible variables here. Variable "battery.date" is defined as "Battery installation or last change date." Variable "battery.mfr.date" is defined as "Battery manufacturing date", and was read-only prior to NUT 8.0.

            1 Reply Last reply Reply Quote 0
            • F
              FrankZappa @dennypage
              last edited by May 20, 2024, 11:16 PM

              @dennypage said in NUT dashboard widget:

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

              I tried it with the password and i get the following error "Unexpected response from upsd: ERR READONLY"

              F 1 Reply Last reply May 20, 2024, 11:21 PM Reply Quote 0
              • F
                FrankZappa @FrankZappa
                last edited by May 20, 2024, 11:21 PM

                @FrankZappa Also noticed there are two entries in the NUT Services/UPS/Status
                battery.date 2001/09/25
                battery.mfr.date 2021/04/10

                The battery.mfr.date is correct. Thats when I bought the APC.
                However, the battery.date (and install date on widget) is waaaaaaay off. Can the widget reflect the battery.mfr.date?

                D 1 Reply Last reply May 21, 2024, 7:24 AM Reply Quote 0
                • D
                  dennypage @FrankZappa
                  last edited by May 21, 2024, 7:24 AM

                  @FrankZappa said in NUT dashboard widget:

                  battery.date 2001/09/25
                  battery.mfr.date 2021/04/10

                  The battery.mfr.date is correct. Thats when I bought the APC.
                  However, the battery.date (and install date on widget) is waaaaaaay off. Can the widget reflect the battery.mfr.date?

                  I've researched a bit, and it appears that the battery date situation with USB UPSs is a bit messed up. In addition to issues like battery.date vs battery.mfr.date you and @tgl encountered with APC, the CyberPower issues appear even worse.

                  Truth be told, it probably isn't all NUT's fault as it looks like the manufacturers don't seem to completely agree how the dates should map with USB ids.

                  I think for the time being I'm going to pull the battery install date out of the status widget, at least for USB UPSs. I think as things currently are it would end up causing too much confusion with folks. I'll revisit it in the future.

                  T 1 Reply Last reply May 21, 2024, 10:02 PM Reply Quote 0
                  • T
                    tgl @dennypage
                    last edited by May 21, 2024, 10:02 PM

                    @dennypage said in NUT dashboard widget:

                    I think for the time being I'm going to pull the battery install date out of the status widget, at least for USB UPSs. I think as things currently are it would end up causing too much confusion with folks. I'll revisit it in the future.

                    Maybe, if the UPS reports both battery.date and battery.mfr.date, you could show the later one?

                    F D 2 Replies Last reply May 21, 2024, 10:07 PM Reply Quote 0
                    • F
                      FrankZappa @tgl
                      last edited by May 21, 2024, 10:07 PM

                      @tgl I was thinking the same thing, but didn't want to bug Dennypage anymore. Of course, if Dennypage is bored........well?

                      1 Reply Last reply Reply Quote 0
                      • D
                        dennypage @tgl
                        last edited by May 21, 2024, 10:51 PM

                        @tgl said in NUT dashboard widget:

                        Maybe, if the UPS reports both battery.date and battery.mfr.date, you could show the later one?

                        Unfortunately, that would be locale specific, which is a real pain for date comparison. I'd rather work on fixing some of the issues with NUT itself.

                        T 1 Reply Last reply May 21, 2024, 10:59 PM Reply Quote 0
                        • T
                          tgl @dennypage
                          last edited by May 21, 2024, 10:59 PM

                          @dennypage said in NUT dashboard widget:

                          Unfortunately, that would be locale specific, which is a real pain for date comparison.

                          Would it? I'm no expert, but I had the impression that these specific date strings are expected to always have the format yyyy/mm/dd. I agree that it'd be a mess if they don't.

                          I'd rather work on fixing some of the issues with NUT itself.

                          Fair, although from what you said upthread it's not clear that that'll yield a solution to this problem.

                          D 1 Reply Last reply May 21, 2024, 11:21 PM Reply Quote 0
                          • D
                            dennypage @tgl
                            last edited by May 21, 2024, 11:21 PM

                            @tgl said in NUT dashboard widget:

                            @dennypage said in NUT dashboard widget:

                            Unfortunately, that would be locale specific, which is a real pain for date comparison.

                            Would it? I'm no expert, but I had the impression that these specific date strings are expected to always have the format yyyy/mm/dd. I agree that it'd be a mess if they don't.

                            Yes, the dates are presented in locale specific format. 2024/05/10, 2024/10/05, 05/10/2024, 10/05/2024. My date format is happens to be mm/dd/yyyy (see sample pic above), which I hate. If I had my druthers, all dates would all be in iso format (2025-05-10), but it’s outside of my control.

                            I'd rather work on fixing some of the issues with NUT itself.

                            Fair, although from what you said upthread it's not clear that that'll yield a solution to this problem.

                            I’ve reasonable success working PRs/issues with NUT. Changes need to happen there, because there is no way that the vendors are gonna change anything. 😬

                            F 1 Reply Last reply Jun 2, 2024, 11:09 AM Reply Quote 0
                            • F
                              FrankZappa @dennypage
                              last edited by Jun 2, 2024, 11:09 AM

                              @dennypage Hi Denny Page,
                              just curious: Why can't we (you) grab some of the scripting from APCUPSD and add it to the NUT script to produce things like "age of battery" and "power events"? I was able to edit my NUT script to produce the battery install date and changed the text of Vin to Voltage In (see image), but that is the limit of my ability to edit scripts. I'm diving into areas of editing the script that I have zero knowledge of. The APCUPSD was able to calculate the age of the battery, which would be cool to see. Lastly, where in the NUT script does it reach out to get the icon of the green plug you added? Can we have it reference another plug icon? Thanks.

                              e74c5c82-2535-45a1-8300-ec500c0d3397-image.png

                              F D 2 Replies Last reply Jun 2, 2024, 11:12 AM Reply Quote 0
                              • F
                                FrankZappa @FrankZappa
                                last edited by Jun 2, 2024, 11:12 AM

                                @FrankZappa Just for reference, here is the APCUPSD output screen:

                                3b8c48ed-9880-443d-91b9-67231db3e932-image.png

                                1 Reply Last reply Reply Quote 0
                                • D
                                  dennypage @FrankZappa
                                  last edited by Jun 2, 2024, 4:50 PM

                                  @FrankZappa said in NUT dashboard widget:

                                  @dennypage Hi Denny Page,
                                  just curious: Why can't we (you) grab some of the scripting from APCUPSD and add it to the NUT script to produce things like "age of battery" and "power events"? I was able to edit my NUT script to produce the battery install date and changed the text of Vin to Voltage In (see image), but that is the limit of my ability to edit scripts. I'm diving into areas of editing the script that I have zero knowledge of. The APCUPSD was able to calculate the age of the battery, which would be cool to see. Lastly, where in the NUT script does it reach out to get the icon of the green plug you added? Can we have it reference another plug icon? Thanks.

                                  Apcupsd outputs things in a different format than NUT, with different guarantees on the data. They are not interchangeable.

                                  Regarding battery age, the crux of the matter is that battery.date and battery.mfr.date in NUT have specific meaning. They are not the same thing. A lot of USB subdrivers have bugs in how they handle the mapping, and I’d rather spend my time working toward fixing issues in NUT than trying to paste over them in the status widget.

                                  As to Vin (and Vout) those were chosen because 1) they are standard notation for voltages, and 2) they fit comfortably in the widget regardless of current widget display width.

                                  No, you cannot change the plug icon. I believe that it is the only solid icon in the set pfSense uses. FWIW, it’s the same icon as used in the apcupsd widget.

                                  F 1 Reply Last reply Jun 2, 2024, 8:20 PM Reply Quote 0
                                  • F
                                    FrankZappa @dennypage
                                    last edited by Jun 2, 2024, 8:20 PM

                                    @dennypage Thanks for checking. I appreciate all the support you have given. Look forward to the new and improved NUT.

                                    1 Reply Last reply Reply Quote 1
                                    • First post
                                      Last post
                                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                                      This community forum collects and processes your personal information.
                                      consent.not_received