Email notifications not working to contacts

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Email notifications not working to contacts

Post 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
Nagios XI 5.8.1
https://outsideit.net
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Email notifications not working to contacts

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
PeterDK
Posts: 25
Joined: Tue Jun 05, 2018 9:19 am

Re: Email notifications not working to contacts

Post 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
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Email notifications not working to contacts

Post 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
PeterDK
Posts: 25
Joined: Tue Jun 05, 2018 9:19 am

Re: Email notifications not working to contacts

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Email notifications not working to contacts

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked