2012-09-04 10:38:51 +02:00
|
|
|
Icinga 2 Configuration
|
|
|
|
======================
|
|
|
|
|
|
|
|
:keywords: Icinga, documentation, configuration
|
|
|
|
:description: Description of the Icinga 2 config
|
|
|
|
|
|
|
|
Configuration Format
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
Object Definition
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Icinga 2 features an object-based configuration format. In order to define
|
|
|
|
objects the "object" keyword is used:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
object Host "host1.example.org" {
|
|
|
|
alias = "host1",
|
|
|
|
|
|
|
|
check_interval = 30,
|
|
|
|
retry_interval = 15,
|
|
|
|
|
|
|
|
macros = {
|
|
|
|
address = "192.168.0.1"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NOTE: The Icinga 2 configuration format is agnostic to whitespaces and
|
|
|
|
new-lines.
|
|
|
|
|
|
|
|
Each object is uniquely identified by its type ("Host") and name
|
|
|
|
("host1.example.org"). Objects can contain a comma-separated list of property
|
|
|
|
declarations. The following data types are available for property values:
|
|
|
|
|
2012-09-07 09:48:27 +02:00
|
|
|
Numeric Literals
|
|
|
|
^^^^^^^^^^^^^^^^
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
A floating-point number.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
-27.3
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2012-09-25 11:17:04 +02:00
|
|
|
Duration Literal
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Similar to floating-point numbers except for that fact that they support
|
|
|
|
suffixes to help with specifying time durations.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
2.5m
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2013-02-08 10:14:24 +01:00
|
|
|
Supported suffixes include ms (milliseconds), s (seconds), m (minutes) and h (hours).
|
2012-09-25 11:17:04 +02:00
|
|
|
|
2012-09-07 09:48:27 +02:00
|
|
|
String Literals
|
|
|
|
^^^^^^^^^^^^^^^
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
A string. No escape characters are supported at present though this will likely
|
|
|
|
change.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
"Hello World!"
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Expression List
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
A list of expressions that when executed has a dictionary as a result.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
address = "192.168.0.1",
|
|
|
|
port = 443
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2013-01-29 12:11:05 +01:00
|
|
|
NOTE: Identifiers may not contain certain characters (e.g. space) or start with
|
|
|
|
certain characters (e.g. digits). If you want to use a dictionary key that is
|
|
|
|
not a valid identifier you can put the key in double quotes.
|
|
|
|
|
2012-09-04 10:38:51 +02:00
|
|
|
Operators
|
|
|
|
~~~~~~~~~
|
|
|
|
|
|
|
|
In addition to the "=" operator shown above a number of other operators to
|
|
|
|
manipulate configuration objects are supported. Here's a list of all available
|
|
|
|
operators:
|
|
|
|
|
|
|
|
Operator "="
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Sets a dictionary element to the specified value.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
a = 5,
|
|
|
|
a = 7
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
In this example a has the value 7 after both instructions are executed.
|
|
|
|
|
|
|
|
Operator "+="
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Modifies a dictionary by adding new elements to it.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
a = { "hello" },
|
|
|
|
a += { "world" }
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
In this example a contains both "hello" and "world". This currently only works
|
|
|
|
for expression lists. Support for numbers might be added later on.
|
|
|
|
|
|
|
|
Operator "-="
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Removes elements from a dictionary.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
a = { "hello", "world" },
|
|
|
|
a -= { "world" }
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
In this example a contains "hello". Trying to remove an item that does not
|
|
|
|
exist is not an error. Not implemented yet.
|
|
|
|
|
|
|
|
Operator "*="
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Multiplies an existing dictionary element with the specified number. If the
|
|
|
|
dictionary element does not already exist 0 is used as its value.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
a = 60,
|
|
|
|
a *= 5
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
In this example a is 300. This only works for numbers. Not implemented yet.
|
|
|
|
|
|
|
|
Operator "/="
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Divides an existing dictionary element by the specified number. If the
|
|
|
|
dictionary element does not already exist 0 is used as its value.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
a = 300,
|
|
|
|
a /= 5
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
In this example a is 60. This only works for numbers. Not implemented yet.
|
|
|
|
|
|
|
|
Attribute Shortcuts
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Value Shortcut
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
{
|
2013-02-13 18:43:56 +01:00
|
|
|
"hello", "world"
|
2012-09-04 10:38:51 +02:00
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
This is equivalent to writing:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
{
|
2013-02-13 18:43:56 +01:00
|
|
|
_00000001 = "hello", _00000002 = "world"
|
2012-09-04 10:38:51 +02:00
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2013-02-13 18:43:56 +01:00
|
|
|
The item's keys are monotonically increasing and the config compiler takes
|
|
|
|
care of ensuring that all keys are unique (even when adding items to an
|
|
|
|
existing attribute using +=).
|
|
|
|
|
2012-09-04 10:38:51 +02:00
|
|
|
Indexer Shortcut
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
hello["key"] = "world"
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
This is equivalent to writing:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
hello += {
|
|
|
|
key = "world"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Specifiers
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
Objects can have specifiers that have special meaning. The following specifiers
|
|
|
|
can be used (before the "object" keyword):
|
|
|
|
|
|
|
|
Specifier "abstract"
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
This specifier identifies the object as a template which can be used by other
|
|
|
|
object definitions. The object will not be instantiated on its own.
|
|
|
|
|
2013-02-16 09:18:34 +01:00
|
|
|
Instead of using the "abstract" specifier you can use the "template" keyword
|
|
|
|
which is a shorthand for writing "abstract object":
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
template Service "http" {
|
|
|
|
...
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2012-09-04 10:38:51 +02:00
|
|
|
Specifier "local"
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
This specifier disables replication for this object. The object will not be
|
|
|
|
sent to remote Icinga instances.
|
|
|
|
|
|
|
|
Inheritance
|
|
|
|
~~~~~~~~~~~
|
|
|
|
|
|
|
|
Objects can inherit attributes from one or more other objects.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
abstract object Host "default-host" {
|
|
|
|
check_interval = 30,
|
|
|
|
|
|
|
|
macros = {
|
|
|
|
color = "red"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract object Host "test-host" inherits "default-host" {
|
|
|
|
macros += {
|
|
|
|
color = "blue"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
object Host "localhost" inherits "test-host" {
|
|
|
|
macros += {
|
|
|
|
address = "127.0.0.1",
|
|
|
|
address6 = "::1"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2013-02-05 20:23:47 +01:00
|
|
|
NOTE: The "default-host" and "test-host" objects are marked as templates using
|
2012-09-04 10:38:51 +02:00
|
|
|
the "abstract" keyword. Parent objects do not necessarily have to be "abstract"
|
|
|
|
though in general they are.
|
|
|
|
|
|
|
|
NOTE: The += operator is used to insert additional properties into the macros
|
|
|
|
dictionary. The final dictionary contains all 3 macros and the property "color"
|
|
|
|
has the value "blue".
|
|
|
|
|
|
|
|
Parent objects are resolved in the order they're specified using the "inherits"
|
|
|
|
keyword. Parent objects must already be defined by the time they're used in an
|
|
|
|
object definition.
|
|
|
|
|
|
|
|
Comments
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
The Icinga 2 configuration format supports C/C++-style comments.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
This is a comment.
|
|
|
|
*/
|
|
|
|
object Host "localhost" {
|
|
|
|
check_interval = 30, // this is also a comment.
|
|
|
|
retry_interval = 15
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Includes
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
Other configuration files can be included using the "#include" directive. Paths
|
|
|
|
must be relative to the configuration file that contains the "#include"
|
|
|
|
keyword:
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
#include "some/other/file.conf"
|
|
|
|
#include "conf.d/*.conf"
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2013-02-05 15:31:29 +01:00
|
|
|
Icinga also supports include search paths similar to how they work in a
|
|
|
|
C/C++ compiler:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
#include <itl/itl.conf>
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Note the use of angle brackets instead of double quotes. This causes the
|
|
|
|
config compiler to search the include search paths for the specified file.
|
|
|
|
By default $PREFIX/icinga2 is included in the list of search paths.
|
|
|
|
|
|
|
|
Wildcards are not permitted when using angle brackets.
|
2012-09-04 10:38:51 +02:00
|
|
|
|
2013-01-17 15:05:34 +01:00
|
|
|
Library directive
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
The "#library" directive can be used to manually load additional libraries.
|
|
|
|
Upon loading these libraries may provide additional classes or methods.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
#library "snmphelper"
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NOTE: The "icinga" library is automatically loaded by Icinga.
|
|
|
|
|
2013-02-05 15:31:29 +01:00
|
|
|
Type Definition
|
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
By default Icinga has no way of semantically verifying its configuration
|
|
|
|
objects. This is where type definitions come in. Using type definitions you
|
|
|
|
can specify which attributes are allowed in an object definition.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
type Pizza {
|
2013-02-06 12:09:50 +01:00
|
|
|
%require "radius",
|
|
|
|
%attribute number "radius",
|
2013-02-05 15:31:29 +01:00
|
|
|
|
2013-02-06 12:09:50 +01:00
|
|
|
%attribute dictionary "ingredients" {
|
2013-02-15 12:49:14 +01:00
|
|
|
%validator "ValidateIngredients",
|
2013-02-05 15:31:29 +01:00
|
|
|
|
2013-02-06 12:09:50 +01:00
|
|
|
%attribute string "*",
|
|
|
|
|
|
|
|
%attribute dictionary "*" {
|
|
|
|
%attribute number "quantity",
|
|
|
|
%attribute string "name"
|
2013-02-05 15:31:29 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-02-06 12:09:50 +01:00
|
|
|
%attribute any "custom::*"
|
2013-02-05 15:31:29 +01:00
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
The Pizza definition provides the following validation rules:
|
|
|
|
|
2013-02-06 12:09:50 +01:00
|
|
|
* Pizza objects must contain an attribute "radius" which has to be a number.
|
2013-02-05 15:31:29 +01:00
|
|
|
* Pizza objects may contain an attribute "ingredients" which has to be a
|
|
|
|
dictionary.
|
|
|
|
* Elements in the ingredients dictionary can be either a string or a dictionary.
|
|
|
|
* If they're a dictionary they may contain attributes "quantity" (of type
|
|
|
|
number) and "name" (of type string).
|
2013-02-15 12:49:14 +01:00
|
|
|
* The script function "ValidateIngredients" is run to perform further
|
2013-02-06 12:09:50 +01:00
|
|
|
validation of the ingredients dictionary.
|
2013-02-05 15:31:29 +01:00
|
|
|
* Pizza objects may contain attribute matching the pattern "custom::*" of any
|
|
|
|
type.
|
|
|
|
|
|
|
|
Valid types for type rules include:
|
|
|
|
* any
|
|
|
|
* number
|
|
|
|
* string
|
|
|
|
* scalar (an alias for string)
|
|
|
|
* dictionary
|
|
|
|
|
2012-09-04 10:38:51 +02:00
|
|
|
Configuration Objects
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
Type: IcingaApplication
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
The "IcingaApplication" type is used to specify global configuration parameters
|
|
|
|
for Icinga. There must be exactly one application object in each Icinga 2
|
|
|
|
configuration. The object must have the "local" specifier.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
local object IcingaApplication "icinga" {
|
2012-10-02 15:04:17 +02:00
|
|
|
cert_path = "my-cert.pem",
|
|
|
|
ca_path = "ca.crt",
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
node = "192.168.0.1",
|
|
|
|
service = 7777,
|
|
|
|
|
2012-10-02 14:44:57 +02:00
|
|
|
pid_path = "./var/run/icinga2.pid",
|
|
|
|
state_path = "./var/lib/icinga2.state",
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
macros = {
|
|
|
|
plugindir = "/usr/local/icinga/libexec"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2012-10-02 15:04:17 +02:00
|
|
|
Attribute: cert_path
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
This is used to specify the SSL client certificate Icinga 2 will use when
|
|
|
|
connecting to other Icinga 2 instances. This property is optional when you're
|
|
|
|
setting up a non-networked Icinga 2 instance.
|
|
|
|
|
2012-10-02 15:04:17 +02:00
|
|
|
Attribute: ca_path
|
|
|
|
^^^^^^^^^^^^^^^^^^
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
This is the public CA certificate that is used to verify connections from other
|
|
|
|
Icinga 2 instances. This property is optional when you're setting up a
|
|
|
|
non-networked Icinga 2 instance.
|
|
|
|
|
|
|
|
Attribute: node
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The externally visible IP address that is used by other Icinga 2 instances to
|
|
|
|
connect to this instance. This property is optional when you're setting up a
|
|
|
|
non-networked Icinga 2 instance.
|
|
|
|
|
|
|
|
NOTE: Icinga does not bind to this IP address.
|
|
|
|
|
|
|
|
Attribute: service
|
|
|
|
^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The port this Icinga 2 instance should listen on. This property is optional
|
|
|
|
when you're setting up a non-networked Icinga 2 instance.
|
|
|
|
|
2012-10-02 14:44:57 +02:00
|
|
|
Attribute: pid_path
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
Optional. The path to the PID file. Defaults to "icinga.pid" in the current
|
|
|
|
working directory.
|
|
|
|
|
2012-10-02 14:44:57 +02:00
|
|
|
Attribute: state_path
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
Optional. The path of the state file. This is the file Icinga 2 uses to persist
|
2012-10-02 14:44:57 +02:00
|
|
|
objects between program runs. Defaults to "icinga2.state" in the current working
|
2012-09-04 10:38:51 +02:00
|
|
|
directory.
|
|
|
|
|
|
|
|
Attribute: macros
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. Global macros that are used for service checks and notifications.
|
|
|
|
|
2012-10-02 11:23:11 +02:00
|
|
|
|
|
|
|
Type: Component
|
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
|
2012-10-02 14:44:57 +02:00
|
|
|
Icinga 2 uses a number of components to implement its feature-set. The
|
|
|
|
"Component" configuration object is used to load these components and specify
|
|
|
|
additional parameters for them. "Component" objects must have the "local"
|
|
|
|
specifier. The typical components to be loaded in the default configuration
|
2012-10-02 11:23:11 +02:00
|
|
|
would be "checker", "delegation" and more.
|
|
|
|
|
2012-10-07 22:24:54 +02:00
|
|
|
Example "compat":
|
2012-10-02 11:23:11 +02:00
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2012-10-02 11:27:14 +02:00
|
|
|
local object Component "compat" {
|
2012-10-02 14:44:57 +02:00
|
|
|
status_path = "./var/cache/icinga2/status.dat",
|
|
|
|
objects_path = "./var/cache/icinga2/objects.cache",
|
2012-10-02 11:23:11 +02:00
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2012-10-02 14:44:57 +02:00
|
|
|
Attribute: status_path
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
2012-10-02 11:23:11 +02:00
|
|
|
|
|
|
|
Specifies where Icinga 2 Compat component will put the status.dat file, which can
|
|
|
|
be read by Icinga 1.x Classic UI and other addons. If not set, it defaults to the
|
|
|
|
localstatedir location.
|
|
|
|
|
2012-10-02 14:44:57 +02:00
|
|
|
Attribute: objects_path
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
2012-10-02 11:23:11 +02:00
|
|
|
|
|
|
|
Specifies where Icinga 2 Compat component will put the objects.cache file, which can
|
|
|
|
be read by Icinga 1.x Classic UI and other addons. If not set, it defaults to the
|
|
|
|
localstatedir location.
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
Type: ConsoleLogger
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
2012-09-04 10:38:51 +02:00
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
Specifies Icinga 2 logging to the console. Objects of this type must have the
|
2012-09-04 10:38:51 +02:00
|
|
|
"local" specifier.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-06-27 14:53:26 +02:00
|
|
|
local object ConsoleLogger "my-debug-console" {
|
2012-09-04 10:38:51 +02:00
|
|
|
severity = "debug"
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
Attribute: severity
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The minimum severity for this log. Can be "debug", "information", "warning" or
|
|
|
|
"critical". Defaults to "information".
|
|
|
|
|
|
|
|
Type: FileLogger
|
|
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Specifies Icinga 2 logging to a file. Objects of this type must have the "local"
|
|
|
|
specifier.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
local object FileLogger "my-debug-file" {
|
|
|
|
severity = "debug",
|
|
|
|
path = "/var/log/icinga2/icinga2-debug.log"
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
Attribute: path
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
The log path.
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
Attribute: severity
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The minimum severity for this log. Can be "debug", "information", "warning" or
|
|
|
|
"critical". Defaults to "information".
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
Type: SyslogLogger
|
|
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Specifies Icinga 2 logging to syslog. Objects of this type must have the "local"
|
|
|
|
specifier.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
local object SyslogLogger "my-crit-syslog" {
|
|
|
|
severity = "critical"
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Attribute: severity
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The minimum severity for this log. Can be "debug", "information", "warning" or
|
|
|
|
"critical". Defaults to "information".
|
|
|
|
|
|
|
|
|
2012-09-04 10:38:51 +02:00
|
|
|
Type: Endpoint
|
|
|
|
~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Endpoint objects are used to specify connection information for remote Icinga 2
|
|
|
|
instances. Objects of this type should not be local:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
object Endpoint "icinga-c2" {
|
|
|
|
node = "192.168.5.46",
|
|
|
|
service = 7777,
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Attribute: node
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The hostname/IP address of the remote Icinga 2 instance.
|
|
|
|
|
|
|
|
Attribute: service
|
|
|
|
^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The service name/port of the remote Icinga 2 instance.
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
Type: CheckCommand
|
|
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
A check command definition. Additional default command macros can be defined here.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
object CheckCommand "check_snmp" inherits "plugin-check-command" {
|
|
|
|
command = "$plugindir$/check_snmp -H $address$ -C $community$ -o $oid$",
|
|
|
|
|
|
|
|
macros = {2yy
|
|
|
|
plugindir = "/usr/lib/nagios/plugins",
|
|
|
|
address = "127.0.0.1",
|
|
|
|
community = "public",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Type: NotificationCommand
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
A notification command definition.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" {
|
|
|
|
command = "/usr/bin/printf \"%b\" \"***** Icinga *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info: $SERVICEOUTPUT$\n\nComment: [$NOTIFICATIONAUTHORNAME$] $NOTIFICATIONCOMMENT$\n\n\" | /usr/bin/mail -s \"$NOTIFICATIONTYPE$ - $HOSTNAME$ - $SERVICEDESC$ - $SERVICESTATE$\" $CONTACTEMAIL$",
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2013-07-03 11:21:16 +02:00
|
|
|
Type: EventCommand
|
2013-06-27 14:53:26 +02:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
An event command definition.
|
|
|
|
|
|
|
|
NOTE: Similar to Icinga 1.x event handlers.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
object EventCommand "restart-httpd-event" inherits "plugin-event-command" {
|
|
|
|
command = "/usr/local/icinga/libexec/restart-httpd.sh",
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2012-09-04 10:38:51 +02:00
|
|
|
Type: Service
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Service objects describe network services and how they should be checked by
|
|
|
|
Icinga 2.
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
NOTE: Better create a service template and use that reference on the host
|
|
|
|
definition as shown below.
|
|
|
|
|
2012-09-04 10:38:51 +02:00
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
object Service "localhost-uptime" {
|
|
|
|
host_name = "localhost",
|
|
|
|
|
|
|
|
alias = "localhost Uptime",
|
|
|
|
|
|
|
|
methods = {
|
2013-02-15 12:49:14 +01:00
|
|
|
check = "PluginCheck"
|
2012-09-04 10:38:51 +02:00
|
|
|
},
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
check_command = "check_snmp",
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
macros = {
|
|
|
|
plugindir = "/usr/lib/nagios/plugins",
|
|
|
|
address = "127.0.0.1",
|
2013-06-27 14:53:26 +02:00
|
|
|
community = "public",
|
2012-09-04 10:38:51 +02:00
|
|
|
oid = "DISMAN-EVENT-MIB::sysUpTimeInstance"
|
|
|
|
}
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
check_interval = 60s,
|
|
|
|
retry_interval = 15s,
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
servicegroups = { "all-services", "snmp" },
|
|
|
|
|
|
|
|
checkers = { "*" },
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Attribute: host_name
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The host this service belongs to. There must be a "Host" object with that name.
|
|
|
|
|
|
|
|
Attribute: alias
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. A short description of the service.
|
|
|
|
|
|
|
|
Attribute: methods - check
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2012-09-25 09:42:57 +02:00
|
|
|
The check type of the service. For now only external check plugins are
|
2013-02-15 12:49:14 +01:00
|
|
|
supported ("PluginCheck").
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
Attribute: check_command
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2012-09-25 15:26:06 +02:00
|
|
|
Optional when not using the "external plugin" check type. The check command.
|
2012-09-25 15:31:19 +02:00
|
|
|
May contain macros.
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
Attribute: check_interval
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. The check interval (in seconds).
|
|
|
|
|
|
|
|
Attribute: retry_interval
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. The retry interval (in seconds). This is used when the service is in
|
|
|
|
a soft state.
|
|
|
|
|
|
|
|
Attribute: servicegroups
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. The service groups this service belongs to.
|
|
|
|
|
|
|
|
Attribute: checkers
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. A list of remote endpoints that may check this service. Wildcards can
|
|
|
|
be used here.
|
|
|
|
|
|
|
|
Type: ServiceGroup
|
|
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
A group of services.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
object ServiceGroup "snmp" {
|
|
|
|
alias = "SNMP services",
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
custom = {
|
|
|
|
notes_url = "http://www.example.org/",
|
|
|
|
action_url = "http://www.example.org/",
|
|
|
|
}
|
2012-09-04 10:38:51 +02:00
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Attribute: alias
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. A short description of the service group.
|
|
|
|
|
|
|
|
Attribute: notes_url
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. Notes URL. Used by the CGIs.
|
|
|
|
|
|
|
|
Attribute: action_url
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. Action URL. Used by the CGIs.
|
|
|
|
|
|
|
|
Type: Host
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
A host. Unlike in Icinga 1.x hosts are not checkable objects in Icinga 2.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
object Host "localhost" {
|
|
|
|
alias = "The best host there is",
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
hostgroups = [ "all-hosts" ],
|
2012-09-04 10:38:51 +02:00
|
|
|
|
2013-02-07 20:29:35 +01:00
|
|
|
hostcheck = "ping",
|
2013-06-27 14:53:26 +02:00
|
|
|
dependencies = [ "router-ping" ]
|
|
|
|
|
|
|
|
services["ping"] = { templates = "ping" }
|
|
|
|
services["http"] = {
|
|
|
|
templates = "my-http",
|
|
|
|
macros = {
|
|
|
|
vhost = "test1.example.org",
|
|
|
|
port = 81
|
2012-09-04 10:38:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
check_interval = 60m,
|
|
|
|
retry_interval = 15m,
|
2012-09-04 10:38:51 +02:00
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
servicegroups = [ "all-services" ],
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
checkers = { "*" },
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Attribute: alias
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. A short description of the host.
|
|
|
|
|
|
|
|
Attribute: hostgroups
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. A list of host groups this host belongs to.
|
|
|
|
|
2013-02-07 20:29:35 +01:00
|
|
|
Attribute: hostcheck
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
2012-09-04 10:38:51 +02:00
|
|
|
|
2013-02-07 20:29:35 +01:00
|
|
|
Optional. A service that is used to determine whether the host is up or down.
|
2012-09-04 10:38:51 +02:00
|
|
|
|
2013-02-07 20:29:35 +01:00
|
|
|
Attribute: hostdependencies
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. A list of hosts that are used to determine whether the host is
|
|
|
|
unreachable.
|
|
|
|
|
|
|
|
Attribute: servicedependencies
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
Optional. A list of services that are used to determine whether the host is
|
|
|
|
unreachable.
|
|
|
|
|
|
|
|
Attribute: services
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
Inline definition of services. Each service name is defined in square brackets
|
|
|
|
and got its own dictionary with attribute properties, such as the template service
|
|
|
|
being used.
|
|
|
|
All other service-related properties are additively copied into the new service
|
2012-09-04 10:38:51 +02:00
|
|
|
object.
|
|
|
|
|
|
|
|
The new service's name is "hostname-service" - where "service" is the
|
2013-06-27 14:53:26 +02:00
|
|
|
array key in the services array.
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
The priority for service properties is (from highest to lowest):
|
|
|
|
|
|
|
|
1. Properties specified in the dictionary of the inline service definition
|
|
|
|
2. Host properties
|
|
|
|
3. Properties inherited from the new service's parent object
|
|
|
|
|
|
|
|
Attribute: check_interval
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. Copied into inline service definitions. The host itself does not have
|
|
|
|
any checks.
|
|
|
|
|
|
|
|
Attribute: retry_interval
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. Copied into inline service definitions. The host itself does not have
|
|
|
|
any checks.
|
|
|
|
|
|
|
|
Attribute: servicegroups
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. Copied into inline service definitions. The host itself does not have
|
|
|
|
any checks.
|
|
|
|
|
|
|
|
Attribute: checkers
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. Copied into inline service definitions. The host itself does not have
|
|
|
|
any checks.
|
|
|
|
|
|
|
|
Type: HostGroup
|
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
A group of hosts.
|
|
|
|
|
|
|
|
Example
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
object HostGroup "my-hosts" {
|
|
|
|
alias = "My hosts",
|
|
|
|
|
|
|
|
notes_url = "http://www.example.org/",
|
|
|
|
action_url = "http://www.example.org/",
|
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Attribute: alias
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. A short description of the host group.
|
|
|
|
|
|
|
|
Attribute: notes_url
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. Notes URL. Used by the CGIs.
|
|
|
|
|
|
|
|
Attribute: action_url
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Optional. Action URL. Used by the CGIs.
|
|
|
|
|
|
|
|
Configuration Examples
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
Non-networked minimal example
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
NOTE: Icinga 2 ITL provides itl/standalone.conf which loads all required components, as well
|
|
|
|
as itl/itl.conf includes many object templates already for an easy start with Icinga 2.
|
|
|
|
|
2012-09-04 10:38:51 +02:00
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
local object IcingaApplication "icinga" {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
local object Component "checker" {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
local object Component "delegation" {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
object CheckCommand "ping" {
|
|
|
|
command = "$plugindir$/check_ping -H $address$ -w $wrta$,$wpl$% -c $crta$,$cpl$%",
|
|
|
|
}
|
|
|
|
|
|
|
|
template Service "icinga-service" {
|
2012-09-14 15:41:14 +02:00
|
|
|
methods = {
|
2013-02-15 12:49:14 +01:00
|
|
|
check = "PluginCheck"
|
2012-09-04 10:38:51 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
macros = {
|
|
|
|
plugindir = "/usr/lib/nagios/plugins"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
template Service "ping-tmpl" inherits "icinga-service" {
|
|
|
|
check_command = "ping",
|
2012-09-04 10:38:51 +02:00
|
|
|
macros += {
|
|
|
|
wrta = 50,
|
|
|
|
wpl = 5,
|
|
|
|
crta = 100,
|
|
|
|
cpl = 10
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
object Host "localhost" {
|
2013-06-27 14:53:26 +02:00
|
|
|
services["ping"] = { templates = "ping-tmpl" },
|
2012-09-04 10:38:51 +02:00
|
|
|
|
|
|
|
macros = {
|
|
|
|
address = "127.0.0.1"
|
|
|
|
},
|
|
|
|
|
2013-06-27 14:53:26 +02:00
|
|
|
check_interval = 10m
|
2012-09-04 10:38:51 +02:00
|
|
|
}
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NOTE: You may also want to load the "compat" component if you want Icinga 2 to
|
|
|
|
write status.dat and objects.cache files.
|
2012-10-02 17:47:13 +02:00
|
|
|
|
|
|
|
/* vim: set syntax=asciidoc filetype=asciidoc: */
|