sugested update for location.h.in

Andreas Ericsson ae at op5.se
Thu Oct 14 16:54:25 CEST 2010


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.

If you're talking about randomly adding features to the Nagios core,
that requires configuration files of its own, I'll wait with accepting
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.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
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