Page 1 of 1

[Solved] Add contact to all services of a host

Posted: Wed Oct 07, 2020 9:44 am
by pricent
Hi,

I define services in two files:
* some services are in a file with the host definition
* some services are in a "services_for_all_hosts.cfg" with a line like:

Code: Select all

    host_name               *,!localhost
I would like to add a contact to all the services of a given host, but if I add this contact in the definition of the host, the services defined in "services_for_all_hosts.cfg" are not linked with the contact, only with the contacts listed in the template used for their definition.

How could I make this contact added to the services defined in "services_for_all_hosts.cfg", but only for a given host?

EDIT: I should add that all the contacts are handled with contact_groups objects in templates, and I'm trying to add the contact with a contacts field

Re: Add contact to all services of a host

Posted: Thu Oct 08, 2020 3:47 am
by pricent
SOLVED: a contact_group field was lying around in a service template, so the contacts and contact_groups fiels were overwritten with the value in the template, and the services did not get the contacts field in the host definition.

Re: [Solved] Add contact to all services of a host

Posted: Thu Oct 08, 2020 5:05 pm
by benjaminsmith
Glad you got it worked out and thanks for sharing the solution.

We'll mark this was resolved.

Thank you for using the Nagios Community Forum!

Benjamin