Page 1 of 1

Email notifications not working for two contacts

Posted: Tue Aug 16, 2016 2:24 am
by crystal.then
Hi Support,

I'm having issues getting email notifications to work for two particular contacts. Notifications for other contacts are working fine. There was a slight difference in the setup - normally I would create a user and check the box that says "create as a monitoring contact". This time I'm just creating a contact, as login is not required.

Here are the contact definitions:

Code: Select all

define contact {
        contact_name                           Email_Helpdesk
        alias                                   Helpdesk
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                24x7
        service_notification_period             24x7
        host_notification_options               d,r,
        service_notification_options            w,c,r,f,
        host_notification_commands              xi_host_notification_handler
        service_notification_commands           xi_service_notification_handler
        email                                   [email protected]
        }

define contact {
        contact_name                            Email_SysTeam
        alias                                   Systems Team
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                24x7
        service_notification_period             24x7
        host_notification_options               d,r,
        service_notification_options            w,c,r,f,
        email                                   [email protected]
        use                                     xi_contact_generic
        }
The service that I'm testing with:

Code: Select all

define service {
        host_name                       Crystal
        service_description             Drive C: Disk Usage
        use                             xiwizard_windowswmi_service
        max_check_attempts              5
        check_interval                  5
        retry_interval                  1
        check_period                    24x7
        flap_detection_enabled          0
        notification_interval           60
        first_notification_delay        0
        notification_period             24x7
        notification_options            w,c,u,r,f,s,
        notifications_enabled           1
        contacts                        Email_Helpdesk,Email_SysTeam,SMS_Critical
        _xiwizard                       windowswmi
        register                        1
        }
According to the Nagios log the notifications are being sent:

Code: Select all

[1471330924] SERVICE ALERT: Crystal;Drive C: Disk Usage;WARNING;HARD;5;WARNING - [Triggered by _Used%>50] - C: Total=79.90GB, Used=70.45GB (88.2%), Free=9.45GB (11.8%)
[1471330924] SERVICE NOTIFICATION: Email_Helpdesk;Crystal;Drive C: Disk Usage;WARNING;xi_service_notification_handler;WARNING - [Triggered by _Used%>50] - C: Total=79.90GB, Used=70.45GB (88.2%), Free=9.45GB (11.8%)
[1471330924] SERVICE NOTIFICATION: Email_SysTeam;Crystal;Drive C: Disk Usage;WARNING;xi_service_notification_handler;WARNING - [Triggered by _Used%>50] - C: Total=79.90GB, Used=70.45GB (88.2%), Free=9.45GB (11.8%)
But there's nothing in /var/log/maillog at this time. Any ideas? I suspect that if I created an XI user and associated contact it would work fine, but I would prefer not to since this will be going to a distribution list (no user in particular).

Nagios is up to date (5.2.9)

Re: Email notifications not working for two contacts

Posted: Tue Aug 16, 2016 9:33 am
by lmiltchev
Are you using SMTP or Sendmail to send your emails? Do you have anything in the "/usr/local/nagiosxi/tmp/phpmailer.log" (if it exists)?

Re: Email notifications not working for two contacts

Posted: Tue Aug 16, 2016 5:43 pm
by crystal.then
We are using sendmail - I've tested sending mail to the addresses above from CLI and it works.

I can't find any phpmailer.log file in /usr/local/nagiosxi

Re: Email notifications not working for two contacts

Posted: Wed Aug 17, 2016 9:31 am
by tmcdonald
Most likely it is because you are using the xi_contact_generic template for those contacts, which assumes there is an associated user and supplies the xi_host_notification_handler and xi_service_notification_handler commands appropriately. You will want to instead use the generic-contact template, which uses notify-host-by-email and notify-service-by-email instead, skipping the SMTP options and using sendmail.

Re: Email notifications not working for two contacts

Posted: Mon Aug 22, 2016 2:41 am
by crystal.then
Hi tmcdonald, thanks for your help - this was the issue :)

Re: Email notifications not working for two contacts

Posted: Mon Aug 22, 2016 9:16 am
by tmcdonald
Glad I could help. I'll be closing this thread now, but feel free to open another if you need anything in the future!