Search This Blog

Saturday, February 22, 2014

Nagios / Icinga Configuration with NConf - a Graphical Web / Database Tool

NConf is a web-based graphical configuration tool for Nagios/Icinga objects.  It uses a small MySQL database to store configurations information and provides scripted configuration files installation.
NConf Configuration Screen

NConf installation is straightforward.

  1. Copy and extract the NConf tarball to the web root directory and  change the ownership of the directory and its contents to the web server user (www-data).
  2. Browse to NConf at http://<servername>/nconf, where you will be prompted to initiate the installation.  The install first checks the installed packages and then prompts for the database configuration.  Since the database does not yet exist, create and populate it with PHPMyAdmin.  In this demonstration, I use the MySQL root user, but a live deployment should use a new user with limited privileges.
  3. Configure the base path and -- very importantly -- specify the location of the Nagios / Icinga executable binary.  NConf uses this to check its configurations.
  4. Configure application authorization.

Delete the INSTALL and UPDATE directories and INSTALL.php and UPDATE.php files.
NConf is now ready to use.




Migrating Existing Nagios /Icinga Configurations

NConf provides a script to migrate existing Nagios / Icinga definitions into its database, saving the administrator the task of manually recreating live configurations.  NConf can only import one type of object at a time, so all object configuration definitions must be placed in separate files.  This is not a difficult task using a text editor.  Once the configuration files are properly written for NConf, use the import utility as described below.

  1. Remove all Nagios / Icinga configuration files
  2. Use the "/bin/add_hosts_from_nagios.pl" script to import objects as described in the Nagios Import Documentation.
  3. Correct any import errors.  Expected and common errors are listed in the documentation.
  4. Deploy the configuration locally using the "/ADD-ONS/deploy_local.sh" script.





Adding a New Service Group with Five Services


Adding objects using the graphical interface is straightforward if you understand the structure of Nagios / Icinga configuration files.  Adding five Advanced Services (to check monitoring agents using tcp_checks) and assigning them to existing Host Groups and a new Service Group is demonstrated below.  44 new objects on 11 hosts result from the update.



Adding a New Service Group with Five Services Using Scripts

The NConf documentation states that the  "/bin/add_hosts_from_nagios.pl" script is intended for one-time use.  This overlooks the usefulness of the script for quickly creating new objects.  The experienced Nagios / Icinga administrator writes object configurations quickly and importing them from .cfg files can be faster than configuring them from the graphical interface.  It also allows as administrator to maintain preconfigured object definition files for large deployments.  For instance, if an enterprise upgrades its entire switch / router infrastructure, the administrator may configure object files in advance and deploy them as the equipment is installed. 

The video below demonstrates creating the same Advanced Services and Service Group objects as performed above using scripts.




NConf is a useful tool for maintaining and deploying configurations.  It is not a substitute for understanding the structure and optimization of object configuration files; it is complementary to that knowledge and experience.  In practice, graphical configuration with NConf and editing configuration files are is iterative and complementary.  NConf is particularly useful for renaming objects because any changes are updated globally throughout all configuration objects.  But the administrator must also be able to understand the file structure to optimize definitions.

No comments :

Post a Comment