Page 1 of 1

Email notifications not working to contacts

Posted: Fri Feb 19, 2021 8:25 am
by WillemDH
Hello,

We seem to be having issues with email notifcations to email addresses from contacts which have no user. The contact template was set to

Code: Select all

generic-contact
as we know there are issues with

Code: Select all

xi_contact_generic
for contacts without a user.

The

Code: Select all

contact_generic
contact template uses the

Code: Select all

notify-service-by-email
command which has configured:

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
Notifications are visible in the Notifications overview, but the message never arrives in the mailboxes, either internal, nor external.

Please advice how to troubleshoot this, what logs we should check etc. We have this problem both on QA as PR.

Grtz

Willem

Re: Email notifications not working to contacts

Posted: Fri Feb 19, 2021 5:56 pm
by cdienger
What OS and version of XI is this?

I would watch the /usr/local/nagiosxi/var/cmdsubsys.log, event_handler.log, and eventman.logs while you trigger a service to send and email.

Please send me a profile in a private message after reproducing the behavior and I can look over the logs and configuration. Let me know the name of the host and service you tested.

Re: Email notifications not working to contacts

Posted: Tue Feb 23, 2021 5:21 am
by PeterDK
Hi,

I'm a colleague of Willem and I reproduced the issue and send you the system-profile in a private message.

The most information I saw was from the eventman.log where I could clearly see that the email was send to my work email address for which a user exists. But nothing to my private address for which I have a contact only.
But I see this in the notifications:
Notifications.png
So, for a user the dispatcher is NagiosXI and the gmail contact it's custom:...

Kind regards,
Peter

Re: Email notifications not working to contacts

Posted: Wed Feb 24, 2021 12:24 pm
by ssax
Those Core Contacts (contacts without a user) will use the backend MTA to send the notifications, if they are not making it to the mailboxes you should watch this file for errors:

Code: Select all

/var/log/maillog
Is postfix running?

Code: Select all

systemctl status postfix
Do you have a relayhost setup in /etc/postfix/main.cf?

What is the output of this command?

Code: Select all

alternatives --display mta

Re: Email notifications not working to contacts

Posted: Fri Feb 26, 2021 6:49 am
by PeterDK
Hi,

thanks for this info.
Postfix wasn't the issue, but we were able to exclude this from the root cause.
We never used postfix and it wasn't even configured on the Nagios server.

The screenshot you see above was from our QA environment.
Meaning, the "notify-host-by-email-core" works and is going via smtp. But mailing to external addresses was blocked on the relay server for this QA server.
Retrying this from our PR server works.
Tested this by running the command manually from cli.

The route cause of the email notification not working on our PR server was that for that specific contact the wrong template settings were used: "notify-host-by-email".
That command is indeed trying to use postfix.
So, changing that to "...email-core" solved the issue.

Thanks for the hints.

Kind regards,
Peter

Re: Email notifications not working to contacts

Posted: Fri Feb 26, 2021 11:13 am
by benjaminsmith
Hi Peter,

Glad to hear you got it solved!

We'll go ahead and mark this as resolved. Just open another topic if you have any new questions.

Benjamin