Page 1 of 1

Nagios ignores email server configuration

Posted: Thu Jun 18, 2020 3:40 pm
by khorosIT
My nagios instance seems to ignore whatever options I select in Admin > Email Settings and always uses Postfix.
I can set to use SMTP and put in info that works (tested with Send Test email). However, these settings are simply ignored and it uses postfix to send the alerts...
Any ideas?

Current version: XI 5.6.14 on Centos 7

Re: Nagios ignores email server configuration

Posted: Fri Jun 19, 2020 10:17 am
by jbrunkow
It is possible that the contact still has another notification handler defined. If you navigate to Configure using the top bar > click Core Config Manager under the Advanced Configuration on the left > then click Contacts under Alerting on the left > click on the name of the contact you are having trouble with > select the Alert Settings tab > then click Manage Host Notification Commands > do you see xi_host_notification handler or something else? If you migrated from Nagios core to XI, it is possible that your system just retained the old notification handlers set on certain contacts.

You may want to refer to the following linked documentation for more detailed information on how to configure the notification handlers.
CONFIGURING CORE CONTACTS TO USE XI PHP MAILER

This knowledge base article may also come in handy.
XI NOTIFICATION PROBLEMS

Can you please message ( PM ) me your profile and tell me which contact or user you are having trouble with? That will show me exactly how your system is configured. You can download the profile by navigating to System Profile under System Config on the left pane > and clicking the Download Profile button on that page.

Re: Nagios ignores email server configuration

Posted: Fri Jun 19, 2020 11:16 am
by khorosIT
jbrunkow wrote:If you migrated from Nagios core to XI, it is possible that your system just retained the old notification handlers set on certain contacts.
I think this might have something to do with it, we've come from quite some versions ago (before I even started working here).

As for my contact, the has "notify-service-by-email". I then looked at the commands.cfg and see this for notify-service-by-email:

/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$

For notify-host-by-email:

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$


This would explain postfix as it uses the /bin/mail command...

PS. It seems I can't send PMs yet since I don't have enough posts. :?

-D

Re: Nagios ignores email server configuration

Posted: Fri Jun 19, 2020 2:14 pm
by jbrunkow
Well that might be it then! :P

Were you able to change them to the xi_*_notification handlers?

Re: Nagios ignores email server configuration

Posted: Fri Jun 19, 2020 3:15 pm
by khorosIT
Yep, I finally understand how this all works. This also confused things because we had a contact vs a user, both with the same email. Once I set the correct contact, this is working as expected. Now to edit all my services to use the right contact....

Re: Nagios ignores email server configuration

Posted: Fri Jun 19, 2020 4:02 pm
by jbrunkow
Excellent! I'm happy to hear that.

Is it okay if we close this topic and lock the thread for editing?

Re: Nagios ignores email server configuration

Posted: Fri Jun 19, 2020 5:07 pm
by khorosIT
Yep, problem solved!