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

    NUT notifications not working on pfsense+

    Scheduled Pinned Locked Moved General pfSense Questions
    50 Posts 5 Posters 19.5k 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 @Austin 0
      last edited by

      @austin-0 said in NUT notifications not working on pfsense+:

      I unplugged the USB cable and still there was no notification sent. I did verify that the UPS status in nut changed. It just did not send a notification.

      This is puzzling.

      Were you logged in on the console (ssh) when you disconnected the USB cable? Was there a notice there?

      Austin 0A 1 Reply Last reply Reply Quote 0
      • Austin 0A
        Austin 0 @dennypage
        last edited by

        @dennypage I just tested it, and yes it does give a notification in the ssh connection.

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

          @austin-0 said in NUT notifications not working on pfsense+:

          I just tested it, and yes it does give a notification in the ssh connection.

          That's good--it means NUT itself is working.

          Still very puzzling. I'd like to verify the contents of the pfSense NUT package. Can you please execute the following:

          ls -l `pkg info --list-files pfSense-pkg-nut`
          

          and

          sha1sum `pkg info --list-files pfSense-pkg-nut`
          

          [don't worry about the no such file or directory error for pfSense-pkg-nut-2.8.0_2]

          Austin 0A 1 Reply Last reply Reply Quote 0
          • Austin 0A
            Austin 0 @dennypage
            last edited by

            @dennypage

            ls: pfSense-pkg-nut-2.8.0_2:: No such file or directory
            -rw-r--r--  1 root  wheel   1225 Feb 17 10:43 /etc/inc/priv/nut.priv.inc
            -rw-r--r--  1 root  wheel   1692 Feb 17 10:43 /usr/local/pkg/nut.xml
            -rwxr-xr-x  1 root  wheel   1007 Feb 17 10:43 /usr/local/pkg/nut/nut_email.php
            -rw-r--r--  1 root  wheel  12255 Feb 17 10:43 /usr/local/pkg/nut/nut.inc
            -rw-r--r--  1 root  wheel  10173 Feb 17 10:43 /usr/local/share/licenses/pfSense-pkg-nut-2.8.0_2/APACHE20
            -rw-r--r--  1 root  wheel    164 Feb 17 10:43 /usr/local/share/licenses/pfSense-pkg-nut-2.8.0_2/catalog.mk
            -rw-r--r--  1 root  wheel     66 Feb 17 10:43 /usr/local/share/licenses/pfSense-pkg-nut-2.8.0_2/LICENSE
            -rw-r--r--  1 root  wheel    357 Feb 17 10:43 /usr/local/share/pfSense-pkg-nut/info.xml
            -rw-r--r--  1 root  wheel  22284 Feb 17 10:43 /usr/local/www/nut_settings.php
            -rw-r--r--  1 root  wheel   4720 Feb 17 10:43 /usr/local/www/nut_status.php
            -rw-r--r--  1 root  wheel    193 Feb 17 10:43 /usr/local/www/shortcuts/pkg_nut.inc
            -rw-r--r--  1 root  wheel     96 Feb 17 10:43 /usr/local/www/widgets/include/nut_status.inc
            -rw-r--r--  1 root  wheel   3152 Feb 17 10:43 /usr/local/www/widgets/widgets/nut_status.widget.php
            
            sha1sum: pfSense-pkg-nut-2.8.0_2:: No such file or directory
            8c24e4933087b1174c821e66f940d0318a6e9b7e  /etc/inc/priv/nut.priv.inc
            fe967ea9e93cd309d4b74a61e469bef85e4c4da9  /usr/local/pkg/nut.xml
            efc07713dccf6f8bd43305a897437e11df769aa4  /usr/local/pkg/nut/nut.inc
            7fa23e54c2f5f81125acf6ffd2f3d3df55db208a  /usr/local/pkg/nut/nut_email.php
            a6a5418b4d67d9f3a33cbf184b25ac7f9fa87d33  /usr/local/share/licenses/pfSense-pkg-nut-2.8.0_2/APACHE20
            6bea4964bbc2176ec94a06684a226b5813d94c0d  /usr/local/share/licenses/pfSense-pkg-nut-2.8.0_2/LICENSE
            b26b9ab861e0d5b418b5e57021d768bd97a07915  /usr/local/share/licenses/pfSense-pkg-nut-2.8.0_2/catalog.mk
            1ccd0187b82cd6c552aa34a776fa6cee31d76c19  /usr/local/share/pfSense-pkg-nut/info.xml
            fe4c2381a6c4a51124ba3ed3a7c68c8935d58284  /usr/local/www/nut_settings.php
            9f8e451e4300a77f89695004a5e8d33c4b4aade6  /usr/local/www/nut_status.php
            cd553d2cfee28ef76482153f4a11b6fa3cc34f71  /usr/local/www/shortcuts/pkg_nut.inc
            1d48164e283d9e320ac8bc81704a11b8949e3448  /usr/local/www/widgets/include/nut_status.inc
            d33250c0811051d2fb43a77a3c3300d1595a06ca  /usr/local/www/widgets/widgets/nut_status.widget.php
            
            dennypageD 2 Replies Last reply Reply Quote 0
            • dennypageD
              dennypage @Austin 0
              last edited by

              @austin-0 That is all correct. I'm not seeing anything wrong from a NUT pov.

              Let's try the notification again and check the system log to see if there is any indication of the issue. Run this:

              php-cgi /usr/local/pkg/nut/nut_email.php this is a test
              

              followed by this:

              tail /var/log/system.log
              

              There should be a line in the system log for the php-cgi command referring to notify_monitor. What does it say?

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

                @austin-0 While we're at it, we might as well just do this:

                grep notify_monitor /var/log/system.log
                

                This will include the prior attempts as well.

                1 Reply Last reply Reply Quote 0
                • Austin 0A
                  Austin 0
                  last edited by

                  @dennypage

                  Apr 22 12:29:23 WhatAreRoutes kernel: ugen1.2: <CPS ST Series> at usbus1
                  Apr 22 12:29:25 WhatAreRoutes upsmon[2348]: Poll UPS [OfficeUPS] failed - Driver not connected
                  Apr 22 12:29:30 WhatAreRoutes php-cgi[74564]: notify_monitor.php: Message sent to ----- OK
                  Apr 22 12:29:30 WhatAreRoutes upsmon[2348]: Poll UPS [OfficeUPS] failed - Driver not connected
                  Apr 22 12:29:30 WhatAreRoutes kernel: ugen1.2: <CPS ST Series> at usbus1 (disconnected)
                  Apr 22 12:29:34 WhatAreRoutes kernel: ugen1.2: <CPS ST Series> at usbus1
                  Apr 22 12:29:35 WhatAreRoutes upsmon[2348]: Poll UPS [OfficeUPS] failed - Driver not connected
                  Apr 22 12:29:40 WhatAreRoutes upsmon[2348]: Poll UPS [OfficeUPS] failed - Driver not connected
                  Apr 22 12:29:41 WhatAreRoutes php-cgi[74564]: notify_monitor.php: Message sent to ----- OK
                  Apr 22 12:29:42 WhatAreRoutes kernel: ugen1.2: <CPS ST Series> at usbus1 (disconnected)
                  

                  I replaced the email address with ----- in the output for privacy reasons. It was the correct email though. I also did get the notification email when running this test.

                  Austin 0A dennypageD 2 Replies Last reply Reply Quote 0
                  • Austin 0A
                    Austin 0 @Austin 0
                    last edited by

                    Actually now it is spamming the email with the "this is a test" message.

                    Austin 0A dennypageD 2 Replies Last reply Reply Quote 0
                    • dennypageD
                      dennypage @Austin 0
                      last edited by

                      @austin-0 said in NUT notifications not working on pfsense+:

                      I also did get the notification email when running this test.

                      Meaning you received a notification from NUT saying that the UPS was not available? There are two successful indications in there.

                      Austin 0A 1 Reply Last reply Reply Quote 0
                      • Austin 0A
                        Austin 0 @Austin 0
                        last edited by

                        And it was failing to get the UPS status until reseated the cable, and restarted the nut service.

                        1 Reply Last reply Reply Quote 0
                        • Austin 0A
                          Austin 0 @dennypage
                          last edited by

                          @dennypage Yes however last time we tried that I also got the notifications when running the command. I just don't get them when I disconnect the UPS, or it switches to battery.

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

                            @austin-0 said in NUT notifications not working on pfsense+:

                            Actually now it is spamming the email with the "this is a test" message.

                            Ah... there we go. See this Redmine entry for a patch.

                            Austin 0A 1 Reply Last reply Reply Quote 0
                            • Austin 0A
                              Austin 0 @dennypage
                              last edited by

                              @dennypage Thank you. We are currently live streaming. So it's not a good time to be installing patches, but once that is done I will try out the patch.

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

                                @austin-0 said in NUT notifications not working on pfsense+:

                                We are currently live streaming. So it's not a good time to be installing patches, but once that is done I will try out the patch.

                                After installing the patch, you may also need to remove the existing notification files. And if a process is hung processing notifications, either kill it or reboot pfSense.

                                Austin 0A 1 Reply Last reply Reply Quote 0
                                • Austin 0A
                                  Austin 0 @dennypage
                                  last edited by

                                  @dennypage Okay so I have never done this before, but from what I can tell I correctly entered th commit ID, but it is telling me it is invalid. What am I doing wrong here?

                                  fd0a6e2f-fa15-4d7c-af2c-35496a00ac55-image.png

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

                                    @austin-0 Not sure, but you can try it in URL format:

                                    https://github.com/pfsense/pfsense/commit/c5faa351c1ef6d4555478a7f50b3a16ece7e0b2a.patch
                                    
                                    Austin 0A 1 Reply Last reply Reply Quote 0
                                    • Austin 0A
                                      Austin 0 @dennypage
                                      last edited by

                                      @dennypage Thank you. I was able to install the package, and then rebooted. Notifications are still not being emailed to me when I unplugged the USB cable to the UPS. I did get the notifications for the actual reboot.

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

                                        @austin-0 Can you post the grep output please?

                                        grep notify_monitor /var/log/system.log
                                        
                                        Austin 0A 1 Reply Last reply Reply Quote 0
                                        • Austin 0A
                                          Austin 0 @dennypage
                                          last edited by

                                          @dennypage Well I am no longer there and someone turned off the computer I usually use to remote in. So I won't be able to do this until Friday or Saturday.

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

                                            @austin-0 Okay, I just tested that patch. The effect is that all non root notifications silently fail. I've reached out to @jimp in the Redmine discussion.

                                            In the interim, it appears that the only way you will be able to make it work is to have NUT run as root. You can do this by adding the line

                                            RUN_AS_USER root
                                            

                                            to the "Additional configuration lines for upsmon.conf" section in Services / UPS / Settings / Advanced settings.

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