One service definition for all hosts

Patryk Lasoń eos at spin.ict.pwr.wroc.pl
Fri May 25 14:21:38 CEST 2007


On pią, maj 25, 2007 at 08:00:12 -0400, Thomas Guyot-Sionnest wrote:
> On 25/05/07 06:11 AM, Patryk Lasoń wrote:
> > On pią, maj 25, 2007 at 10:18:35 +0100, Simon Beale wrote:
> >> Under the service definition change hostgroup to hostgroup_name.
> >>
> >> Note a service can have both a host_name list and a hostgroup_name list,
> >> and the check will be run for both lists.
> > 
> > Thanks a lot!
> 
> What can also help is using "hostgroups" in host definitions instead of
> maintaining a list of hosts in the hostgroup definition. Together with
> templates you could get something like:
> 
> define host
>  name       wns_host
>  hostgroups wns
>  use        default_host
>  register   0
> }
> 
> define hostgroup{
>  hostgroup  wns
>  alias      WNS Cluster
> }
> 
> #for each wns server:
> define host{
>  host_name wnsXXX
>  alias     blah
>  address   1.2.3.4
>  use       wns_host
> }
> 
> define service{
>  hostgroup_name      wns
>  service_description SSH
>  check_command       check_ssh
>  use                 default_service
> }
> 
> This is assuming that default_host and default_service are templates
> with all your defauklt configuration parameters. "register 0" tells
> Nagios that this is not an actual definition, but you can use it in
> other definition with "use TEMPLATE_NAME"

I prefer list of hosts in the hostgroup definition, cause adding
i.e 1000 nodes is just defining them and adding to the list.
Moving hosts between hostgroups is easier.

But I can be wrong, I'm not a Nagios expert :-).

Cheers,
Patryk

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/




More information about the Developers mailing list