Email notifications not working for two contacts

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
crystal.then
Posts: 57
Joined: Mon Oct 27, 2014 12:05 am

Email notifications not working for two contacts

Post 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)
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Email notifications not working for two contacts

Post 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)?
Be sure to check out our Knowledgebase for helpful articles and solutions!
crystal.then
Posts: 57
Joined: Mon Oct 27, 2014 12:05 am

Re: Email notifications not working for two contacts

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Email notifications not working for two contacts

Post 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.
Former Nagios employee
crystal.then
Posts: 57
Joined: Mon Oct 27, 2014 12:05 am

Re: Email notifications not working for two contacts

Post by crystal.then »

Hi tmcdonald, thanks for your help - this was the issue :)
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Email notifications not working for two contacts

Post 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!
Former Nagios employee
Locked