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

NUT Package, how to Email notifications on Pfsense 2.3 ?

pfSense Packages
5
13
5.1k
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.
  • D
    dubwise
    last edited by Jun 16, 2016, 4:34 PM

    Hi All,

    Now that NUT had been released for PFsense 2.3, does anyone know how to send email notification ?

    The following procedure does not work anymore :
    https://redmine.pfsense.org/issues/4335

    Other reference thread but with no solution :
    https://forum.pfsense.org/index.php?topic=97697.15

    Any help would be really appreciated.
    Regards,

    1 Reply Last reply Reply Quote 0
    • D
      dennypage
      last edited by Jun 17, 2016, 6:38 AM Jun 17, 2016, 12:50 AM

      It's not graceful, but it still works. Following is what I am using on my system.

      The notification script is in /root/ups_email_notice:

      
      #!/bin/sh
      
      date=`/bin/date -R`
      hostname=`/bin/hostname`
      subject="UPS Notification from ${hostname}"
      
      printf "${date}\n\n${*}" | /usr/local/bin/mail.php -s="${subject}"
      
      

      The script needs to be executable.

      The supporting NUT configuration is entered in the Advanced Features section of the NUT settings page (Services -> NUT -> NUT Settings):

      
      NOTIFYCMD /root/ups_email_notice;
      NOTIFYFLAG ONLINE	SYSLOG+WALL+EXEC;
      NOTIFYFLAG ONBATT	SYSLOG+WALL+EXEC;
      NOTIFYFLAG LOWBATT	SYSLOG+WALL+EXEC;
      NOTIFYFLAG FSD		SYSLOG+WALL+EXEC;
      NOTIFYFLAG COMMOK	SYSLOG+WALL+EXEC;
      NOTIFYFLAG COMMBAD	SYSLOG+WALL+EXEC;
      NOTIFYFLAG SHUTDOWN	SYSLOG+WALL+EXEC;
      NOTIFYFLAG REPLBATT	SYSLOG+WALL+EXEC;
      NOTIFYFLAG NOCOMM	SYSLOG+WALL+EXEC;
      NOTIFYFLAG NOPARENT	SYSLOG+WALL+EXEC;
      
      
      1 Reply Last reply Reply Quote 0
      • M
        markeby
        last edited by Jun 19, 2016, 10:28 PM Jun 19, 2016, 7:27 PM

        I am using the same technique but I get the following PHP error:
        ] PHP Fatal error:  Call to undefined function gettext() in /etc/inc/notices.inc on line 399

        When I ssh into the unit, I can run the script manually and it works perfectly fine without complaint, so it isn't that the library needed is missing.

        I added "whoami > /tmp/who.log" to my script as saw the user as "uucp".  I even set my script with chmod to run as 'root' but that did not fix the issue either.

        There was a recommendation to do a clean install on this thread: https://forum.pfsense.org/index.php?topic=112146.0
        Since this is a brand new SG-2220, this is not a very good solution (nuke methodology) because I have a unit purchased from PfSense and should be able to do upgrades without any issues.

        If nobody here can assist, I will have to use one of my two bundled incident supports to get an assist.

        1 Reply Last reply Reply Quote 0
        • D
          dennypage
          last edited by Jun 20, 2016, 12:36 AM

          This is a minor defect, unrelated to NUT. It won't affect the notices.

          I've submitted a PR to correct.

          1 Reply Last reply Reply Quote 0
          • M
            markeby
            last edited by Jun 23, 2016, 3:25 AM

            @dennypage:

            This is a minor defect, unrelated to NUT. It won't affect the notices.

            I've submitted a PR to correct.

            Is there a workaround to this issue?  I really need to send email for notification of power outages.

            1 Reply Last reply Reply Quote 0
            • D
              dennypage
              last edited by Jun 23, 2016, 3:59 AM

              Until a permanent fix is in place, you can work around it temporarily by adding a require to notices.inc:

              https://github.com/pfsense/pfsense/pull/3013/files

              1 Reply Last reply Reply Quote 0
              • M
                markeby
                last edited by Jun 23, 2016, 4:45 AM

                @dennypage:

                Until a permanent fix is in place, you can work around it temporarily by adding a require to notices.inc:

                https://github.com/pfsense/pfsense/pull/3013/files

                Thank you, this worked.  Now a new problem surfaces that seems odd:
                php-cgi: mail.php: Could not send the message to myemail@gmail.com – Error: establishing SSL connections requires the OpenSSL extension enabled

                seems that root has OpenSSL but not when running from the apps.  Oh, and I also piped "php -i" in the script and oddly enough "SSL => Yes" and the other appropriate lines of info about SSL does not exist as when I run this on the console.

                1 Reply Last reply Reply Quote 0
                • C
                  cmb
                  last edited by Jun 25, 2016, 7:53 AM

                  Thanks Denny, merged that PR as it won't hurt.

                  But in this case, won't fix it either I guess. Yeah if you need SSL, then the root cause that was causing it to complain about gettext will make it not have OpenSSL as well. At a quick review it wasn't immediately apparent why it wasn't reading extensions.ini in that case. No way to work around that one for SSL support, the root cause of it not picking up extensions.ini will need to be fixed to address that.

                  1 Reply Last reply Reply Quote 0
                  • M
                    markeby
                    last edited by Jun 26, 2016, 12:53 AM

                    This is disapointing.  I Really need to be able to send messages for events on my firewall.  I may try a workaround by forwarding the logs to a linux system and trigger emails from new log contents.  That ins't too difficult as long as I can get the log info from the NUT package (and possible other packages) directly.

                    1 Reply Last reply Reply Quote 0
                    • L
                      LucaTo
                      last edited by Aug 6, 2016, 5:32 PM

                      same issue here (2.3.3-DEVELOPMENT built on Sat Aug 06 00:03:02 CDT 2016 / NUT 2.7.4_1)

                      nut_email.php: Could not send the message to joe@abcd.com -- Error: establishing SSL connections requires the OpenSSL extension enabled 
                      
                      1 Reply Last reply Reply Quote 0
                      • D
                        dennypage
                        last edited by Aug 10, 2016, 2:03 AM

                        FWIW, the TLS issue has been tracked down:

                        https://forum.pfsense.org/index.php?topic=115349.msg646466#msg646466

                        1 Reply Last reply Reply Quote 0
                        • M
                          markeby
                          last edited by Aug 10, 2016, 3:24 PM

                          That is a fix I can live with.  Now, I have looked throught the github repos but do not know which repo to obtain the build from to install.  I have a factory pfSense box.

                          Or, has the package install been fixed and can I install the NUT from the package list?

                          1 Reply Last reply Reply Quote 0
                          • D
                            dennypage
                            last edited by Aug 10, 2016, 5:57 PM

                            @markeby:

                            Or, has the package install been fixed and can I install the NUT from the package list?

                            Yes, package manager install was fixed Monday morning. Information in this thread:

                            https://forum.pfsense.org/index.php?topic=115349.0

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