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.
    • R
      r00f
      last edited by

      @SunStroke:

      No, my commits was not merged till now. You can install "System Patches" package and try to apply my patches individually. I done it for myself.

      NUT widget (add main file) - http://github.com/pfsense/pfsense/commit/d9fcbc2048041285690cc28159753acdb0bbb7a3.patch
      NUT widget (add 'inc' file) - http://github.com/pfsense/pfsense/commit/4dda40b25ee72d899add9fb18e41310dfcc53a17.patch
      NUT widget ajax callback - http://github.com/pfsense/pfsense/commit/5c5e2a846b4c98cb67fe7828ddb131054d71a644.patch
      NUT widget update func. - http://github.com/pfsense/pfsense/commit/225ea5746d83b6e79b96904e3f3dfb7c7b7defd4.patch

      When patching will be done, you need to remove "/usr/local/www/javascript/index/ajax.js.orig". Cos "/usr/local/www/index.php" load all scripts from "/usr/local/www/javascript/index/" directory and updates are not working.

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

        Sorry, perhaps a dumb question, but … is the only way to install (add 4 patches)?

        Just trying to understand - this looks very good!

        Thanks.

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

          @arrmo:

          Sorry, perhaps a dumb question, but … is the only way to install (add 4 patches)?

          Just trying to understand - this looks very good!

          Thanks.

          Yes. At this moment add 4 pathes is the only way to install widget. If anyone (maybe i) restructures code to make standalone package, it will be included in main package repository.

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

            Works well, thanks! Just a couple minor comments,

            • it would be good to have the title "UPS Status" to link to the appropriate page (like other widgets do)
            • my UPS shows up fine, all works … but Status shows as "ERROR"?

            Thanks again!

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

              @arrmo:

              Works well, thanks! Just a couple minor comments,

              • it would be good to have the title "UPS Status" to link to the appropriate page (like other widgets do)
              • my UPS shows up fine, all works … but Status shows as "ERROR"?

              Thanks again!

              • about link - it is already done in my repository, patch links slightly outdated
              • about "ERROR" - what error description is in "Model" column (screenshot, maybe?)?
              1 Reply Last reply Reply Quote 0
              • arrmoA
                arrmo
                last edited by

                Sounds good on the link, thanks!

                As for model / details, here you go (copy / paste, sorry) …

                Monitoring Model Status
                Local UPS UPS CP600 On Line
                Battery Charge Time Remain Battery Voltage
                left barred bargray barright bar
                100% 0h 52m 0s 13.3 V
                Load Input Voltage Output Voltage
                left barred bargray barright bar
                20% 121.0 V 121.0 V
                Monitoring Model Status
                Local UPS OL ERROR

                Thanks again - this is great!

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

                  @arrmo:

                  …..
                  Monitoring Model Status
                  Local UPS UPS CP600 On Line
                  Battery Charge Time Remain Battery Voltage
                  left barred bargray barright bar
                  100% 0h 52m 0s 13.3 V
                  Load Input Voltage Output Voltage
                  left barred bargray barright bar
                  20% 121.0 V 121.0 V
                  Monitoring Model Status
                  Local UPS OL ERROR

                  If being seen this also.

                  But then I discovered something strange with
                  /usr/local/www/widgets/widgets/ups.widget.php
                  It contained twice all the instructions !!
                  It start with

                  /*
                  	$Id$
                  	Copyright 2008 Seth Mos
                  	Part of pfSense widgets (www.pfsense.com)
                  ....
                  
                  

                  If you find the same sequence half way the file, you have everything doubled … and the widget tries to show something that doesn't exists.

                  I removed this second part - and the error disappeared.

                  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
                  • arrmoA
                    arrmo
                    last edited by

                    Yep, that fixes it - thanks!

                    Sounds like some feedback for the person generating the patches - minor mod needed.

                    Awesome!

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

                      The patches are just fine. You applied the same patch twice.

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

                        Hmmm … I did test and then apply, but I could have double clicked. That is possible, won't say it's not ... :).

                        But a patch should fail if applied twice, no?

                        Thanks!

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

                          @arrmo:

                          But a patch should fail if applied twice, no?

                          Hmmm, no, not with a patch on non-existent file.

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

                            Agreed! I guess the patch is just "adding" - makes sense.

                            Thanks!

                            1 Reply Last reply Reply Quote 0
                            • 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
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.