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

    NUT Dashboard Widget (2.1.4)

    Scheduled Pinned Locked Moved webGUI
    40 Posts 12 Posters 10.6k 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
      SunStroke
      last edited by

      NUT Dashboard Widget (2.2.4)

      Hi, all.
      New version of my previous UPS widget. Now, no need to patch system files (runs as standalone widget).
      Tested only on pfSense 2.2.4. You can apply patches from:

      UPS widget (main file): https://github.com/pfsense/pfsense/commit/d7ecd47fe1b080dfa85c6e22d96ce5e6fef86195.patch
      UPS widget ('inc' file): https://github.com/pfsense/pfsense/commit/cbad7005fb804cd1065c97966550d2270c2eee76.patch
      UPS widget ('js' file - ajax): https://github.com/pfsense/pfsense/commit/2816375af13a08d16375f4ca3603ac3f1edcfe6b.patch

      Testing and comments are wellcome.

      WARNING! Patches are points wrong by default to "/src/usr/…" path (testing - "Patching file src/usr/local/www/widgets/widgets/ups_status.widget.php" and so on). I think this is because of github pfsense repository structure. Who know how to change this in patch automaticaly (to "/usr/..."), tell me. For workaround: create patch, fetch its contents, edit and remove "URL/Commit ID" and then remove from contents "src/" substring. Then apply patch.

      In system will be created files:
      /usr/local/www/widgets/widgets/ups_status.widget.php
      /usr/local/www/widgets/include/ups_status.inc
      /usr/local/www/widgets/javascript/ups_status.js
      You can safely delete "*.orig" version of this files (zero-length file).

      1 Reply Last reply Reply Quote 0
      • arrmoA
        arrmo
        last edited by

        Thanks!

        Do the old patches need to be reverted, or rather just remove them and reboot -> then install the new ones?

        Thanks again.

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

          @arrmo:

          Thanks!

          Do the old patches need to be reverted, or rather just remove them and reboot -> then install the new ones?

          Thanks again.

          Old patches needs to be reverted. But "system patches" package not allways can revert patch automaticaly. Therefore manual intervention can be needed.

          1 Reply Last reply Reply Quote 0
          • arrmoA
            arrmo
            last edited by

            Makes sense - thanks again for the awesome widget!

            1 Reply Last reply Reply Quote 0
            • arrmoA
              arrmo
              last edited by

              Removed the old patches, installed the new ones -> not working for me now … :(.

              Have others tried this out?

              Thanks.

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

                @arrmo:

                Removed the old patches, installed the new ones -> not working for me now … :(.

                Have others tried this out?

                Thanks.

                Read my "warning" notes from initial post (#26) about wrong path in patches and how to workaround this. For me this workaround works.

                1 Reply Last reply Reply Quote 0
                • arrmoA
                  arrmo
                  last edited by

                  Sorry, missed the note … :(. Yep, works now - though I have 2 UPS Status widgets available afterwards.

                  Thanks.

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

                    @arrmo:

                    Sorry, missed the note … :(. Yep, works now - though I have 2 UPS Status widgets available afterwards.

                    If you see two versions of widget - old and new, it mean that old version was not removed by reverting and removing old patches. And you need manualy remove it.

                    Old widget parts is (see patch contents):
                    /usr/local/www/widgets/widgets/ups.widget.php
                    /usr/local/www/widgets/include/ups.inc
                    $stats['nut'] = get_nutstats(true);  +  function get_nutstats()  -  in /usr/local/www/includes/functions.inc.php
                    updateNutStats(values[14]);  +  function updateNutStats(x)  -  in /usr/local/www/javascript/index/ajax.js

                    1 Reply Last reply Reply Quote 0
                    • arrmoA
                      arrmo
                      last edited by

                      Nope - none of these items are there. But not a biggie. Thanks!

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

                        Widget was merged to NUT package!

                        If you have installed old or new version of widget, remove it:

                        1. Revert and remove patches.

                        2. Verify to remove widget parts if it`s not removed by patches:

                        a) old version, remove:
                                /usr/local/www/widgets/widgets/ups.widget.php  (and ups.widget.php.orig if exist)
                                /usr/local/www/widgets/include/ups.inc  (and ups.inc.orig if exist)
                                $stats['nut'] = get_nutstats(true);  +  function get_nutstats()  -  in /usr/local/www/includes/functions.inc.php  (backup and remove functions.inc.php.orig if exist - important system file)
                                updateNutStats(values[14]);  +  function updateNutStats(x)  -  in /usr/local/www/javascript/index/ajax.js  (backup and remove ajax.js.orig if exist - important system file)

                        b) new version, remove:
                                /usr/local/www/widgets/widgets/ups_status.widget.php  (and ups_status.widget.php.orig if exist)
                                /usr/local/www/widgets/include/ups_status.inc  (and ups_status.widget.php.orig if exist)
                                /usr/local/www/widgets/javascript/ups_status.js  (and ups_status.js.orig if exist)

                        3. After that you can update your nut package and add "UPS Status" widget to dashboard.

                        1 Reply Last reply Reply Quote 0
                        • D
                          doktornotor Banned
                          last edited by

                          Works pretty well, finally can drop the local patches.  8)

                          1 Reply Last reply Reply Quote 0
                          • arrmoA
                            arrmo
                            last edited by

                            Works great - thanks!!!

                            1 Reply Last reply Reply Quote 0
                            • C
                              Carverman
                              last edited by

                              Nice work!  I have been waiting for this to arrive since moving to PFSense a couple of months ago…...grin

                              1 Reply Last reply Reply Quote 0
                              • Q
                                q54e3w
                                last edited by

                                good job, very useful, thank you.

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