Configuring Nagios


Configuration Overview

There are several different configuration files that you're going to need to create or edit before you start monitoring anything. They are described below...

Main Configuration File

The main configuration file (usually /usr/local/nagios/etc/nagios.cfg) contains a number of directives that affect how Nagios operates. This config file is read by both the Nagios process and the CGIs. This is the first configuration file you're going to want to create or edit.

Documentation for the main configuration file can be found here.

A sample main configuration file is generated automatically when you run the configure script before compiling the binaries. Look for it either in the distribution directory or the etc/ subdirectory of your installation. When you install the sample config files using the make install-config command, a sample main configuration file will be placed into your settings directory (usually /usr/local/nagios/etc). The default name of the main configuration file is nagios.cfg.

Resource File(s)

Resource files can be used to store user-defined macros. Resource files can also contain other information (like database connection settings), although this will depend on how you've compiled Nagios. The main point of having resource files is to use them to store sensitive configuration information and not make them available to the CGIs.

You can specify one or more optional resource files by using the resource_file directive in the main configuration file.

Object Configuration Files

Object configuration files (historically called "host" configuration files) are used to define hosts, services, hostgroups, contacts, contactgroups, commands, etc. This is where you define what things you want monitor and how you want to monitor them.

Documentation for the object configuration files can be found here.

CGI Configuration File

The CGI configuration file (usually /usr/local/nagios/etc/cgi.cfg) contains a number of directives that affect the operation of the CGIs.

Documentation for the CGI configuration file can be found here.

A sample CGI configuration file is generated automatically when you run the configure script before compiling the binaries. When you install the sample config files using the make install-config command, the CGI configuration file will be placed in the same directory as the main and host config files (usually /usr/local/nagios/etc). The default name of the CGI configuration file is cgi.cfg.

Extended Information Configuration Files

Extended information configuration files are used to define additional information for hosts and services that should be used by the CGI. This is where you define things like drawing coordinates, pretty icons, etc.

Documentation for the extended information configuration files can be found here.