configuration directory
AL13N
alien at rmail.be
Wed Sep 11 12:43:26 CEST 2013
> On 2013-09-04 17:23, AL13N wrote:
>>> On 2013-09-04 12:51, AL13N wrote:
>> [...]
>>> No. All variables from one file should be parsed before any variables
>>> from a different file, but the include-files from one file get parsed
>>> before we move along to the next file in that directory.
>>>
>>> If we pretend that /etc/nagios/conf.d contains two files, named A.cfg
>>> and B.cfg, where A.cfg has "include=/etc/nagios/perfdata.cfg" and the
>>> main nagios config file is /etc/nagios/nagios.cfg, but one also wants
>>> to oneshot parse /etc/nagios/debug.cfg, then one would execute Nagios
>>> like so:
>>>
>>> nagios -d /etc/nagios/nagios.cfg /etc/nagios/debug.cfg
>>>
>>> and with the above settings we would parse
>>> /etc/nagios/nagios.cfg nagios.cfg (all settings)
>>> /etc/nagios/conf.d/A.cfg (all settings)
>>> /etc/nagios/perfdata.cfg (all settings)
>>> /etc/nagios/conf.d/B.cfg (all settings)
>>> /etc/nagios/debug.cfg (all settings)
>>>
>>> In practice though, I expect the default settings will be so that
>>> /etc/nagios/nagios.cfg contains this:
>>> include=/etc/nagios/defaults.cfg
>>> include=/etc/nagios/conf.d
>>>
>>> Btw, we shouldn't error out when encountering an empty directory,
>>> but rather just print a warning about it. Or even have "include_dir"
>>> and "include_file", where both cause an error if the targeted path
>>> doesn't exist, although we allow empty directories.
>>
>> i think there's a include_dir for hosts and such? or it might be named
>> differently.
>>
>
> There's "cfg_dir".
>
>> i think one include= setting is enough to check file and dir, and empty
>> dir shouldn't get an error... i don't think it needs a warning, since it
>> will often be used in this way, where the user can add stuff in an empty
>> directory.
>>
>
> True that. Nonexisting path should be an error though.
>
>>> I just realized that this includes the "parse multiple config files
>>> from command-line", but since that's hardly a difficult issue once
>>> we can parse multiple config files, I doubt that's a problem.
>>
>> this is what i figured first, so i thought it would not be needed to
>> have
>> an extra setting that includes other files/dirs.
>>
>> my original thought was to:
>> A) allow multiple files on command line
>> B) allow them to be directories too (expanding to multiple files)
>>
>> then there would be no real need for include= statement, and it would be
>> a
>> less intrusive (and less work) patch.
>>
>
> True that. And I supposed adding the include statements later wouldn't
> be that much work, so whatever you're comfortable implementing would be
> great.
>
>> the distro will likely choose what files/dirs to be used in what order
>> (and put this in the initscript/service file), so i figured that this
>> would be enough.
>>
>
> Yea, probably.
ok so:
A) allow multiple config files
B) allow files to be directories (empty directories are ok, but
nonexistant directories are not) and implement code to parse files in the
directories
C) allow include= config statements to have files/directories to be parsed
immediately after completion of current file.
I got started on A) and came upon:
http://sourceforge.net/p/nagios/nagioscore/ci/master/tree/base/nagios.c#l378
where optind seems to be undefined in the whole file. (i did see an
option_index variable initialized at 0).
this seems like an oversight... is it?
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
More information about the Developers
mailing list