Page 1 of 2

Mail alerts received by users, not by contacts

Posted: Wed Apr 02, 2014 1:57 am
by Valouch312
Hi,
I've a little problem with the configuration of sending mail alerts to contacts...
Nagios Xi contacts don't receive mail alerts from Nagios.
Sending mail alerts to Nagios Xi users and admins work good !
I feel that Nagios is not going to read my contacts.cfg...
Can s.o. help me ? Thx :)

Re: Mail alerts received by users, not by contacts

Posted: Wed Apr 02, 2014 12:34 pm
by abrist
A few questions:
1) What notification handlers are configured on the core contacts?
2) Do you use SMTP or Sendmail to send notifications?

Re: Mail alerts received by users, not by contacts

Posted: Fri Apr 04, 2014 4:26 am
by Valouch312
1) xi_host_notification_handler / xi_service_notification_handler
2) SMTP

Re: Mail alerts received by users, not by contacts

Posted: Fri Apr 04, 2014 11:07 am
by abrist
Core contacts cannot use the xi_*_notification_handler 's as they do not have entries in the postgres db. Using smtp with core contacts and the old notify-*-by-email handlers is a bit tricky, but can be done. Does your smtp relay use auth?

Re: Mail alerts received by users, not by contacts

Posted: Mon Apr 07, 2014 1:16 am
by Valouch312
Should I use notify-*-by-email ?
My SMTP work without authentication

Re: Mail alerts received by users, not by contacts

Posted: Mon Apr 07, 2014 11:24 am
by abrist
Valouch312 wrote:Should I use notify-*-by-email ?
My SMTP work without authentication
I would suggest changing the core contacts (contacts without associated XI users) to the notify-*-by-email commands. If they do not send correctly, we will have to look at creating some core notify commands for connecting to an smtp relay.

Re: Mail alerts received by users, not by contacts

Posted: Tue Apr 08, 2014 2:10 am
by Valouch312
I've created a Core contact with notify-*-by-email

define contact {
contact_name test
alias Test User
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s,
service_notification_options w,u,c,r,f,s,
host_notification_commands notify-service-by-email
service_notification_commands notify-service-by-email
email [email protected]
use generic-contact
}

I'm not receiving Nagios mail alerts...

Re: Mail alerts received by users, not by contacts

Posted: Tue Apr 08, 2014 9:22 am
by tmcdonald
Valouch312 wrote:define contact {
...
host_notification_commands notify-service-by-email
service_notification_commands notify-service-by-email
...
}
Is there a specific reason you have both the host and service notifications set to use the service notification handler? The email should still go out but it would have some problems.

Can we see your mail log? I want to see if Nagios is at least attempting to send.

tail -20 /var/log/messages

Be sure to censor out any sensitive information.

Re: Mail alerts received by users, not by contacts

Posted: Thu Apr 10, 2014 4:47 am
by Valouch312
I've both the host and service notifications to receive alerts for hosts and services problems...

ndomod: Shutdown complete.
Event broker module '/usr/local/nagios/bin/ndomod.o' deinitialized successfully.
Nagios 3.5.0 starting... (PID=10839)
Local time is Thu Apr 10 11:35:55 CEST 2014
LOG VERSION: 2.0
ndomod: NDOMOD 1.5.2 (06-08-2012) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
ndomod: Successfully connected to data sink. 0 queued items to flush.
Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
Warning: Service 'Current Load' on host 'localhost' has no default contacts or contactgroups defined!
Warning: Service 'Current Users' on host 'localhost' has no default contacts or contactgroups defined!
Warning: Service 'HTTP' on host 'localhost' has no default contacts or contactgroups defined!
Warning: Service 'PING' on host 'localhost' has no default contacts or contactgroups defined!
Warning: Service 'Root Partition' on host 'localhost' has no default contacts or contactgroups defined!
Warning: Service 'SSH' on host 'localhost' has no default contacts or contactgroups defined!
Warning: Service 'Swap Usage' on host 'localhost' has no default contacts or contactgroups defined!
Warning: Service 'Total Processes' on host 'localhost' has no default contacts or contactgroups defined!
Warning: Host 'localhost' has no default contacts or contactgroups defined!
Finished daemonizing... (New PID=10844)
SERVICE NOTIFICATION: test;servername;Memory Usage;CUSTOM (OK);notify-service-by-email;Mémoire utilisée: total:20455,57 Mb - utilisée: 3533,34 Mb (17%) - libre: 16922,23 Mb (83%);Nagios Administrator;Test Memory
SERVICE NOTIFICATION: nagiosadmin;servername;Memory Usage;CUSTOM (OK);xi_service_notification_handler;Mémoire utilisée: total:20455,57 Mb - utilisée: 3533,34 Mb (17%) - libre: 16922,23 Mb (83%);Nagios Administrator;Test Memory

Re: Mail alerts received by users, not by contacts

Posted: Thu Apr 10, 2014 11:13 am
by slansing
Looks like, for nagiosadmin at least, that you are using "xi_service_notification_handler." What Abrist was referencing in the last post was that you had "notify-service-by-email" also defined for your host notifications on that contact. So you would essentially receive no host notifications via it. You also need to make sure to assign your contacts to the objects they are responsible for, hosts/services, or they will not receive notifications. You can either assign them directly or use a contact group.