2014-02-05 15:53:22 +01:00
|
|
|
## <a id="setting-up-icinga2"></a> Setting up Icinga 2
|
2013-09-26 14:01:29 +02:00
|
|
|
|
2013-10-02 09:50:26 +02:00
|
|
|
First of all you will have to install Icinga 2. The preferred way of doing this
|
|
|
|
is to use the official Debian or RPM package repositories depending on which
|
|
|
|
operating system and distribution you are running.
|
2013-09-26 14:01:29 +02:00
|
|
|
|
|
|
|
Distribution |Repository URL
|
|
|
|
------------------------|---------------------------
|
|
|
|
Debian |http://packages.icinga.org/debian/
|
2013-10-09 17:07:28 +02:00
|
|
|
Ubuntu |http://packages.icinga.org/ubuntu/
|
2013-09-26 14:01:29 +02:00
|
|
|
RHEL/CentOS 5 |http://packages.icinga.org/epel/5/release/
|
|
|
|
RHEL/CentOS 6 |http://packages.icinga.org/epel/6/release/
|
2013-10-09 17:07:28 +02:00
|
|
|
OpenSUSE 12.3 |http://packages.icinga.org/openSUSE/12.3/release/
|
|
|
|
SLES 11 SP3 |http://packages.icinga.org/SUSE/sles11-sp3/release/
|
2013-09-26 14:01:29 +02:00
|
|
|
|
|
|
|
Packages for distributions other than the ones listed above may also be
|
|
|
|
available. Please check http://packages.icinga.org/ to see if packages
|
2014-03-09 22:30:56 +01:00
|
|
|
are available for your favourite distribution.
|
2013-09-26 14:01:29 +02:00
|
|
|
|
2013-10-09 17:07:28 +02:00
|
|
|
> **Note**
|
|
|
|
>
|
2013-10-20 12:52:26 +02:00
|
|
|
> RHEL/CentOS 5 packages require the [EPEL repository](http://fedoraproject.org/wiki/EPEL)
|
|
|
|
> enabled (which provides the `boost141` package). SLES 11 SP3 and older versions
|
2013-10-21 21:03:35 +02:00
|
|
|
> require the `boost_1_54_0` package (available on http://packages.icinga.org).
|
2013-10-02 09:50:26 +02:00
|
|
|
|
2013-10-01 12:59:02 +02:00
|
|
|
You can install Icinga 2 by using your distribution's package manager
|
2013-10-11 14:45:24 +02:00
|
|
|
to install the `icinga2` package.
|
|
|
|
|
|
|
|
> **Note**
|
|
|
|
>
|
|
|
|
> On RHEL/CentOS and SLES you will need to use `chkconfig` to enable the
|
|
|
|
`icinga2` service. You can manually start Icinga 2 using `/etc/init.d/icinga2
|
|
|
|
start`.
|
|
|
|
|
|
|
|
Some parts of Icinga 2's functionality are available as separate packages:
|
2013-10-02 09:50:26 +02:00
|
|
|
|
|
|
|
Name | Description
|
|
|
|
------------------------|--------------------------------
|
|
|
|
icinga2-ido-mysql | IDO provider module for MySQL
|
2013-10-01 12:59:02 +02:00
|
|
|
|
2013-09-26 14:01:29 +02:00
|
|
|
In case you're running a distribution for which Icinga 2 packages are
|
2013-09-27 10:44:24 +02:00
|
|
|
not yet available you will have to use the release tarball which you
|
|
|
|
can download from the [Icinga website](https://www.icinga.org/). The
|
2013-10-07 09:35:44 +02:00
|
|
|
release tarballs contain an `INSTALL` file with further instructions.
|
2013-09-26 14:01:29 +02:00
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
### <a id="installation-paths"></a> Installation Paths
|
2013-09-27 07:19:13 +02:00
|
|
|
|
2013-09-26 14:01:29 +02:00
|
|
|
By default Icinga 2 uses the following files and directories:
|
|
|
|
|
2013-10-02 09:50:26 +02:00
|
|
|
Path | Description
|
2013-09-26 14:01:29 +02:00
|
|
|
------------------------------------|------------------------------------
|
2013-10-02 09:50:26 +02:00
|
|
|
/etc/icinga2 | Contains Icinga 2 configuration files.
|
|
|
|
/etc/init.d/icinga2 | The Icinga 2 init script.
|
2013-10-21 21:03:35 +02:00
|
|
|
/usr/bin/icinga2-* | Migration and certificate build scripts.
|
|
|
|
/usr/sbin/icinga2* | The Icinga 2 binary and feature enable/disable scripts.
|
2013-10-02 09:50:26 +02:00
|
|
|
/usr/share/doc/icinga2 | Documentation files that come with Icinga 2.
|
|
|
|
/usr/share/icinga2/itl | The Icinga Template Library.
|
|
|
|
/var/run/icinga2 | PID file.
|
2013-10-10 16:55:59 +02:00
|
|
|
/var/run/icinga2/cmd | Command pipe and Livestatus socket.
|
2013-10-02 09:50:26 +02:00
|
|
|
/var/cache/icinga2 | Performance data files and status.dat/objects.cache.
|
2014-02-21 09:31:37 +01:00
|
|
|
/var/spool/icinga2 | Used for performance data spool files.
|
|
|
|
/var/lib/icinga2 | Icinga 2 state file, cluster feature replay log and configuration files.
|
2013-10-21 21:03:35 +02:00
|
|
|
/var/log/icinga2 | Log file location and compat/ directory for the CompatLogger feature.
|
2013-09-26 14:01:29 +02:00
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
### <a id="icinga2-conf"></a> icinga2.conf
|
2013-09-27 07:19:13 +02:00
|
|
|
|
2013-10-07 09:35:44 +02:00
|
|
|
An example configuration file is installed for you in `/etc/icinga2/icinga2.conf`.
|
2013-09-26 14:01:29 +02:00
|
|
|
|
2013-10-10 16:55:59 +02:00
|
|
|
Here's a brief description of the example configuration:
|
2013-09-26 14:01:29 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Icinga 2 configuration file
|
|
|
|
* - this is where you define settings for the Icinga application including
|
|
|
|
* which hosts/services to check.
|
|
|
|
*
|
2013-10-02 13:56:50 +02:00
|
|
|
* For an overview of all available configuration options please refer
|
|
|
|
* to the documentation that is distributed as part of Icinga 2.
|
2013-09-26 14:01:29 +02:00
|
|
|
*/
|
|
|
|
|
2013-09-27 08:22:26 +02:00
|
|
|
Icinga 2 supports [C/C++-style comments](#comments).
|
2013-09-26 14:01:29 +02:00
|
|
|
|
|
|
|
include <itl/itl.conf>
|
|
|
|
|
2013-10-07 09:35:44 +02:00
|
|
|
The `include` directive can be used to include other files. The `itl/itl.conf`
|
2013-09-27 08:22:26 +02:00
|
|
|
file is distributed as part of Icinga 2 and provides a number of useful templates
|
|
|
|
and constants you can use to configure your services.
|
2013-09-26 14:01:29 +02:00
|
|
|
|
2013-09-27 11:48:20 +02:00
|
|
|
/**
|
|
|
|
* The features-available directory contains a number of configuration
|
|
|
|
* files for features which can be enabled and disabled using the
|
2013-10-18 22:11:40 +02:00
|
|
|
* icinga2-enable-feature / icinga2-disable-feature tools. These two tools work by creating
|
2013-09-27 11:48:20 +02:00
|
|
|
* and removing symbolic links in the features-enabled directory.
|
|
|
|
*/
|
|
|
|
include "features-enabled/*.conf"
|
|
|
|
|
|
|
|
This include directive takes care of including the configuration files for all
|
2013-10-18 22:11:40 +02:00
|
|
|
the features which have been enabled with `icinga2-enable-feature`. See
|
2013-09-27 11:48:20 +02:00
|
|
|
[Enabling/Disabling Features](#features) for more details.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Although in theory you could define all your objects in this file
|
2013-11-29 10:39:48 +01:00
|
|
|
* the preferred way is to create separate directories and files in the conf.d
|
2013-09-27 11:48:20 +02:00
|
|
|
* directory.
|
|
|
|
*/
|
2013-11-29 10:39:48 +01:00
|
|
|
include_recursive "conf.d" "*.conf"
|
2013-09-27 11:48:20 +02:00
|
|
|
|
2013-10-07 09:35:44 +02:00
|
|
|
You can put your own configuration files in the `conf.d` directory. This
|
2013-09-27 11:48:20 +02:00
|
|
|
directive makes sure that all of your own configuration files are included.
|
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
### <a id="macros-conf"></a> macros.conf
|
2013-09-27 11:48:20 +02:00
|
|
|
|
2013-10-07 09:35:44 +02:00
|
|
|
The `conf.d/macros.conf` file can be used to define global macros:
|
2013-09-27 11:48:20 +02:00
|
|
|
|
2013-09-26 14:01:29 +02:00
|
|
|
/**
|
|
|
|
* Global macros
|
|
|
|
*/
|
|
|
|
set IcingaMacros = {
|
|
|
|
plugindir = "/usr/local/icinga/libexec"
|
|
|
|
}
|
|
|
|
|
|
|
|
Icinga 2 lets you define free-form macros. The IcingaMacros variable can be used
|
|
|
|
to define global macros which are available in all command definitions.
|
|
|
|
|
2014-02-05 15:53:22 +01:00
|
|
|
### <a id="localhost-conf"></a> localhost.conf
|
2013-09-26 14:01:29 +02:00
|
|
|
|
2013-10-07 09:35:44 +02:00
|
|
|
The `conf.d/localhost.conf` file contains our first host definition:
|
2013-09-26 14:01:29 +02:00
|
|
|
|
|
|
|
/**
|
2013-10-01 15:59:25 +02:00
|
|
|
* A host definition. You can create your own configuration files
|
|
|
|
* in the conf.d directory (e.g. one per host). By default all *.conf
|
|
|
|
* files in this directory are included.
|
2013-09-26 14:01:29 +02:00
|
|
|
*/
|
|
|
|
object Host "localhost" {
|
|
|
|
services["ping4"] = {
|
2013-10-18 20:05:08 +02:00
|
|
|
templates = [ "generic-service" ],
|
|
|
|
|
2013-10-02 14:36:52 +02:00
|
|
|
check_command = "ping4"
|
2013-09-26 14:01:29 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
services["ping6"] = {
|
2013-10-18 20:05:08 +02:00
|
|
|
templates = [ "generic-service" ],
|
|
|
|
|
2013-10-02 14:36:52 +02:00
|
|
|
check_command = "ping6"
|
2013-09-26 14:01:29 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
services["http"] = {
|
2013-10-18 20:05:08 +02:00
|
|
|
templates = [ "generic-service" ],
|
|
|
|
|
2013-10-02 14:36:52 +02:00
|
|
|
check_command = "http_ip"
|
2013-09-26 14:01:29 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
services["ssh"] = {
|
2013-10-18 20:05:08 +02:00
|
|
|
templates = [ "generic-service" ],
|
|
|
|
|
2013-10-02 14:36:52 +02:00
|
|
|
check_command = "ssh"
|
2013-09-26 14:01:29 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
services["load"] = {
|
2013-10-18 20:05:08 +02:00
|
|
|
templates = [ "generic-service" ],
|
|
|
|
|
2013-10-02 14:36:52 +02:00
|
|
|
check_command = "load"
|
2013-09-26 14:01:29 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
services["processes"] = {
|
2013-10-18 20:05:08 +02:00
|
|
|
templates = [ "generic-service" ],
|
|
|
|
|
2013-10-02 14:36:52 +02:00
|
|
|
check_command = "processes"
|
2013-09-26 14:01:29 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
services["users"] = {
|
2013-10-18 20:05:08 +02:00
|
|
|
templates = [ "generic-service" ],
|
|
|
|
|
2013-10-02 14:36:52 +02:00
|
|
|
check_command = "users"
|
2013-09-26 14:01:29 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
services["disk"] = {
|
2013-10-18 20:05:08 +02:00
|
|
|
templates = [ "generic-service" ],
|
|
|
|
|
2013-10-02 14:36:52 +02:00
|
|
|
check_command = "disk"
|
2013-09-26 14:01:29 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
macros = {
|
|
|
|
address = "127.0.0.1",
|
|
|
|
address6 = "::1",
|
|
|
|
},
|
|
|
|
|
|
|
|
check = "ping4",
|
|
|
|
}
|
|
|
|
|
2013-10-02 14:36:52 +02:00
|
|
|
|
2013-09-26 14:01:29 +02:00
|
|
|
This defines a host named "localhost" which has a couple of services. Services
|
|
|
|
may inherit from one or more service templates.
|
|
|
|
|
2013-10-07 09:35:44 +02:00
|
|
|
The command objects `ping4`, `ping6`, `http_ip`, `ssh`, `load`, `processes`, `users`
|
|
|
|
and `disk` are all provided by the Icinga Template Library (short ITL) which
|
|
|
|
we enabled earlier by including the `itl/itl.conf` configuration file.
|
2013-09-26 14:01:29 +02:00
|
|
|
|
2013-10-07 09:35:44 +02:00
|
|
|
The `macros` attribute can be used to define macros that are available for all
|
2013-09-26 14:01:29 +02:00
|
|
|
services which belong to this host. Most of the templates in the Icinga Template
|
2013-10-07 09:35:44 +02:00
|
|
|
Library require an `address` macro.
|