naemon-core icon indicating copy to clipboard operation
naemon-core copied to clipboard

Multiple directives per line in config

Open fermino opened this issue 1 year ago • 2 comments

Hi! I would like to implement the following syntax in the configuration files. At work we have a ton of hosts and it would simplify a lot of management. I am willing to implement it myself in the parser, but I want to discuss it here first so that the best syntax definition could be used and if it useful for others, maybe have it merged upstream.

define host{ host_name bla0037;  use template-bla }
define host{ host_name bla0042;  use template-bla }

https://serverfault.com/questions/737230/nagios-configuration-syntax-multiple-directives-per-line

Any thoughts? Thanks!

fermino avatar Jul 18 '24 18:07 fermino

tbh, i think it is a lot easier to fix the script which manages your hosts.

sni avatar Jul 18 '24 18:07 sni

I think this is a huge change and a lot of effort to implement. Not only do you need to modify the parser but also all test cases and example configs. All this effort to get a new config format, which is not a standard format and would require everyone to write its own parser. (Like with the current format)

With all this in mind, I would strongly recommend to patch your config generator. This will probably only take 1 or 2 hours while implementing a new config format will take days - and weeks to fix all edge cases.

Instead of patching the current parser I would suggest to add a new parser for a standard config format such as YAML, TOML, INI, JSON or whatever fits best. Naemon could use the file extension to determine which parser to use (.cfg go with current parser, .toml go with tomlc99 parser just to name an example). This way not only Naemon would benefit, but also all applications that deal with Naemon configuration files. Still a lot of effort.

Maybe you could explain a bit more what issues you are facing with the current format and why a new formation would simplify a lot of management.

nook24 avatar Jul 19 '24 07:07 nook24

i am closing this, i don't think this will happen any time soon.

sni avatar Aug 21 '25 07:08 sni