Page 1 of 1

Email notifications failing

Posted: Fri Nov 22, 2019 5:02 pm
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

Re: Email notifications failing

Posted: Mon Nov 25, 2019 11:48 am
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

Re: Email notifications failing

Posted: Mon Nov 25, 2019 5:26 pm
by QPII
It was failing from the CLI as well and that ended up pointing me in the correct direction.

Thank you so much!

Re: Email notifications failing

Posted: Mon Nov 25, 2019 5:31 pm
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?

Re: Email notifications failing

Posted: Mon Nov 25, 2019 5:35 pm
by QPII
Yes

Thanks again!

Re: Email notifications failing

Posted: Mon Nov 25, 2019 5:52 pm
by scottwilkerson
QPII wrote:Yes

Thanks again!
Great!\

Locking thread