hostgroups in servicegroup definition FIXED
Lori Adams
ladams at cloudmark.com
Fri Sep 14 21:27:47 CEST 2007
This is what I expected. This is a workaround. You're not listing
hostgroup_name in the servicegroup config, you're generating the lists
of hosts in a hostgroup using a script and then populating
servicegroups.cfg.
I would rather not have a script that does the generating, but have the
hostgroup name allowed in a servicegroup config. In the meantime, I'll
probably end up using a script to do this for me.
Is this going to be a possibility in a future release?
Define servicegroup {
name blah
alias blah
members hostgroup_name,service
}
-----Original Message-----
From: Hari Sekhon [mailto:hpsekhon at googlemail.com]
Sent: Thursday, September 13, 2007 3:04 AM
To: Lori Adams
Cc: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] hostgroups in servicegroup definition FIXED
I went and had a look at this for you since I would like for people to
be able to use my servicegroup-generator for this as well and what you
need is to do the following in your services.cfg or equivalent file:
define service{
blah
blah
hostgroup_name SomeHostGroupName
blah
blah
}
firstly you must use "hostgroup_name" instead of "host_name" on the left
hand side if you are using hostgroups in your service definitions.
You can use both host_name and hostgroup_name on separate lines within
each service definition block, I've just checked this and it works.
hostgroup_name is not in the Nagios 2.x docs in the services section
even though it works, but other object file definitions do contain
hostgroup_name for their references and it is in the Nagios 3.x docs so
it must just be a minor oversight to not have it in the service
definition section of the Nagios 2.x docs.
I have rewritten my servicegroup-generator.py to work with hostgroups
properly now and work around the fact that Nagios does not accept
hostgroups in the servicegroup file.
If you download the latest version 1.3 on nagiosexchange.org it will
handle this as well by expanding the hostgroups. In order to do this, it
will use your hostgroup file. It defaults to hostgroups.cfg for the
hostgroup file but you can specify another filename using the new -f
switch.
I have added a hostgroup to my services file and it seems to work well,
it puts the host names that belong to the hostgroup into the
servicegroup file and all works well... you can now mix and match
host_name and hostgroup_name definitions in your services file and the
generator will handle it and create a full working servicegroups file.
The latest version is available at:
http://www.nagiosexchange.org/Configuration.20.0.html?&tx_netnagext_pi1[
p_view]=896
Let me know how it goes for you with this.
Hope that helps
-h
Hari Sekhon
Lori Adams wrote:
>
> This doesn't work.
>
>
>
> I get the error:
>
> Error: Could not find a service matching host name '<hostgroup>' and
> description '<service>'.
>
>
>
> It appears to only want hosts.
>
>
>
> -Lori
>
>
>
> -----Original Message-----
>
>
>
> I don't use hostgroups in this way but I'm pretty sure it is possible
>
> because I added this to my servicegroup-generator.py (find it on
>
> nagiosexchange.org) at the request of another guy who emailed me.
>
>
>
> Basically, the "hostgroup, service" bit goes on the Members line the
>
> same way the "host, service" bit does. You're welcome to give the
>
> servicegroup-generator a try as well since it will generate a file
full
>
> of servicegroups following the names of the services you have defined
in
>
> services.cfg or equivalent. I use it to not bother writing my
>
> servicegroup file by hand...
>
>
>
> Let me know how you get on...
>
>
>
> Hope that helps.
>
>
>
> -h
>
>
>
> Hari Sekhon
>
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list