Reporting failures of specifc servers to specific users?


#1

Hi all,

I have Nagios 3.0.6 (default Debian Lenny version) installed.

I have defined 3 contacts: myself and the other 2 IT guys at my work. I am in the admins group and they are in the 1and1admins group.
I have 2 host-templates and all hosts “use” one or the other: generic-host and 1and1-host, needless to say the 1and1-host template has the contact_groups directive parameter of admins,1and1admins. Interestingly I (the only one in the “admins” contact group) am the only one who receives any notifications.

What am I doing wrong?

Cheers.
Grant. :s


#2

hundreds of things could be wrong…

first recomendation is to install from sources… :slight_smile:

have you tried using only one contact group? deos it work? if not check that the all email addresses are correct, check that the notification is sent from nagios, then check the maillog of your server… a lot of things. :slight_smile:


#3

Although I am normally quite happy to install from source, on production servers I prefer to use the distro’s own version so that I don’t have to spend 25 hours a day looking for and applying the security patches to the hundred-and-one things that need patching.

I did have 1 contactgroup initially - “admins”. It works. It still works. I duplicated the contact and modified the contact_name and email directives of the duplicates. I then duplicated the contactgroup and modified the contact_group name, alias and members directives of the duplicate.:[code]define contact {
contact_name Grant
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email my@email.address
}

define contact {
contact_name Nikolai
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email niks@email.address
}

define contact {
contact_name Ed
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email eds@email.address
}

define contactgroup{
contactgroup_name admins
alias Notify about ALL incidents
members Grant
}

define contactgroup {
contactgroup_name 1and1admins
alias Notify about 1&1 Servers only
members Nikolai,Ed
}[/code]Obviously I have changed the email addresses in this posting, but I can guarantee that the addresses used can receive mail.

I have duplicated and modified the host template accordingly:define host{ name 1and1-host ; The name of this host template notifications_enabled 1 ; Host notifications are enabled event_handler_enabled 1 ; Host event handler is enabled flap_detection_enabled 1 ; Flap detection is enabled failure_prediction_enabled 1 ; Failure prediction is enabled process_perf_data 1 ; Process performance data retain_status_information 1 ; Retain status information across program restarts retain_nonstatus_information 1 ; Retain non-status information across program restarts check_command check-host-alive max_check_attempts 10 notification_interval 0 notification_period 24x7 notification_options d,u,r contact_groups admins,1and1admins register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! }And there are a number of hosts that are told to use the 1and1-host template:define host{ use 1and1-host host_name 1 and 1 host alias Host Alias address 12.34.56.78 }However, when any of these 1and1 hosts have failures I am still the only one who gets notified. :frowning:


#4

one thing which looks strange (but it may be you changed the name while copying it over) is th ename of the host with spaces in it…

in the notifications page of nagios do you see two different notifications generated? you should have one for admins and one for 1and1admins.

Luca


#5

Cheers.

I can appreciate that hosts with spaces in is odd, but it looks cleaner and works OK.

In the notifications page I see only 1 set of notifications generates - for me. Those get emailed to me fine and I receive them quickly.


#6

what happens if you run the verify config?

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

#7

[code]server2:/etc/nagios3/config# nagios3 -v /etc/nagios3/nagios.cfg

Nagios 3.0.6
Copyright © 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 12-01-2008
License: GPL

Reading configuration data…

Running pre-flight check on configuration data…

Checking services…
Checked 68 services.
Checking hosts…
Checked 14 hosts.
Checking host groups…
Checked 13 host groups.
Checking service groups…
Checked 3 service groups.
Checking contacts…
Checked 3 contacts.
Checking contact groups…
Checked 2 contact groups.
Checking service escalations…
Checked 0 service escalations.
Checking service dependencies…
Checked 0 service dependencies.
Checking host escalations…
Checked 0 host escalations.
Checking host dependencies…
Checked 0 host dependencies.
Checking commands…
Checked 161 commands.
Checking time periods…
Checked 4 time periods.
Checking for circular paths between hosts…
Checking for circular host and service dependencies…
Checking global event handlers…
Checking obsessive compulsive processor commands…
Checking misc settings…

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check[/code]


#8

sorry no ideas left…
if you are willing to test i’d say try compiling from source and use the same config files to see if it’s package related or if it really is nagios…

Sorry


#9

OK, I am not sure what the problem is but I have found a way around it.

I have now removed the 1and1admins contact group, I have removed the contact_groups directive from the host and service templates, and I have added the relevant contacts to each host - so the 4 x 1&1 servers have Ed, Nikolai & myself as contacts but all other monitored devices have just myself as the contact.

It works. It’s not a particularly elegant solution, but it works… and that, for me at the moment, is the most important thing.

Thanks Luca for your suggestions. :slight_smile:


#10

glad you found another solution…
should you have the time to test the source package it would be nice to know if that one works :slight_smile:


#11

I may well do. When I get a spare few minutes (time is taken up migrating our userbase from individually configured workstations to an SBS2008 AD environment) I might put the latest source (maybe even CVS/SVN) version on my Debian workstation (I refuse to use Windows on my own system!).


#12

well, then, have fun with the migration :mrgreen:


#13

Bugger! It was working yesterday and now it isn’t! All I’ve been working on since is the service dependencies. :frowning:

Grr.


#14

I think that I am seeing the same problem. I have figured out that my problem is due to a difference in the handling of contacts vs. contact_groups. I have most of my notifications setup with contact_groups that are listed in my host_groups. Unfortunately that leaves most of my services defaulting to notifying the admins contact as defined in the generic_services template. I do have a couple of cases where I defined hosts with a contacts directive and those contacts are being carried over to the services that are defined for those hosts. I would like it to pull in all the hosts that contact_groups defined as well, but from searching the mailing lists it appears that this should not happen. The developers state that service notifications need to be defined explicitly for services and should not pull from the hosts that they’re on.
FYI, I am running 3.1.2 compiled from source and was seeing this same thing when I was running 3.0.6 compiled from source.
Can anybody else confirm what I’m seeing? Anybody know of a way to get contact_groups defined for hosts to carry over to services monitored on that host? If not I’ll be trying to figure out the most manageable way to organize these two sets of notifications.

Thanks!