cfg_dir recursion not working

Ethan Galstad nagios at nagios.org
Tue Aug 2 15:25:06 CEST 2005


Thanks for the patch on this - it will be in CVS shortly.

On 26 Jul 2005 at 8:29, Christian Theil wrote:

> Hi
> 
> It seems the that the intention of cfg_dir is to include directories
> recursively, but that it is broken. The code is there in
> xodtemplate.c, but apparently buggy. If you change the line as
> indicated by the diff below it should work... (there are still some
> problems if you use symbolic links within your directory structure
> though).
> 
> $diff xodtemplate.c ../../../tmp/nagios/xdata/xodtemplate.c
> 
> 422c422
> <                               x=stat(config_file,&stat_buf);
> ---
> >                               x=stat(dirfile->d_name,&stat_buf);
> 
> Best regards,
> Christian Theil Have.
> 
> 
> On 7/14/05, Dr. Dave Blunt <dblunt at itgroundwork.com> wrote:
> >
> > Unfortunately that's not what the 2.0 documentation says...  From
> > http://nagios.sourceforge.net/docs/2_0/configmain.html#cfg_dir I
> > quote:
> >
> > "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. Additionally, Nagios will recursively process all
> > config files in subdirectories of the directory you specify here.
> > You can seperate your configuration files into different directories
> > and specify multiple cfg_dir= statements to have all config files in
> > each directory processed."
> >
> > Note the reference 'recursively process all config files in
> > SUBDIRECTORIES of the directory you specify here'.
> >
> > If that's a mistake then maybe the docs need to be updated but from
> > a look at the code, it seems like it *should* recurse directories
> > until it exhausts it's search for config files or runs out of
> > resources to do so.
> >
> > -----Original Message-----
> > From: Subhendu Ghosh [mailto:sghosh at sghosh.org]
> > Sent: Thursday, July 14, 2005 9:49 AM
> > To: Dr. Dave Blunt
> > Cc: nagios-devel at lists.sourceforge.net
> > Subject: RE: [Nagios-devel] cfg_dir recursion not working
> >
> > cfg_dir will not recurse into sub-dirs.
> > cfg_dir is used to read all "files" in the specified dir.
> >
> > On Thu, 14 Jul 2005, Dr. Dave Blunt wrote:
> >
> > >
> > > Indeed the files I want to include are all
> > > /usr/local/nagios/etc/rps/*/*.cfg.  There are other files in those
> > > subdirs such as tar.gz files.
> > >
> > > It's SuSE ES 9 and /usr/include/dirent.h is present.  :(
> > >
> > >
> > > Andreas Ericsson wrote:
> > >> I have an install with a number of Nagios configs files stored
> > >> under subdirectories:
> > >>
> > >> /usr/local/nagios/etc/rps/<dir1>/acfgfile
> > >> /usr/local/nagios/etc/rps/<dir2>/anothercfgfile
> > >> /usr/local/nagios/etc/rps/<dir3>/yetanothercfgfile
> > >> .
> > >> .
> > >
> > > I suppose the files all match the glob(3) pattern
> > > /usr/local/nagios/etc/rps/*/*.cfg
> > > Otherwise, that's possibly the issue right there.
> > >
> > >> .
> > >>
> > >> There are no valid cfg files in /usr/local/nagios/etc/rps.  All
> > >> services
> > > and
> > >> hosts are defined in the cfg files under <dir1>, <dir2>, <dir3>
> > >> etc.
> > >>
> > >> When I define:
> > >>
> > >>   cfg_dir=/usr/local/nagios/etc/rps
> > >>
> > >> in nagios.cfg the preflight check comes back with errors saying
> > >> it can't find any hosts or services.
> > >>
> > >
> > >
> > > Are you running this on a Solaris or AIX platform? I think
> > > recursion only works on system that has the <dirent.h> header
> > > file, and that one isn't present on all unices.
> > >
> > >
> >
> > --
> > -sg
> >
> >
> >
> >
> > -------------------------------------------------------
> > SF.Net email is sponsored by: Discover Easy Linux Migration
> > Strategies from IBM. Find simple to follow Roadmaps, straightforward
> > articles, informative Webcasts and more! Get everything you need to
> > get up to speed, fast.
> > http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> > _______________________________________________ Nagios-devel mailing
> > list Nagios-devel at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nagios-devel
> >
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id 492&opÀick
> _______________________________________________ Nagios-devel mailing
> list Nagios-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
> 
> 



Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click




More information about the Developers mailing list