Email notifications failing

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
QPII
Posts: 3
Joined: Fri Nov 22, 2019 4:38 pm

Email notifications failing

Post by QPII »

Im having issues sending notifications on my set up of Nagios 4.4.1

Which mail returns

/usr/bin/mail

In my command.cfg I have

Code: Select all

define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

# 'notify-service-by-email' command definition
define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
And in my event log this is the result when I force a msg from the host. (I have used **** to remove the actual email address, but have verified and reverified the email address is not the issue)

Code: Select all

[11-22-2019 15:27:42] wproc: Core Worker 2038: job 1 (pid=2073): Dormant child reaped
Informational Message[11-22-2019 15:27:42] Warning: Notifying contact 'nagiosadmin' of host 'TESTEMAIL' by command '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: CUSTOM\nHost: TESTEMAIL\nState: DOWN\nAddress: 10.1.17.17\nInfo: CRITICAL - Host Unreachable (10.1.17.17)\n\nDate/Time: Fri Nov 22 15:27:11 CST 2019\n" | /usr/bin/mail -s "** CUSTOM Host Alert: TESTEMAIL is DOWN **" ****@***.com' timed out after 0.00 seconds
Informational Message[11-22-2019 15:27:42] wproc: early_timeout=1; exited_ok=0; wait_status=0; error_code=62;
Informational Message[11-22-2019 15:27:42] wproc: host=TESTEMAIL; service=(none); contact=nagiosadmin
Informational Message[11-22-2019 15:27:42] wproc: NOTIFY job 1 from worker Core Worker 2038 timed out after 31.03s
Informational Message[11-22-2019 15:27:41] wproc: Core Worker 2038: job 1 (pid=2073) timed out. Killing it
Host Notification[11-22-2019 15:27:11] HOST NOTIFICATION: nagiosadmin;TESTEMAIL;CUSTOM (DOWN);notify-host-by-email;CRITICAL - Host Unreachable (10.1.17.17);Nagios Admin;TEST
External Command[11-22-2019 15:27:11] EXTERNAL COMMAND: SEND_CUSTOM_HOST_NOTIFICATION;TESTEMAIL;0;Nagios Admin;TEST
I genuinely appreciate any ideas you guys have. Thank you
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Email notifications failing

Post by scottwilkerson »

It's showing the command timed out

Can you run this from the CLI adding the email back in for ****@***.com?

Code: Select all

su nagios
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: CUSTOM\nHost: TESTEMAIL\nState: DOWN\nAddress: 10.1.17.17\nInfo: CRITICAL - Host Unreachable (10.1.17.17)\n\nDate/Time: Fri Nov 22 15:27:11 CST 2019\n" | /usr/bin/mail -s "** CUSTOM Host Alert: TESTEMAIL is DOWN **" ****@***.com
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
QPII
Posts: 3
Joined: Fri Nov 22, 2019 4:38 pm

Re: Email notifications failing

Post by QPII »

It was failing from the CLI as well and that ended up pointing me in the correct direction.

Thank you so much!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Email notifications failing

Post by scottwilkerson »

QPII wrote:It was failing from the CLI as well and that ended up pointing me in the correct direction.

Thank you so much!
Great!

May we lock the thread?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
QPII
Posts: 3
Joined: Fri Nov 22, 2019 4:38 pm

Re: Email notifications failing

Post by QPII »

Yes

Thanks again!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Email notifications failing

Post by scottwilkerson »

QPII wrote:Yes

Thanks again!
Great!\

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked