Notification problem

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Marble
Posts: 3
Joined: Thu May 26, 2011 6:00 am

Notification problem

Post 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 xxxx@xxx.xx). 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
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Notification problem

Post by mguthrie »

Can you verify that the person who isn't receiving the emails is a contact for that host or service?
Marble
Posts: 3
Joined: Thu May 26, 2011 6:00 am

Re: Notification problem

Post 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.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Notification problem

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