4
Jan/10
2

Nagios Configuration

Nagios is configured through plain text files with a special syntax. There are two types configuration files in Nagios 3.x.

There are the main configuration files which control the behavior of the single components. For example the nagios.cfg which controlls the Nagios Daemon. The cgi.cfg is used to configure the CGI based web frontend. Another special file is the resource.cfg which can be used to configure general options which should be available in the object configuration files.

The second type of Nagios configuration files are the object configuration files. These files are used to add objects like hosts, services, hostgroups, servicegroups, commands, timeranges and so on.

More information about this can be found in the Official Nagios Documentation.

nagios.cfg

The nagios.cfg uses a simple syntax: key=value. Comment lines begin with a #.

The default nagios configuration file which is created when executing make install-config. The nagios.cfg contains many comments with useful information about the single configuration options.

All important information like the place of the configuration files is set in the nagios.cfg file. So this file is the central place to control the configuration of Nagios.

The Nagios Documentation is very complete at this place.

Nagios Object Configuration Files

The object configuration files are fetched like configured in the nagios.cfg file. These object configuration files can be fetched using the cfg_file for single files and the cfg_dir option to add all files in a directory.

The Nagios Documentation is very complete at this place so I won’t write anymore about the syntax of these files.

Flexible object configuration concept

While a Nagios installation grows many Nagios administrators recognize the number of objects strongly grows and grows too. Without a clear and flexible concept for managing the Nagios object configurations growing Nagios installations will end up in pure chaos.

Starting with Nagios it is very hard to find the best concept for the object configurations for the specific Nagios environment. So if you start from scratch with your Nagios installation without any previous knowledge about Nagios I strongly recommend to plan some time for a redesign of the complete configuration after some time.

If you learned you first lessons using Nagios you will recognize there are several ways to make your Nagios configuration more flexible and more compact that it can be administrated easier. At this stage most professional Nagios users define some laws for the specific Nagios installations. These rules may begin with object naming concepts and end up with complex object management standards.

Just some basic topics you should think about when optimizing your object configurations:

  • Use templates (Object Inheritance) to assign common options
  • Use templates assign groups
  • Use hostgroups to assign services to a group of hosts
  • Use default wildcards like the * or ! to match objects when assigning to each other
  • Use real regular expressions to assign objects to each other

The above listed sentences are just some examples in which ways Nagios configurations may be tuned. There are a lot of other options you have.

Nagios Configuration Tools

There are a lot of different other approaches to make the configuration of Nagios easier. Most of these solutions are web based configuration tools. All these tools have the disadvantage that they cut down the choices what and how to handle the configuration in different ways.

Most of the Nagios Configuration Utitilies use own databases where the Nagios Configuration is being modified. When a modification has been finished the configuration is parsed from the database into Nagios Configuration Files. After that the Nagios process is being restarted with the new configuration. This adds the disadvantage that modifications to that configuration files will be overwritten each time the configuration is parsed. So even experienced Nagios administrators need to use that web based configuration utility.

For some Nagios configuration utilities take a look at the Nagios Addons page.

Filed under: Nagios
Comments (0) Trackbacks (2)