hostgroups in servicegroup definition FIXED

Hari Sekhon hpsekhon at googlemail.com
Mon Sep 17 13:04:42 CEST 2007


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



Lori Adams wrote:
> 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