Page 1 of 1

Notification problem

Posted: Thu May 26, 2011 8:35 am
by Marble
Hello,

Yesterday one of my co-workers pointed out that he not received any email-alerts from Nagios recently. I checked the particular config-file but nothing has changed. In case of an alert an email is sent to two groups (admin,sap) but only one group (admin) is receiving the alerts by email.

In order to check if the problem was related to exchange 2003, i manually tested the sap emailaddress (mail -s test [email protected]). The sap emailaddress received the test mail so that made me think that exchange is not the problem.

I made a small adjusment to the notify-host-by-email command and forced a warning/error for that particular host to see the contents from variable $CONTACTEMAILS$.

Code: Select all

# 'notify-host-by-email' command definition
define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "[b]$CONTACTEMAIL$\n[/b]***** Nagios *****\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$
        }
I noticed that the $CONTACTEMAILS$ variable was only containing the emailaddress from the admin group and was missing the emailaddress from the sap group when the mail command is executed.

Anybody an idea what is causing this problem and how i can solve it?

Any help will be appreciated.

JaapB

Re: Notification problem

Posted: Wed Jun 01, 2011 9:45 am
by mguthrie
Can you verify that the person who isn't receiving the emails is a contact for that host or service?

Re: Notification problem

Posted: Thu Jun 16, 2011 1:23 am
by Marble
I noticed service definitions in some of our config files did not contain a "contact_group" entry. This caused the service definition to inherance the "contact_group" from the service template which only contains the admins contact_group.

I don't know how this could have been working in the past, but after i made the required changes everything is working again.

Re: Notification problem

Posted: Fri Jun 17, 2011 10:28 am
by mguthrie
Ok, that makes sense, there are few inheritance rules for contacts that are implied like that. Glad it's working for you!
http://nagios.sourceforge.net/docs/3_0/ ... tance.html