cfg_dir - not finding my file?

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
ethrbunny
Posts: 3
Joined: Sun Oct 06, 2013 6:56 am

cfg_dir - not finding my file?

Post by ethrbunny »

In 'nagios.cfg' I have the 'cfg_dir' set to '<nagios path>/etc/objects'. It seems to find the usual suspects just fine (hosts.cfg,services.cfg, etc). Today I added a file 'sans.cfg' with the same layout as my 'hosts.cfg' file but it isn't getting picked up. Is there another setting required to add new files like this?

No errors are shown at the validation. Nothing in the log file either.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: cfg_dir - not finding my file?

Post by slansing »

Have you tried explicitly defining that config name in the nagios.cfg? Just as shown above with hosts, services, etc? Then restart nagios after verifying your configs.
ethrbunny
Posts: 3
Joined: Sun Oct 06, 2013 6:56 am

Re: cfg_dir - not finding my file?

Post by ethrbunny »

I can do that - but it does seem to imply that 'cfg_dir' is not working properly.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: cfg_dir - not finding my file?

Post by slansing »

Defining the directory does not include all of the config files, you need to manually specify new ones that you create, such as:

Code: Select all

cfg_file=/usr/local/nagios/etc/servicegroups.cfg
cfg_file=/usr/local/nagios/etc/hosttemplates.cfg
cfg_file=/usr/local/nagios/etc/servicetemplates.cfg

Etc..
ethrbunny
Posts: 3
Joined: Sun Oct 06, 2013 6:56 am

Re: cfg_dir - not finding my file?

Post by ethrbunny »

Defining the directory does not include all of the config files, you need to manually specify new ones that you create
Then the docs need to be updated.
This directive is used to specify a directory which contains object configuration files that Nagios should use for monitoring. All files in the directory with a .cfg extension are processed as object config files.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: cfg_dir - not finding my file?

Post by slansing »

I'm not sure which doc you are referring to? Can you link it?
Locked