naemon / naemon-core

Networks, Applications and Event Monitor
http://www.naemon.io/
GNU General Public License v2.0
151 stars 63 forks source link

Multiple directives per line in config #471

Open fermino opened 1 month ago

fermino commented 1 month ago

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!

sni commented 1 month ago

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

nook24 commented 1 month ago

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.