After you’ve figured out the underlying reason of the “object-oriented” configuration, you will enjoy Nagios’ flexibility and you may brush construction

2.2 Setup overview

Nagios configuration may look overly complicated at first glance; even the documentation warns that Nagios is quite powerful and flexible, but it can take a lot of work to get it configured just the way you’d like . Anyway, don’t despair! For the first tests, you can start by tweaking the sample configuration files contained in the /usr/local/share/examples/nagios/ directory, customizing them to your needs.

  • comments start with a “#” character and span to the end of the line;
  • varying names need certainly to begin in the very beginning of the line (we.e. no indentation welcome);
  • varying labels was situation delicate;
  • no spaces are allowed around the “=” sign.

Setup comes to form multiple parameters regarding monitoring daemon, the CGIs and, definitely, the fresh new servers and you may services we wish to monitor. All of this data is pass on certainly one of several files: we will now take a look at her or him one by one.

2.2.step one Area of the configuration file

The overall behaviour of the Nagios daemon is determined by the directives included in the main configuration file, /var/www/etc/nagios/nagios.cfg. Though this file contains several dozens of parameters, for most of them the default value is the most reasonable option and you will probably want to care about only very few of them (usually cfg_file, cfg_dir and admin_current email address). In any case, you can find a detailed description of each and every parameter in the official documentation.

dos.dos.dos The new resource file

The allows you to assign values to blk sign up the user-definable macros “$Associate n $” (where n is a number between 1 and 32 inclusive). Basically, in Nagios, macros are variables (starting and ending with a dollar sign, “$“) that you can insert into command definitions and that will get expanded to the appropriate value immediately prior to the execution of the command. User-defined macros (and the several other macros Nagios makes available) allow you to keep command definitions generic and simple (see the next chapter for some examples).

User-defined macros are normally used to store recurring items in command definitions (like directory paths) and sensitive information (like usernames and passwords). It is recommended that you set restrictive permissions (600) on the resource file(s) in order to keep sensitive information protected.

The next step is configuring target data, that’s perhaps the trickiest area of the arrangement. We shall hence input the following part totally to this procedure.

3.0 Target data setup

So now it is time to give Nagios things to remain tabs on. For this reason, we must supply it with information on the:

  • whenever and how to perform checks and you will send out notifications;
  • which so you can notify;
  • which hosts and you will functions to monitor.

All this information is represented by means of , which are defined by a set of “define” , enclosed in curly braces and containing a variable number of newline-separated , in keyword/value form. Keywords are separated from values by whitespace and multiple values can be separated by commas; indentation within statements is allowed.

Object definitions can be split into any number of files: just remember to list them all in the main configuration file by using the cfg_document and/or cfg_dir directives.

step three.step 1 Timeperiod meaning

The timeperiod statement allows you to specify, for each day of the week, one or more time slots in which to run certain checks and/or notify certain people. Time intervals can’t span across midnight and excluded days are simply omitted.

In the following example, all the timeperiod definitions are grouped together in a file named timeperiods.cfg stored in the /var/www/etc/nagios/ directory.

step three.dos Order definition

The next step is to tell Nagios how to perform the various checks and send out notifications; this is accomplished by defining multiple command objects specifying the actual commands for Nagios to run.