One check_command many services

Support requests, bug reports, questions etc.
Locked
Guest
One check_command many services

Post by Guest » Tue Apr 14, 2009 15:25

Hello !

We have a problem using Nconf trying to define our propers objects.
This is a sample of what we want to do.

Code: Select all

define service{
name template
hostgroup hg1
}

define service{
use template
service_description service1
check_command command1
}

define service{
use template
service_description service2
check_command command2
}
With this configuration, a service is directly added/removed for all the servers of an hostgroup. It's a faster way to configure Nagios services.
We had tried to define some classes and attributes but we aren't sure of how it has to be done. Have someone an idea ?
Our final Nagios configuration will be distributed and Nconf seem to be a good way of managing distributed configuration.
Thanks in advance.
Best regards.

J & M

Guest

Re: One check_command many services

Post by Guest » Tue Apr 14, 2009 15:28

Thanks to notice that the subject should be "One service many check_commands"

J & M

User avatar
agargiulo
NConf developer
NConf developer
Posts:725
Joined:Fri Mar 06, 2009 17:50
Location:Zurich, Switzerland
Contact:

Re: One check_command many services

Post by agargiulo » Wed Apr 22, 2009 12:37

Hi.

If I understand correctly, you would like to define a standalone service named "template". This service is not directly linked to any host, but can be used by other services through a "use" attribute.

The cleanest way of doing this would be to add a new class (e.g. "service-template") and then define the attributes you would like there ("name", "hostgroup",...).
Next, you would have to add a "use" attribute to the class "service". Set the datatype of the new attribute to "assign_one" and as "items to be assigned" select your new "service-template" class. This should create a new drop-down menu when you add or edit a service, and you should be able to assign one of your templates.

The only problem with the current version of NConf is that you would have to do some changes to the 'bin/generate_config.pl' script, because the script will not automatically recognize and process your new class type. We are working on making this more dynamic within the next version.

Please refer to this thread for further info (note that we do not recommend editing scripts on your own, because there might be changes in the upcoming versions):
viewtopic.php?f=3&t=16

User avatar
agargiulo
NConf developer
NConf developer
Posts:725
Joined:Fri Mar 06, 2009 17:50
Location:Zurich, Switzerland
Contact:

Re: One check_command many services

Post by agargiulo » Wed May 20, 2009 15:32

Hi.

Could you let me know the exact attributes that you wish to define in a service-template? We will be implementing this soon.

Thank you.

Locked