Re: [Nagios-devel] Empty hostgroup check in the configuration

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] Empty hostgroup check in the configuration

Post by Guest »

------=_Part_113405_11789644.1226403818337
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Dear Andreas,

Thanks for your answer. I had a look to the code (for the first
time), and I did a patch, which was too easy in my opinion. Please
find attach the modification I did, the xodtemplate_duplicate_services
looked like the only function to modify to me.

I built Nagios and it runs without problem so far, with the expected behavior.

Sorry if the patch is stupid, I'm not yet familiar with Nagios
code... I guess the only side effect is that it might break some
service duplication checks that were done before.

Your opinion will be very much appreciated !

Thanks,

LB

On Tue, Nov 11, 2008 at 11:03 AM, Andreas Ericsson wrote:
> L B wrote:
>> Hello,
>>
>> I have many nagios servers for different regions in the world, and I
>> want to create a standard installation with a set of hostgroups,
>> commands, and services with default thresholds, for all my Nagios
>> admins. My services are applied to hostgroups, and I want to add a
>> check to a host only by adding this host to the relevant hostgroup.
>>
>> Example :
>> - I define a command check_dns
>> - I define a hostgroup dns-server-hostgroup
>> - I define a service check_dns applied to dns-server-hostgroup
>>
>> Then I define a host, and if it's a DNS server, I add it to the DNS
>> hostgroup (I'm running Nagios 3):
>> define host {
>> ....
>> hostgroups +dns-server-hostgroup
>> }
>>
>> This works very well in my configuration except that if I install a
>> nagios server in a new region, and they not have for example a NFS
>> server, I will get an error because nfs-server-hostgroup is empty. I
>> fixed this by adding "register 0" to the service definition, but that
>> means the admins have to comment out this line to enable the check on
>> the hostgroup.
>>
>> So I would like to be allowed to create checks on empty hostgroups,
>> and of course if the hostgroup is empty, no check is done.
>>
>> Is there something technically in the nagios core that prevents
>> creating empty hostgroups
>
> No, but when a service is assigned to a hostgroup, that hostgroup
> is already expanded (and found to contain zero hosts), so the service
> is assigned to no host at all, but still doesn't have "register 0"
> in it, so it's a faulty service.
>
>> or is it an arbitrary configuration check
>> because it's assumed that a user probably doesn't want to check a
>> service on a empty hostgroup ?
>>
>> I find this configuration approach very convenient so I hope it's the
>> second answer ! :-)
>>
>
> It's a bit of both actually. You'd need to submit a patch to get Nagios
> to accept services linking to empty hostgroups though.
>
> --
> Andreas Ericsson [email protected]
> OP5 AB www.op5.se
> Tel: +46 8-230225 Fax: +46 8-230231
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php? ... =100&url=/
> _______________________________________________
> Nagios-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/lis ... gios-devel
>



--
L.B.

------=_Part_113405_11789644.1226403818337
Content-Type: text/x-patch; name=hostgroup_empty.patch
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fnegnj3f0
Content-Disposition: attachment; filename=hostgroup_empty.patch

IyBkaWZmIC1OcnUgbmFnaW9zLTMuMC41L3hkYXRhL3hvZHRlbXBsYXRlLmMgbmFnaW9zLTMuMC41
X2hvc3Rncm91cGVtcHR5L3hkYXRhL3hvZHRlbXBsYXRlLmMgCi0tLSBuYWdpb3MtMy4wLjUveGRh
dGEveG9kdGVtcGxhdGUuYwkyMDA4LTA2LTIzIDIzOjQzOjIyLjAwMDAwMDAwMCArMDIwMAorKysg
bmFnaW9zLTMuMC41X2hvc3Rncm91cGVtcHR5L3hkYXRhL3hvZHRlbXBsYXRlLmMJMjAwOC0xMC0y
OSAxNzozNzowMy4wMDAwMDAwMDAgKzAxMDAKQEAgLTUxNTMsMTIgKzUxNT

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked