Questions re: nagios3 config file parser behavior, so I can better mange nagios config under version control:
Do all nagios3 config files allow redefinition of config defaults using last-seen-wins?
Do all default config directives need to be present in /etc/nagios* to have effect? Or are they defined under the packaged nagios source files?
I use nagios3-3.5.1.dfsg-2.1ubuntu1 on ubuntu 16.04.
Thanks.
nagios3 config file default and override handling
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: nagios3 config file default and override handling
From what repo did you install Nagios? If it is not ours, then you are probably better off talking to the package maintainer.
Re: nagios3 config file default and override handling
Thanks, This package nagios3-3.5.1.dfsg-2.1ubuntu1 on ubuntu 16.04 is from the ubuntu repository.
Perhaps I can restate my questions more clearly to focus on nagios config file semantics and not packaging.
1. If a directive appears in a default nagios config file, e.g.
Can I leave that in directive as is, then override it with a different value for cfg_dir later in the file or included files?
If so, Is redefinition-allowed, last-seen-wins the rule 100% throughout nagios?
2. If for example cfg_dir was not defined in any of those files under /etc, are there inherent nagios defaults for settings like cfg_dir?
If so, do all critical settings have defaults?
Some software has default config under /etc which consists entirely of commented settings illustrating the inherent defaults. I'm wondering if Nagios has the same.
Thanks.
Perhaps I can restate my questions more clearly to focus on nagios config file semantics and not packaging.
1. If a directive appears in a default nagios config file, e.g.
Code: Select all
In /etc/nagios3/nagios.cfg:
cfg_dir=/etc/nagios3/conf.dIf so, Is redefinition-allowed, last-seen-wins the rule 100% throughout nagios?
2. If for example cfg_dir was not defined in any of those files under /etc, are there inherent nagios defaults for settings like cfg_dir?
If so, do all critical settings have defaults?
Some software has default config under /etc which consists entirely of commented settings illustrating the inherent defaults. I'm wondering if Nagios has the same.
Thanks.
Re: nagios3 config file default and override handling
I'll try my best to answer this for the Nagios related parts, but some of it actually is package related since it has been changed.
cfg_dir= can be called to as many different times as you wanted. You could set up your nagios.cfg like this (where ... represents other parts of the config file) -
This would tell Nagios to look for configurations in both the /etc/nagios3/conf.d/hosts/ and /etc/nagios3/conf.d/services/ for any object definitions. You could also change this to something like -
The only important thing is that the user running nagios can access the files here.
I'm not sure exactly what you're asking here, but I'll try to explain.Can I leave that in directive as is, then override it with a different value for cfg_dir later in the file or included files?
If so, Is redefinition-allowed, last-seen-wins the rule 100% throughout nagios?
cfg_dir= can be called to as many different times as you wanted. You could set up your nagios.cfg like this (where ... represents other parts of the config file) -
Code: Select all
...
cfg_dir=/etc/nagios3/conf.d/hosts/
cfg_dir=/etc/nagios3/conf.d/services/
...
Code: Select all
...
cfg_dir=/path/to/my/dir/hosts/
...
No. As for settings have defaults, and others don't - this is a pretty broad question so I'm not sure how to answer it further.2. If for example cfg_dir was not defined in any of those files under /etc, are there inherent nagios defaults for settings like cfg_dir?
The package you mentioned is configured for /etc/nagios3/, where as our default core installs actually use the /usr/local/nagios/ path. This gets into not knowing completely what paths are being used. Core can be compiled however you want, and you can change up the paths as needed. See this guide for a source install instructions - https://support.nagios.com/kb/article.p ... ategory=58Some software has default config under /etc which consists entirely of commented settings illustrating the inherent defaults. I'm wondering if Nagios has the same.
Former Nagios Employee