Email notifications with apcupsd not sent



  • We installed apcupsd a few months ago and it's been fine, reporting the status and so forth. Today we've had two power blips:

    Oct 8 09:26:23 apcupsd 98582 Power is back. UPS running on mains.
    Oct 8 09:26:22 apcupsd 98582 Power failure.
    Oct 8 02:23:16 apcupsd 98582 Power is back. UPS running on mains.
    Oct 8 02:23:15 apcupsd 98582 Power failure.

    It does not appear to have tried to send the email notification? Should it log that? Notifications are set to use "php," are configured in System/Advanced and testing there works. I found a couple of old messages from 4-5 years ago about email notifications in apcupsd not working, but were supposed to be fixed by a pfSense update. Is that still an issue?



  • @teamits
    I assume you have configured notifications in System/Advanced/Notifications. When you hit
    c2296e02-e041-454a-bd20-6aa48bd6f2f5-image.png
    It works? Other notifications work?

    @teamits said in Email notifications with apcupsd not sent:

    Notifications are set to use "php,"

    Where is that set?



  • Hello!

    Check the output from :

    clog /var/log/system.log | grep -i message
    

    Aside from some noise, you should see most email results, good or bad.

    Keep in mind that pfsense does not run an mta. A local powerfail safe relay running postfix/exim/??? on something like a pi can be helpful if you want queues, retries, etc...

    John



  • @serbus said in Email notifications with apcupsd not sent:

    clog /var/log/system.log | grep -i message

    I see only my test for today:
    Aug 28 18:00:24 router-building php-cgi: notify_monitor.php: Message sent to support@example.com OK
    Aug 28 18:04:37 router-building php-cgi: notify_monitor.php: Message sent to support@example.com OK
    Oct 8 10:02:48 router-building php-fpm[1991]: /system_advanced_notifications.php: Message sent to support@example.com OK

    So that would imply it didn't bother trying?

    ' Notifications are set to use "php," ' is set in the apcupsd settings. It has a choice of "php" or "SMTP built-in" which is the package's own email settings but there is no test button there.

    "php - In order to receive e-mail notifications through php, you need to configure SMTP Email Notifications on System/Advanced/Notifications section.

    SMTP built-in - A simple SMTP mail client for apcupsd. It does not have smtp authentication of any kind."

    Edit: I have already changed to "SMTP built-in" to try for next time but as I said there is no test button.

    Edit 2: clog /var/log/system.log | grep -i apc output:
    Aug 28 18:04:41 router-building apcupsd[98582]: apcupsd 3.14.14 (31 May 2016) freebsd startup succeeded
    Aug 28 18:04:41 router-building apcupsd[98582]: NIS server startup succeeded
    Oct 8 02:23:15 router-building apcupsd[98582]: Power failure.
    Oct 8 02:23:16 router-building apcupsd[98582]: Power is back. UPS running on mains.
    Oct 8 09:26:22 router-building apcupsd[98582]: Power failure.
    Oct 8 09:26:23 router-building apcupsd[98582]: Power is back. UPS running on mains.
    Oct 8 10:19:19 router-building php-fpm[1991]: /pkg_edit.php: Stopping service apcupsd
    Oct 8 10:19:19 router-building apcupsd[98582]: apcupsd exiting, signal 15
    Oct 8 10:19:20 router-building apcupsd[98582]: apcupsd shutdown succeeded
    Oct 8 10:19:24 router-building php-fpm[1991]: /pkg_edit.php: Starting service apcupsd
    Oct 8 10:19:30 router-building apcupsd[92818]: apcupsd 3.14.14 (31 May 2016) freebsd startup succeeded
    Oct 8 10:19:30 router-building apcupsd[92818]: NIS server startup succeeded

    (10:19 was when I changed to the built in SMTP)



  • Hello!

    apcupsd ends up calling the standard send_smtp_message from /etc/inc/notices.inc when you select the php option.

    You can check the php path with something like :

    /usr/local/bin/php -f /usr/local/pkg/apcupsd_mail.php "commok"
    

    Also, make sure that apcupsd has correctly generated the email notification scripts for php by trying something like :

    /usr/local/etc/apcupsd/commok
    

    I am not sure why there would be nothing in the system.log

    John



  • Hmm, with it set to "built in" I tried both commands, and got two "Communications with UPS restored" emails. I changed the mailer back to "php" and ran them again and got two more emails.



  • Hello!

    It sounds like it has the pieces in place to send the emails if it wants to.

    Check /var/log/apcupsd.events and :

    clog /var/log/system.log | grep -i apcupsd
    

    You could also add a "-d" to the command_args in /usr/local/etc/rc.d/apcupsd and then restart the service to try and squeeze out more debug info about what is going on inside apcupsd.

    John



  • @serbus That's what I posted earlier...

    Aug 28 18:04:41 router-building apcupsd[98582]: apcupsd 3.14.14 (31 May 2016) freebsd startup succeeded
    Aug 28 18:04:41 router-building apcupsd[98582]: NIS server startup succeeded
    Oct 8 02:23:15 router-building apcupsd[98582]: Power failure.
    Oct 8 02:23:16 router-building apcupsd[98582]: Power is back. UPS running on mains.
    Oct 8 09:26:22 router-building apcupsd[98582]: Power failure.
    Oct 8 09:26:23 router-building apcupsd[98582]: Power is back. UPS running on mains.

    No email attempts. I guess I can wait until the next power blip and see if it works when set to the "built in" SMTP server.


Log in to reply