Empty hostgroups ok, but not if services defined?
Thomas Guyot-Sionnest
dermoth at aei.ca
Fri Apr 11 20:46:05 CEST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 09/04/08 04:13 AM, Marcus Fleige wrote:
> Hi again,
>
> Marcus Fleige schrieb am 27.03.2008 15:35 Uhr:
>> Hi Ethan, hi list,
>>
>> i got a little problem with empty hostgroups in my config.
>> From Nagios Version 3.0rc3 and up, empty hostgroups are
>> ignored by default. So far, so good, but when i define a
>> service for an empty hostgroup, i get an error:
>>
>> Error: Could not expand hostgroups and/or hosts specified
>> in service (config file '/etc/nagios/hostgroup-templates/
>> services-hardware-accesspoint.cfg', starting on line 1)
>>
>> Is it possible to circumvent this error? My initial idea was
>> to define a dummy host and make it a member of every hostgroup.
>> But i think this is not the most elegant way to deal with this...
>>
>
> As this is bothering me, I'll try to make things clearer:
>
> I'm using hostgroups to inherit services to hostgroup members, the
> hostgroups are globally defined. Now, as i am building distributed
> monitoring, some of these hostgroups are only used on the first
> monitoring node and unknown to the second. This leads to a configuration
> error on the second node, as the hostgroup is empty but there are still
> services defined for it.
>
> Per Definition, it is ok for Nagios if there is an empty hostgroup, it
> is no problem if you define a hostgroup in your config without any
> members ("0 Warnings, 0 Errors").
>
> But if you define a service for that empty hostgroup, Nagios complains
> about being unable to expand the hostgroup:
> Error: Could not expand hostgroups and/or hosts specified in service
> (config file
> '/etc/nagios/hostgroup-templates/services-hardware-accesspoint.cfg',
> starting on line 1)
Just for correctness here's it fails on setting up the service here not
on expanding the hostsgroup.
If you look at the configuration, host_name is required for any service:
http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#service
By assigning an empty housgroup you are doing the same as omitting
host_name and this is why Nagios refuses to start.
> For me, this is somewhat inconsistent behaviour. From my understanding,
> Nagios should ignore the empty hostgroup completely including its
> services instead of complaining.
>
> What do you think about that? Thanks for your time,
I don't believe it's inconsistent... If you have some C skills you could
certainly patch that part of the code for yourself - I believe it's
pretty trivial. However I'm wondering if you really need "global
hostsgroups" in your distributed setup.
I built my servers to be distributed and, in doing so, I made them all
with a cfg_dir with:
1. server-local templates
2. server-local hosts/hostsgroups
3. server-local services/servicegroups
all that in sub dirs so it's easily manageable. Every template,
hostsgroup and servicegroup has a site prefix if front of it so there is
no possible name conflicts.
The idea is to eventually have a main dashboard using all the remote
files unmodified and change the base templates on which all these
services are built (passive, etc...)
I hope this helps...
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFH/7Ht6dZ+Kt5BchYRApUZAKCNMFnNH8Y2Q5/wl1vfz3uZoviGUQCgn2eN
b+fctJZDg8HVt1f0FgnOp2s=
=gU0j
-----END PGP SIGNATURE-----
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
More information about the Developers
mailing list