Nagios 3 config ideas

configurationnagios

We currently have Nagios 2.9 installed and has been running nicely for a few years. I want to migrate it off that old Linux server onto a new one. I've gotten Nagios 3.1.2 installed and running fine. Before I migrate all 240+ of our devices over to the new install, I'm curious as to how other SysAdmins are configuring it.

I've heard of:
– Each host in its own config file with it's corresponding services, and you can copy then edit the file to easily add a new device, and all like devices in separate folders.
– All alike hosts in a single config file. With or Without all services in that same config file.
– All Hosts and services in one file. Then dependencies laid out in a separate file (our current config)

How are the Nagios config files arraigned in your system? I'd like to get differing ideas to make ours the most efficient it can be.

Best Answer

I recently divided files by business area, then into staging/production, but that required too much prior knowledge from other colleagues to just find something and change it. Also we moved some servers around and I realised it would be useful to have config-per-host files that could be moved as well. Also, having config-per-host allows you to neatly encapsulate all the monitoring for a particular host (or hostgroup) in one file, and see easily what you are doing for that host. On top of that we have a central commands.cfg file, divided up by each business area which can be easily searched.

However none of this is truly satisfactory - using flat-file storage for configuration commits you to favouring one particular ordering method over another. This sort of configuration really benefits from the relational model. Most new monitoring products have implemented configuration from a database for this reason, I guess.

Currently NDOUtils (warning: pdf) gets your config and event data into a database, but as far as I know there's no way to tell Nagios to use that database as config source. It does give you the opportunity to create tables aside from those required by NDOUtils, perhaps creating a separate nagios_config database where you can map things out and then script up a solution that pulls this information out of the database and creates your config.

I'm going to try and use Puppet to generate my Nagios configs in the near future, hopefully it will let me resolve these sorts of issues.