LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-27-2011, 08:19 AM   #1
TalkingMarble
Member
 
Registered: May 2008
Location: Deventer, The Netherlands
Distribution: CentOS 5.0
Posts: 50

Rep: Reputation: 17
Notification problem


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.

Code:
define host{
        use                     windows-server,host-pnp ; Inherit default values from a template
        host_name               xxxx                  ; The name we're giving to this host
        alias                   xxxx                  ; A longer name associated with the host
        contact_groups          sap,admin
        notification_period     daytime
        address                 xx.xx.xx.x              ; IP address of the host
        }
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:
# 'notify-host-by-email' command definition
define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "$CONTACTEMAIL$\n***** 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
 
Old 06-03-2011, 12:10 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
It works for me.

In my host definitions I have a space after the comma between groups whereas you don't. That probably isn't the problem but it can't hurt to try it. (e.g. "sap, admin").

Also the method used to notify users is actually defined in contacts.cfg. The groups are defined in contactgroups.cfg.

You should first verify the people you think are in the second group are actually in it in contactgroups.cfg. You should then examine those people in contacts.cfg and see what the specific entries are defined to use for notification. (For example in a recent alert I actually had 4 separate groups defined in the host entry. All 4 of those are in contactgroups.cfg. 3 of those groups contain only people from contacts.cfg that have host-notify-by-email whereas the other group contains only people from contacts.cfg that have host-notify-by-epager. In looking at history for that alert I see it used both host-notify-by-epager and host-notify-by-email (as appropriate for the users defined) so if I had looked only at what was happening with host-notify-by-email it would have appeared to me that the other users weren't getting notified even though they were.
 
1 members found this post helpful.
Old 06-06-2011, 08:36 AM   #3
TalkingMarble
Member
 
Registered: May 2008
Location: Deventer, The Netherlands
Distribution: CentOS 5.0
Posts: 50

Original Poster
Rep: Reputation: 17
I tried the space after the comma, but it makes no difference. I checked my contacts and contactgroups but everything seems in order.
 
Old 06-06-2011, 09:11 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
So for each of the contacts in contacts.cfg defined in the groups in contactgroups.cfg you see the following?
Code:
host_notification_commands      notify-host-by-email
What file has your notify-host-by-email definition? Is it possible you're looking at the wrong one (e.g. do you have it defined in both commands.cfg and misccommands.cfg)?
 
Old 06-07-2011, 02:12 AM   #5
TalkingMarble
Member
 
Registered: May 2008
Location: Deventer, The Netherlands
Distribution: CentOS 5.0
Posts: 50

Original Poster
Rep: Reputation: 17
After reading your first reply more carefully, 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.

Thanks for all your help MensaWater.
 
1 members found this post helpful.
Old 06-07-2011, 02:18 PM   #6
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
Glad you got it resolved. Can you go to Thread Tools at top of the page and mark this solved. It helps others when searching to find solved threads first.

As an FYI: host-notify-by... and service-notify-by... are separate entries in my setup so likely are in yours as well. Typically you would use the host-notify-by... for servers defined in hosts.cfg being completely unreachable whereas service-notify-by... are used for the individual services defined in services.cfg
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Problem with notification area, need help! blnl Linux - Desktop 4 09-23-2010 04:28 PM
Few questions about Nagios - reboot notification, value=x notification. marccmile Linux - Software 5 06-04-2009 06:44 PM
Mail Notification 5.4 problem wanas Linux - Software 0 12-25-2008 01:50 AM
problem with email notification of new posts titanium_geek LQ Suggestions & Feedback 6 06-15-2005 04:14 PM
Problem with asynchronous notification rajesh_b Programming 2 09-17-2004 07:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration