Page 1 of 1

Using the same host configs in two Nagios 3.4.1 instances

Posted: Thu Jan 01, 2015 7:56 am
by mdsh
Hi,

I cannot imagine this is not normal - I have a small network to monitor, but it spans the country with a VPN.

The background to my question is that I have a Nagios server at each end of the network, so that I can continue to monitor the state of the services at each end even when the VPN is down.
I store my configuration in a Version Control System, so I really want to define each host once and use the same host, service, command & extinfo configuration at each end.

The issue I am facing is that the parents parameter of a host must be different for the two Nagios servers, at one end I will monitor host e via hosts b c & d, where as at the other end I will monitor host a via hosts d, c & b. The parents for b, c & d are different from the two Nagios monitoring servers.

My question is: what is the best way to reuse as much configuration as I can between the two Nagios servers?

I currently have two thoughts:

1) define all hosts as templates without parents. Then for each Nagios server define the actual hosts to 'use' the template host and set the parent correctly for that Nagios server. I have not tested this yet, but it seems OK in theory. Still, quite a lot of duplication in config files.

2) create my own definition of the network and write software to export the host configuration files for the two Nagios servers. Quite a lot of work for me, but no duplication of config files.

Are there options or tricks I have missed?

Thanks in advance.

Re: Using the same host configs in two Nagios 3.4.1 instance

Posted: Fri Jan 02, 2015 10:30 am
by tmcdonald
Strictly using Nagios I would go with option 1, but if you have something like Puppet or Chef to manage the configs then option 2 is much easier to deal with.

Re: Using the same host configs in two Nagios 3.4.1 instance

Posted: Fri Jan 02, 2015 10:42 am
by mdsh
Thanks for the confirmation that I haven't missed anything, and using option 1 is probably correct when only using the Nagios tool-set.

I have spent a couple of hours updating my configuration, to create template hosts and use of those templates with different parents on each Nagios server, and that does seem to be working as I hoped.

I think, even if i were to use option 2 - to write some software to create configuration files myself - I would still create template hosts and use those templates in software created configuration files.

Re: Using the same host configs in two Nagios 3.4.1 instance

Posted: Fri Jan 02, 2015 1:25 pm
by sreinhardt
I would agree, most likely you would end up going the template route anyway, as it's almost definitely the best route to go. Glad thats working for you, let us know if you run into further issues!