Page 1 of 1

Re: [Nagios-devel] cfg_dir recursive?

Posted: Mon May 05, 2008 10:32 am
by Guest
On May 3, 2008, at 2:20 PM, Tom Throckmorton wrote:
> Jo, could you cut and paste your relevant configuration bits for
> enabling the cfg_dir / cfg_file directives?

Sure. The first part of bone stock:

# You can split other types of object definitions across several
# config files if you wish (as done here), or keep them all in a
# single config file.
cfg_file=/d/nagios/etc/contactgroups.cfg
cfg_file=/d/nagios/etc/contacts.cfg
cfg_file=/d/nagios/etc/dependencies.cfg
cfg_file=/d/nagios/etc/escalations.cfg
cfg_file=/d/nagios/etc/hostgroups.cfg
cfg_file=/d/nagios/etc/hosts.cfg
cfg_file=/d/nagios/etc/servicegroups.cfg
cfg_file=/d/nagios/etc/service-template.cfg
cfg_file=/d/nagios/etc/services.cfg
cfg_file=/d/nagios/etc/timeperiods.cfg

There there is the custom part. The first line is commented out
because it doesn't work. If I use this and comment out the later
lines then none of the configuration files in these directories are
parsed.

# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:
#cfg_dir=/d/nagios/etc/customers
cfg_dir=/d/nagios/etc/customers/common
cfg_dir=/d/nagios/etc/customers/9617
cfg_dir=/d/nagios/etc/customers/9652
cfg_dir=/d/nagios/etc/customers/9669
cfg_dir=/d/nagios/etc/customers/9677
cfg_dir=/d/nagios/etc/customers/9691
cfg_dir=/d/nagios/etc/customers/9696
cfg_dir=/d/nagios/etc/customers/9698
cfg_dir=/d/nagios/etc/customers/9730
cfg_dir=/d/nagios/etc/customers/9736
cfg_dir=/d/nagios/etc/customers/9743

If I uncomment the first line and comment out the later lines, I get
the following:

Performing sanity check of nagios configuration: FAILED

Nagios 2.9
Copyright (c) 1999-2007 Ethan Galstad (http://www.nagios.org)
Last Modified: 04-10-2007
License: GPL

Reading configuration data...

Error: Servicegroup has no members (config file '/d/nagios/etc/
servicegroups.cfg', starting on line 6)

This is a hint, because every service defined in these subdirectories
is a member of that group. If I manually add a static service to
that group, the error goes away but none of the hosts or services
defined in those subdirectories appear in the configuration.

--
Jo Rhett
Net Consonance : consonant endings by net philanthropy, open source
and other randomness







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