Page 1 of 1

Rationalising .cfg files in Nagios Core

Posted: Thu Jul 14, 2016 11:22 am
by neworderfac33
Good afternoon,

I now have a ridiculously large windows.cfg file which I would like to rationalize, with different groups of hosts spread over different .cfg files.

What I'd like to know is, do I have to define the services that will be used by the hosts in EACH .cfg file or can I place them in a separate .cfg file?

For example, say I have windows1.cfg and windows2.cfg, each containing a separate set of hosts, but with both sets of hosts needing to make use of the same services - do I have to define the services in both windows1.cfg and windows2.cfg or can I define them just once in a file called, say, services.cfg (obviously making sure that I add it to /usr/local/nagios/etc/nagios.cfg)?

As always, thanks in advance for your help.

Pete

Re: Rationalising .cfg files in Nagios Core

Posted: Thu Jul 14, 2016 11:31 am
by eloyd
You can split them however you want. Especially if you're using the nagios.cfg directive "cfg_dir" to include every *.cfg file in a specific directory. If not, you should use that. Then you can literally make one file per host one file per service one file per anything, and Nagios will just add them.

Generally, we do by host or by service, but Nagios doesn't care what file it read the configuration from. It reads them all and then parses them all at once.

Re: Rationalising .cfg files in Nagios Core

Posted: Thu Jul 14, 2016 1:30 pm
by tmcdonald
I typically tell people that the most important thing is documentation and consistently following it. You can split your configs however you want, and if you ask 10 different people how to do it you can get 10 different answers. But at the end of the day, the best thing you can do is to write it down and make sure that anyone who manages the configs follows that doc.

Re: Rationalising .cfg files in Nagios Core

Posted: Fri Jul 15, 2016 3:18 am
by neworderfac33
Thanks for confirming that, folks - much appreciated.

Pete

Re: Rationalising .cfg files in Nagios Core

Posted: Fri Jul 15, 2016 9:15 am
by tmcdonald
Not a problem. Mind if I close this out?

Re: Rationalising .cfg files in Nagios Core

Posted: Tue Jul 19, 2016 9:36 am
by neworderfac33
Yes please! :-)