Email notifications failing

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Email notifications failing

Postby QPII » Fri Nov 22, 2019 5:02 pm

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
QPII
 
Posts: 3
Joined: Fri Nov 22, 2019 4:38 pm

Re: Email notifications failing

Postby scottwilkerson » Mon Nov 25, 2019 11:48 am

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 18468
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Email notifications failing

Postby QPII » Mon Nov 25, 2019 5:26 pm

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

Thank you so much!
QPII
 
Posts: 3
Joined: Fri Nov 22, 2019 4:38 pm

Re: Email notifications failing

Postby scottwilkerson » Mon Nov 25, 2019 5:31 pm

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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 18468
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Email notifications failing

Postby QPII » Mon Nov 25, 2019 5:35 pm

Yes

Thanks again!
QPII
 
Posts: 3
Joined: Fri Nov 22, 2019 4:38 pm

Re: Email notifications failing

Postby scottwilkerson » Mon Nov 25, 2019 5:52 pm

QPII wrote:Yes

Thanks again!

Great!\

Locking thread
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 18468
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Community Support

Who is online

Users browsing this forum: No registered users and 6 guests