>
> This example requires the `mail` binary installed on the Icinga 2
> master.
-
-#### Notification Commands in 2.7 <a id="notification-command-2-7"></a>
-
-Icinga 2 v2.7.0 introduced new notification scripts which support both
-environment variables and command line parameters.
-
-Therefore the `NotificationCommand` objects inside the [commands.conf](04-configuring-icinga-2.md#commands-conf)
-and `Notification` apply rules inside the [notifications.conf](04-configuring-icinga-2.md#notifications-conf)
-configuration files have been updated. Your configuration needs to be
-updated next to the notification scripts themselves.
-
-> **Note**
>
-> Several parameters have been changed. Please review the notification
-> script parameters and configuration objects before updating your production
-> environment.
-
-The safest way is to incorporate the configuration updates from
-v2.7.0 inside the [commands.conf](04-configuring-icinga-2.md#commands-conf) and [notifications.conf](04-configuring-icinga-2.md#notifications-conf)
-configuration files.
-
-A quick-fix is shown below:
-
-```
-@@ -5,7 +5,8 @@ object NotificationCommand "mail-host-notification" {
-
- env = {
- NOTIFICATIONTYPE = "$notification.type$"
-- HOSTALIAS = "$host.display_name$"
-+ HOSTNAME = "$host.name$"
-+ HOSTDISPLAYNAME = "$host.display_name$"
- HOSTADDRESS = "$address$"
- HOSTSTATE = "$host.state$"
- LONGDATETIME = "$icinga.long_date_time$"
-@@ -22,8 +23,9 @@ object NotificationCommand "mail-service-notification" {
-
- env = {
- NOTIFICATIONTYPE = "$notification.type$"
-- SERVICEDESC = "$service.name$"
-- HOSTALIAS = "$host.display_name$"
-+ SERVICENAME = "$service.name$"
-+ HOSTNAME = "$host.name$"
-+ HOSTDISPLAYNAME = "$host.display_name$"
- HOSTADDRESS = "$address$"
- SERVICESTATE = "$service.state$"
- LONGDATETIME = "$icinga.long_date_time$"
-```
-
+> Depending on the distribution, you need a local mail transfer
+> agent (MTA) such as Postfix, Exim or Sendmail in order
+> to send emails.
+>
+> These tools virtually provide the `mail` binary executed
+> by the notification scripts below.
#### mail-host-notification <a id="mail-host-notification"></a>
The Icinga project aims to allow the following compatibility:
```
-master (2.9) >= satellite (2.8) >= clients (2.7)
+master (2.11) >= satellite (2.10) >= clients (2.9)
```
Older client versions may work, but there's no guarantee. Always keep in mind that
older versions are out of support and can contain bugs.
In terms of an upgrade, ensure that the master is upgraded first, then
-involved satellites, and last the Icinga 2 clients. If you are on v2.8
-currently, first upgrade the master instance(s) to 2.9, and then proceed
+involved satellites, and last the Icinga 2 clients. If you are on v2.10
+currently, first upgrade the master instance(s) to 2.11, and then proceed
with the satellites. Things are getting easier with any sort of automation
tool (Puppet, Ansible, etc.).
> **Note**
>
-> Icinga 2 v2.8 adds the possibility to forward signing requests on a satellite
+> Icinga 2 v2.8 added the possibility to forward signing requests on a satellite
> to the master node. This is called `CA Proxy` in blog posts and design drafts.
> This functionality helps with the setup of [three level clusters](#06-distributed-monitoring.md#distributed-monitoring-scenarios-master-satellite-client)
> and more.
### Certificate Auto-Renewal <a id="distributed-monitoring-certificate-auto-renewal"></a>
-Icinga 2 v2.8+ adds the possibility that nodes request certificate updates
+Icinga 2 v2.8+ added the possibility that nodes request certificate updates
on their own. If their expiration date is soon enough, they automatically
renew their already signed certificate by sending a signing request to the
parent node. You'll also see a message in the logs if certificate renewal
> **Note**
>
-> The `master_host` parameter is deprecated and will be removed in 2.10.0. Please use `--parent_host` instead.
+> The `master_host` parameter is deprecated and will be removed. Please use `--parent_host` instead.
-Example for Icinga 2 v2.9:
+Example:
```
[root@icinga2-client1.localdomain /]# icinga2 node setup --ticket ead2d570e18c78abf285d6b85524970a0f69c22d \
```
$ ICINGA2_API_PASSWORD=icinga icinga2 console --connect 'https://root@localhost:5665/'
-Icinga 2 (version: v2.8.1-373-g4bea6d25c)
+Icinga 2 (version: v2.11.0)
<1> => globals.state_to_string(1)
"Warning"
<2> => state_to_string(2)
```
# icinga2
-icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.0)
+icinga2 - The Icinga 2 network monitoring daemon (version: v2.11.0)
Usage:
icinga2 <command> [<arguments>]
```
# icinga2 api --help
-icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.0)
+icinga2 - The Icinga 2 network monitoring daemon (version: v2.11.0)
Usage:
icinga2 <command> [<arguments>]
```
# icinga2 ca --help
-icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.0)
+icinga2 - The Icinga 2 network monitoring daemon (version: v2.11.0)
Usage:
icinga2 <command> [<arguments>]
```
$ icinga2 console
-Icinga 2 (version: v2.8.0)
+Icinga 2 (version: v2.11.0)
<1> => function test(name) {
<1> .. log("Hello " + name)
<1> .. }
```
# icinga2 console --help
-icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.0)
+icinga2 - The Icinga 2 network monitoring daemon (version: v2.11.0)
Usage:
icinga2 console [<arguments>]
```
$ ICINGA2_API_PASSWORD=icinga icinga2 console --connect 'https://root@localhost:5665/'
-Icinga 2 (version: v2.8.0)
+Icinga 2 (version: v2.11.0)
<1> =>
```
```
# icinga2 daemon --help
-icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.0)
+icinga2 - The Icinga 2 network monitoring daemon (version: v2.11.0)
Usage:
icinga2 daemon [<arguments>]
```
# icinga2 node --help
-icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.0)
+icinga2 - The Icinga 2 network monitoring daemon (version: v2.11.0)
Usage:
icinga2 <command> [<arguments>]
```
# icinga2 object --help
-icinga2 - The Icinga 2 network monitoring daemon (version: v2.7.1-196-g23e8a6253; debug)
+icinga2 - The Icinga 2 network monitoring daemon (version: v2.11.0)
Usage:
icinga2 <command> [<arguments>]
```
# icinga2 pki --help
-icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.0)
+icinga2 - The Icinga 2 network monitoring daemon (version: v2.11.0)
Usage:
icinga2 <command> [<arguments>]
```
# icinga2 troubleshoot --help
-icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.0)
+icinga2 - The Icinga 2 network monitoring daemon (version: v2.11.0)
Usage:
icinga2 troubleshoot [<arguments>]
```
# icinga2 variable --help
-icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.0; debug)
+icinga2 - The Icinga 2 network monitoring daemon (version: v2.11.0)
Usage:
icinga2 <command> [<arguments>]
# Upgrading Icinga 2 <a id="upgrading-icinga-2"></a>
-Upgrading Icinga 2 is usually quite straightforward. Ordinarily the only manual steps involved
+Upgrading Icinga 2 is usually quite straightforward.
+Ordinarily the only manual steps involved
are scheme updates for the IDO database.
Specific version upgrades are described below. Please note that version
Icinga 2 provides a number of special global constants. These include directory paths, global configuration
and runtime parameters for the application version and (build) platform.
-Directory paths:
+#### Directory Path Constants <a id="icinga-constants-director-path"></a>
Constant | Description
--------------------|-------------------
InitRunDir |**Read-only.** Directory for PID files and sockets in daemon mode. Usually set to `/run/icinga2`.
ZonesDir |**Read-only.** Contains the path of the zones.d directory. Defaults to `ConfigDir + "/zones.d"`.
-Global configuration:
+#### Global Configuration Constants <a id="icinga-constants-global-config"></a>
Constant | Description
--------------------|-------------------
ApiBindHost |**Read-write.** Overrides the default value for the ApiListener `bind_host` attribute. Not set by default.
ApiBindPort |**Read-write.** Overrides the default value for the ApiListener `bind_port` attribute. Not set by default.
-Application runtime details:
+#### Application Runtime Constants <a id="icinga-constants-application-runtime"></a>
Constant | Description
--------------------|-------------------
BuildHostName |**Read-only.** The name of the host Icinga was built on, e.g. `acheron`.
ApplicationVersion |**Read-only.** The application version, e.g. `2.9.0`.
+#### Additional Constants <a id="icinga-constants-additional"></a>
+
Writable constants can be specified on the CLI using the `--define/-D` parameter.
> **Note for v2.10+**
LocalStateDir |**Read-only.** Contains the path of the local state directory. Defaults to `PrefixDir + "/var"`.
RunDir |**Read-only.** Contains the path of the run directory. Defaults to `LocalStateDir + "/run"`.
+#### Advanced Constants and Variables <a id="icinga-constants-advanced"></a>
+
Advanced runtime constants. Please only use them if advised by support or developers.
Variable | Description
---------------------------|-------------------
EventEngine |**Read-write.** The name of the socket event engine, can be `poll` or `epoll`. The epoll interface is only supported on Linux.
AttachDebugger |**Read-write.** Whether to attach a debugger when Icinga 2 crashes. Defaults to `false`.
-ICINGA2\_RLIMIT\_FILES |**Read-write.** Defines the resource limit for RLIMIT_NOFILE that should be set at start-up. Value cannot be set lower than the default `16 * 1024`. 0 disables the setting. Set in Icinga 2 sysconfig.
-ICINGA2\_RLIMIT\_PROCESSES |**Read-write.** Defines the resource limit for RLIMIT_NPROC that should be set at start-up. Value cannot be set lower than the default `16 * 1024`. 0 disables the setting. Set in Icinga 2 sysconfig.
-ICINGA2\_RLIMIT\_STACK |**Read-write.** Defines the resource limit for RLIMIT_STACK that should be set at start-up. Value cannot be set lower than the default `256 * 1024`. 0 disables the setting. Set in Icinga 2 sysconfig.
+
+Advanced sysconfig environment variables, defined in `/etc/sysconfig/icinga2` (RHEL/SLES) or `/etc/default/icinga2` (Debian/Ubuntu).
+
+Variable | Description
+---------------------------|-------------------
+ICINGA2\_RLIMIT\_FILES |**Read-write.** Defines the resource limit for `RLIMIT_NOFILE` that should be set at start-up. Value cannot be set lower than the default `16 * 1024`. 0 disables the setting. Set in Icinga 2 sysconfig.
+ICINGA2\_RLIMIT\_PROCESSES |**Read-write.** Defines the resource limit for `RLIMIT_NPROC` that should be set at start-up. Value cannot be set lower than the default `16 * 1024`. 0 disables the setting. Set in Icinga 2 sysconfig.
+ICINGA2\_RLIMIT\_STACK |**Read-write.** Defines the resource limit for `RLIMIT_STACK` that should be set at start-up. Value cannot be set lower than the default `256 * 1024`. 0 disables the setting. Set in Icinga 2 sysconfig.
+
## Apply <a id="apply"></a>
vars.@include = "some cmdb export field"
}
-```
\ No newline at end of file
+```
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.vars.os_type = "Linux/Unix"
null
<2> => regex("^Linux", host.vars.os_type)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.vars.databases = [ "db-prod1", "db-prod2", "db-dev" ]
null
<2> => regex("^db-prod\\d+", host.vars.databases, MatchAny)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var name = "db-prod-sfo-657"
null
<2> => match("*prod-sfo*", name)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0-28)
+Icinga 2 (version: v2.11.0-28)
<1> => host.vars.application_types = [ "web-wp", "web-rt", "db-local" ]
null
<2> => match("web-*", host.vars.application_types, MatchAll)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.address = "192.168.56.101"
null
<2> => cidr_match("192.168.56.0/24", host.address)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.vars.vhost_ips = [ "192.168.56.101", "192.168.56.102", "10.0.10.99" ]
null
<2> => cidr_match("192.168.56.0/24", host.vars.vhost_ips, MatchAll)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => range(5)
[ 0.000000, 1.000000, 2.000000, 3.000000, 4.000000 ]
<2> => range(2,4)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.groups = [ "linux-servers", "db-servers" ]
null
<2> => host.groups.len()
Example:
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var dev_notification_groups = [ "devs", "slack" ]
null
<2> => var host_notification_groups = [ "slack", "noc" ]
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var dev_notification_groups = [ "devs", "slack" ]
null
<2> => var host_notification_groups = [ "slack", "noc" ]
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.vars.disks["/"] = {}
null
<2> => host.vars.disks["/var"] = {}
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => 5.to_string()
"5"
<2> => false.to_string()
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => number(false)
0.000000
<2> => number("78")
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => bool(1)
true
<2> => bool(0)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => random()
1263171996.000000
<2> => random()
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => log(LogCritical, "Console", "First line")
critical/Console: First line
null
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => typeof(3) == Number
true
<2> => typeof("str") == String
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => get_time()
1480072135.633008
<2> => get_time()
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var pd = "'time'=1480074205.197363;;;"
null
<2> => parse_performance_data(pd)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var path = "/etc/icinga2/scripts/xmpp-notification.pl"
null
<2> => dirname(path)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var path = "/etc/icinga2/scripts/xmpp-notification.pl"
null
<2> => basename(path)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var path = "/etc/icinga2/scripts/xmpp-notification.pl"
null
<2> => path_exists(path)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var pathSpec = "/etc/icinga2/conf.d/*.conf"
null
<2> => glob(pathSpec)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var path = "/etc/icinga2/zones.d/"
null
<2> => var pattern = "*.conf"
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => escape_shell_arg("'$host.name$' '$service.name$'")
"''\\''$host.name$'\\'' '\\''$service.name$'\\'''"
```
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => escape_shell_cmd("/bin/echo 'shell test' $ENV")
"/bin/echo 'shell test' \\$ENV"
```
```
$ ICINGA2_API_PASSWORD=icinga icinga2 console --connect 'https://root@localhost:5665/'
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => get_service(NodeName, "disk")
<2> => get_service(NodeName, "disk").__name
```
$ ICINGA2_API_PASSWORD=icinga icinga2 console --connect 'https://root@localhost:5665/'
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => get_services(NodeName).map(s => s.name)
[ "disk", "disk /", "http", "icinga", "load", "ping4", "ping6", "procs", "ssh", "users" ]
```
var s = DateTime(2016, 4, 21).to_string() /* Sets s to "2016-04-21 00:00:00 +0200". */
-```
\ No newline at end of file
+```