Page 1 of 1

Email notification for contacts treated as external

Posted: Tue Apr 21, 2020 12:16 pm
by techgeek
Hi,

So being trying to get email notifications working on NagiosXI 5.6.13 and hit a brick wall. We are using smtp pointed at our companys internal smtp server. I have put the smtp setting into the section Admin>Email Settings>SMTP Settings. The smtp server is used by my team widely for sending internal mails and works fine for all our apps. We do not need any special arrangements to use it other than put the FQDN and port 25 in any of our apps to use it.

The problem I face is,If we do test mails from the Admin console "Send a Test mail" to an addresses in own domain e.g [email protected] it works perfectly, appears to use our internal smtp servers and I can see in the test mail in phpmailer.log.

However if I then set up my own email address as a contact ([email protected]) and assign that address as a contact to receive email alerts for a host/service and then break it to test, I never receive the mails.
If Iook in /var/log/maillog I see that for some reason despite my address being same domain as the test addresses, it does not seem to use the smtp server specified and instead must be using the MX record for our domain as I can see it is trying to send to my companys external email infrastructure which it won't be able to reach.

Any idea why this is happening and what I can check as I don't get why it works for the test address which is a regular Admin's address same as mine and not using the smtp server we provided in the config?

Worst case scencario, is there a config at the terminal level I can edit to force it to use the internal mail server?

Thanks andy help would be appreciated as this is really puzzling.

Re: Email notification for contacts treated as external

Posted: Tue Apr 21, 2020 5:00 pm
by ssax
More than likely your contacts are using notify-host-by-email and notify-service-by-email which would require you adjusting the backend postfix.

My recommendation though would be for you to do this:

https://exchange.nagios.org/directory/D ... gs/details

See here as well:

https://assets.nagios.com/downloads/nag ... ntacts.pdf

If that's not the case, please do this:

Please go to Admin > Manage Email Settings:
- Make sure Logging is checked
- Click the Update Settings button

Then run this tail command (and leave it running):

Code: Select all

tail -Fn0 /var/log/maillog /usr/local/nagiosxi/tmp/phpmailer.log /usr/local/nagiosxi/var/eventman.log
Then force a notification to be sent then send me the full output of the tail command above and any errors you see on the screen (not with the test email button).

After you've done the steps above attach a FRESH copy of your profile, you can download it from Admin > System Profile > Download Profile.

Re: Email notification for contacts treated as external

Posted: Wed Apr 22, 2020 9:41 am
by techgeek
Very impressed with the speed you came back to me on this - awesome that fix worked a treat thanks!

I have found another problem when it comes to deploying certain email templates now to contacts - get a SQL error but as it's a separate issue I will create a new post on it for the benefit of other uses that might get it.

Re: Email notification for contacts treated as external

Posted: Wed Apr 22, 2020 4:42 pm
by ssax
Great, glad to help!

Please post the SQL error.

One thing to remember, if you want those Core contacts to use the notification templates you'll need to create an associated user with the same name in Admin > Manage Users, that's likely why it's failing. The fix you applied is only for getting your contacts to use the SMTP settings.