Multiple Nagios Instances on a Single Server

In this post I will cover how to run Multiple Nagios Instances on a Single Server. This will take a single installation of Nagios and allow you to run separate instances as you would to separate out different environments, such as production, development, certification, etc….

It allows for flexibility of configurations and allows Nagios to run faster for checks and execution. This installation scenario is based on RedHat 5.x installation with Nagios 3.2.0, Nagios Plugins 1.4.13, Nagiosgraph, rrdtool and LDAP integration.


Download and Install Boutell’s GD library

Compile and install the Nagios and Plugins

Compile and install the Nagios plugins

File Copy and Directory Creation
Create directories which hold your instances and their subdirectories

Create Symbolic Links

Copy files

Do the same with all the other instances you are going to deploy.

In the editing of the Nagios config files there will be instances that point to a central shared location and to individual settings. The configurations that are shared are checkcommands.cfg, misccommands.cfg, contacts.cfg, contactgroups.cfg, timeperiods.cfg, templates.cfg, dependencies.cfg & escalations.cfg.
The individual ones are the specific monitors and hosts, which in the nagios.cfg we will state a directory instead of the individual configuration files.

nagios.cfg modifications


CGI.CFG File Edits

The cgi.cfg file must be edit for Apache to be able to run the correct CGI scripts for each instance you plan to run. To follow the examples in previous sections we use nagios_prod as our instance.

Resource.cfg file edits

Create nagios configuration for Apache
Create a nagios_prod.conf file in the /etc/httpd/conf.d directory with the following contents.
Note: this example uses ldap and the string will vary for your instance.


The file is located in the /usr/local/nagios/instances/nagios_prod/share/ directory. Make the path changes for the instance.


Correct Directory and File PermissionsAt this point it is a good time to correct the file and directory permissions to the correct owner. Nagios is very particular on the correct settings. This is a painful process and is a good candidate to dump in a script and ran.

Now the files

Create Monitors
At this point you can start the creation of the monitors, hosts, hostgroups, contacts. Contactgroups and all the other dependent settings. Refer to Nagios site for syntax on each of the different objects. Foe the monitors you can use the default monitors created at install in /usr/local/nagios/etc/objects and copy the configs for localhost.cfg and windows.cfg as a starting basis.
Once you have your settings completed you need to run a check on the configs running the command

Fix any errors at this point and recheck.

Startup Scripts (init.d)
Add Nagios to the list of system services and have it automatically start when the system boots.
Create init.d scripts for each instance you want to create. Copy the Nagios installed script, and name it nagios_prod. Open in your favorite editor and find the line prefix= and change the path.


Save the changes and change the permissions to 755 on the script.

Use chkconfig to add it to the startup and enable it.

At this point you can already start your instances:

Now restart your Apache and open your browser

NagiosGraph (Performance Monitoring)
This section explains how to configure Nagiosgraph for multiple instances to gathering and graphing performance data created by Nagios. Each of the steps will have to be done for each individual instance you want to collect and graph performance data with the exception of rrdtool and intltool installs, those are only required installed once.

intltool.x86_64 to 0.35 or higher

Update intltool.x86_64 to 0.35 or higher

Install rrdtool

Install NagiosGraph
Download NagiosGraph 1.3.1 from

Create the directory structure and copy files

Configuration file edits & file
Edit & and modify the lib path.

# The configuration file and must be in this directory.

Various CGI files
Edit the perl scripts in the cgi and lib directories, modifying the “use lib” for the following files in the /usr/local/nagios/instances/nagios_prod/sbin directory.


Change the following line.

Nagiosgraph.conf file
Edit nagiosgraph.conf change the following lines.

nagios.cfg file
Edit nagios.cfg and change /add.
Add the line

Modify the following lines.

checkcommands.cfg file
Add to your checkcommands.cfg file in the shared Nagios libexec directory

serviceextinfo.cfg file
Create serviceextinfo.cfg in /usr/local/nagios/instances/nagios_prod/etc/ and add the entries in for the performance data to graph. Refer to Nagios documentation on the syntax for the serviceextinfo.cfg file. This file will tell which service monitors you would like to collect performance data on.
Example entry:

Edit cgi.cfg and add line under main_config_file entry.

Map file
Edit the map file in usr/bin/perl /usr/local/nagios/instances/nagios_prod/etc directory. The default Nagiosgraph supplied one doesn’t have any Windows service map files. A good source for examples can be found at and has the basic map files needed for a good start.


Complete Install
Now that NagiosGraph is installed all that remains is to restart your Nagios instance and Apache and check the results.

I know this is a long and detailed article, but this can be done and has great benefit. If you would like a downloadable pdf of this post it is available Multiple_Nagios_instances_single_server.

One Response to “Multiple Nagios Instances on a Single Server”

  1. Eherr says:

    Following this to the T gets a lot of errors.

    Had to make my own mods and still cant get it to work.

    Any updates on this site?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.