sugested update for location.h.in

Marcel J.E. Mol marcel at mesa.nl
Thu Oct 14 19:44:12 CEST 2010


On Thu, Oct 14, 2010 at 04:54:25PM +0200, Andreas Ericsson wrote:
> On 10/14/2010 04:05 PM, Marcel J.E. Mol wrote:
> > On Thu, Oct 14, 2010 at 10:56:56AM +0200, Andreas Ericsson wrote:
> >> On Wed, Oct 13, 2010 at 9:47 PM, Marcel J.E. Mol<marcel at mesa.nl>  wrote:
> >>> Hello,
> >>>
> >>> My first post to the list... I just started playing with nagios and doing
> >>> some test developments. For this I need the location of the directory
> >>> where all config files reside. I noticed that all config files are defined
> >>> with absolute paths and the config directory itself is not defined.
> >>>
> >>> It like to suggest a change to location.h.in so I can define new config
> >>> files within a single source file without needing to update other nagios
> >>> core files.  The patch is attached. It just adds a DEFAULT_CONFIG_DIR
> >>> define to location.h.in.
> >>>
> >>
> >> The default value for that macro would cause Nagios to recursively search
> >> all of /etc for files ending with .cfg.
> > 
> > I think you mistake this with the runtime definition with of cfg_dir in
> > nagios.cfg.
> > 
> > The suggested define in location.in.h is only a compile time
> > definition. It allows me to create new source files, say myproject.c
> > and in it do something like
> > 
> >    fp = open(DEFAULT_CONFIG_DIR "myproject.cfg");
> > 
> > without tampering other nagios source files while being flexible at where
> > the config files reside.  In the current situation I need to create a
> > file that is processed by the configure step to set the correct place
> > for config files.
> > 
> 
> Ah, you're right. I misread @sysconfdir@ after having browsed a bunch of
> RPM specfiles, so %_sysconfdir was stuck in my head.
> 
> Anyways. Doing something similar but making it a runtime option in
> nagios.cfg seems like a far better solution for longterm maintenance.
> That would also give module authors an easy place to stash their
> broker_module=/path/to/module args
> as well.

You mean to introduce a sort of get_config_dir() call in the core?

> If you're talking about randomly adding features to the Nagios core,
> that requires configuration files of its own, I'll wait with accepting

I'm actually playing with the googlemap statusmap, converting it
to googles api3. It uses a additional config file location.cfg.

If you accept googlemap in the core later on the stuff in location.cfg could
be moved to host definitions, but for now I'd like to have the seperate 
config file in the defautl config dir...

> this patch until I see how it can be useful for other people as well,
> without just being a macro that isn't used anywhere in the code. Such
> macros are subject to removal unless they are in the NEB* category and
> are designed for neb modules to use.
> 
> At the very least, this patch should remake the DEFAULT_CONFIG_FILE
> macro to reuse the DEFAULT_CONFIG_DIR macro.

I was considering mentioning this in the first post :)


-Marcel
-- 
     ======--------         Marcel J.E. Mol                MESA Consulting B.V.
    =======---------        ph. +31-(0)6-54724868          P.O. Box 112
    =======---------        marcel at mesa.nl                 2630 AC  Nootdorp
__==== www.mesa.nl ---____U_n_i_x______I_n_t_e_r_n_e_t____ The Netherlands ____
 They couldn't think of a number,           Linux user 1148  --  counter.li.org
    so they gave me a name!  -- Rupert Hine  --  www.ruperthine.com

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb




More information about the Developers mailing list