Oh, I'm not saying your script is bad or wrong or anything. I think
it's a great idea considering this doesn't work yet.
When you work primarily with hostgroups, it's frustrating to not have it
work everywhere. I would like to be able to add a host, add it to a
hostgroup, and everything "just works". We've been able to do this thus
far because we didn't define servicegroups yet.
I will ask the nagios-devel list about it.
Thanks for the script in the meantime,
-Lori
-----Original Message-----
From: Hari Sekhon [mailto:***@googlemail.com]
Sent: Monday, September 17, 2007 4:05 AM
To: Lori Adams
Cc: nagios-***@lists.sourceforge.net
Subject: Re: [Nagios-users] hostgroups in servicegroup definition FIXED
I've had a look at the changelog and it doesn't seem to be something
that has been done in the new 3.x series.
Also, I'm not part of the development team for nagios, just a user who
like writing plugins and stuff to get my work done,
so I can't say really if they intend to support this, as I didn't see a
roadmap or anything of intended features/changes.
Perhaps you'd be best off asking in nagios-devel mailing list... making
it a feature request or something. I'm sure it's not hard to do
and they probably just need a reason to do it. You could be that reason.
In the meantime I've started using hostgroups more now and in fact I
find that my servicegroup generator works nicely so I'm not
in any real rush for this now. It doesn't really matter from my
perspective if they add it now since I never manually bother with
servicegroup now, it's done automatically by script, it works and I
don't have to edit it so from an admin perspective, there isn't
much difference, especially since you don't need to manually add a
hostgroup to a servicegroup since any more either way.
Works here.
I'd be curious to know if there is any reason why you must have
hostgroups in the members line? Isn't the end result the same?
Perhaps it's something you need which relies on the semantics of the
format of the members line containing hostgroups rather than hosts, like
you're grepping some text out for a report or something?
-h
Hari Sekhon
Post by Lori AdamsThis 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
Post by Lori Adamshostgroup name allowed in a servicegroup config. In the meantime,
I'll
Post by Lori Adamsprobably 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-----
Sent: Thursday, September 13, 2007 3:04 AM
To: Lori Adams
Subject: Re: [Nagios-users] hostgroups in servicegroup definition
FIXED
Post by Lori AdamsI 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
define service{
blah
blah
hostgroup_name SomeHostGroupName
blah
blah
}
firstly you must use "hostgroup_name" instead of "host_name" on the
left
Post by Lori Adamshand 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
Post by Lori Adamsit 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
Post by Lori Adamswill 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,
Post by Lori Adamsit 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.
http://www.nagiosexchange.org/Configuration.20.0.html?&tx_netnagext_pi1[
Post by Lori Adamsp_view]=896
Let me know how it goes for you with this.
Hope that helps
-h
Hari Sekhon
Post by Lori AdamsThis doesn't work.
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
Post by Lori Adamsof servicegroups following the names of the services you have defined
in
Post by Lori Adamsservices.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