Mail alerts received by users, not by contacts

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Valouch312
Posts: 14
Joined: Tue Mar 18, 2014 3:30 am

Mail alerts received by users, not by contacts

Post 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 :)
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Mail alerts received by users, not by contacts

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Valouch312
Posts: 14
Joined: Tue Mar 18, 2014 3:30 am

Re: Mail alerts received by users, not by contacts

Post by Valouch312 »

1) xi_host_notification_handler / xi_service_notification_handler
2) SMTP
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Mail alerts received by users, not by contacts

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Valouch312
Posts: 14
Joined: Tue Mar 18, 2014 3:30 am

Re: Mail alerts received by users, not by contacts

Post by Valouch312 »

Should I use notify-*-by-email ?
My SMTP work without authentication
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Mail alerts received by users, not by contacts

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Valouch312
Posts: 14
Joined: Tue Mar 18, 2014 3:30 am

Re: Mail alerts received by users, not by contacts

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

Re: Mail alerts received by users, not by contacts

Post 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.
Former Nagios employee
Valouch312
Posts: 14
Joined: Tue Mar 18, 2014 3:30 am

Re: Mail alerts received by users, not by contacts

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Mail alerts received by users, not by contacts

Post 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.
Locked