Update documentation.

Refs #5909
This commit is contained in:
Gunnar Beutner 2014-04-05 14:53:12 +02:00
parent b7cdd1b3a5
commit 226d99dc57
19 changed files with 123 additions and 140 deletions

View File

@ -184,10 +184,10 @@ dictionary.
assign where host.name == "localhost" assign where host.name == "localhost"
} }
apply ScheduledDowntime "backup-downtime" { apply ScheduledDowntime "backup-downtime" to Service {
import "backup-downtime" import "backup-downtime"
assign where service.host == "localhost" && service.short_name == "load" assign where host.name == "localhost" && service.short_name == "load"
} }
apply Service "processes" { apply Service "processes" {

View File

@ -19,14 +19,14 @@ Here is an example of a host object which defines two child services:
check_command = "hostalive" check_command = "hostalive"
} }
apply Service "ping4" { object Service "ping4" {
host_name = "localhost"
check_command = "ping4" check_command = "ping4"
assign where host.name == "my-server1"
} }
apply Service "http" { object Service "http" {
host_name = "localhost"
check_command = "http_ip" check_command = "http_ip"
assign where host.name == "my-server1"
} }
The example host `my-server1` creates two services which belong to this host: The example host `my-server1` creates two services which belong to this host:

View File

@ -71,9 +71,10 @@ free disk space).
vars.address6 = "::1" vars.address6 = "::1"
} }
apply Service "disk" { object Service "disk" {
import "generic-service" import "generic-service"
host_name = "localhost"
check_command = "disk" check_command = "disk"
vars.wfree = 10 vars.wfree = 10

View File

@ -78,12 +78,11 @@ default values for some of the latency thresholds and timeouts.
When using the `my-ping` command you can override all or some of the custom When using the `my-ping` command you can override all or some of the custom
attributes in the service definition like this: attributes in the service definition like this:
apply Service "ping" { object Service "ping" {
host_name = "localhost"
check_command = "my-ping" check_command = "my-ping"
vars.packets = 10 // Overrides the default value of 5 given in the command vars.packets = 10 // Overrides the default value of 5 given in the command
assign where host.name == "my-server1"
} }
If a custom attribute isn't defined anywhere an empty value is used and a warning is If a custom attribute isn't defined anywhere an empty value is used and a warning is
@ -94,14 +93,13 @@ emitted to the Icinga 2 log.
> >
> By convention every host should have an `address` custom attribute. Hosts > By convention every host should have an `address` custom attribute. Hosts
> which have an IPv6 address should also have an `address6` custom attribute. > which have an IPv6 address should also have an `address6` custom attribute.
> This may also be mandatory requirement for using legacy interfaces, user interfaces > This may also be mandatory requirement for using user interfaces and addons.
> and addons.
### <a id="runtime-custom-attribute-env-vars"></a> Runtime Custom Attributes as Environment Variables ### <a id="runtime-custom-attribute-env-vars"></a> Runtime Custom Attributes as Environment Variables
TODO TODO
The `env` command object attribute requires a list of environment variables with values calculated The `env` command object attribute specifies a list of environment variables with values calculated
from either runtime macros or custom attributes which should be exported as environment variables from either runtime macros or custom attributes which should be exported as environment variables
prior to executing the command. prior to executing the command.
@ -114,36 +112,16 @@ when passing credentials to database checks:
command = PluginDir + "/check_mysql -H $address$ -d $db$", command = PluginDir + "/check_mysql -H $address$ -d $db$",
/* default custom attribute values */ /* default custom attribute values */
vars = { vars = {
"MYSQLUSER" = "icinga_check", mysql_user = "icinga_check",
"MYSQLPASS" = "1c1ng42r0xx" mysql_pass = "password"
}, },
env = { env = {
"MYSQLUSER" = "$MYSQLUSER$", MYSQLUSER = "$mysql_user$",
"MYSQLPASS" = "$MYSQLPASS$" MYSQLPASS = "$mysql_pass$"
} }
} }
### <a id="configuration-macros"></a> Configuration Macros
Icinga 2 allows you to define constants which can be used in a limited
scope. For example, constant expressions can reference a pre-defined global constant
variable and calculate a value for the service check interval.
Example:
const MyCheckInterval = 10m
...
{
check_interval = MyCheckInterval / 2.5
}
More details in the chapter [Constant Expressions](#constant-expressions).
## <a id="runtime-macros"></a> Runtime Macros ## <a id="runtime-macros"></a> Runtime Macros
Next to custom attributes there are additional runtime macros made available by Icinga 2. Next to custom attributes there are additional runtime macros made available by Icinga 2.
@ -157,7 +135,7 @@ The following host custom attributes are available in all commands that are exec
hosts or services: hosts or services:
Name | Description Name | Description
-----------------------|-------------- ---------------------------|--------------
host.name | The name of the host object. host.name | The name of the host object.
host.displayname | The value of the `display_name` attribute. host.displayname | The value of the `display_name` attribute.
host.state | The host's current state. Can be one of `UNREACHABLE`, `UP` and `DOWN`. host.state | The host's current state. Can be one of `UNREACHABLE`, `UP` and `DOWN`.
@ -187,7 +165,7 @@ The following service macros are available in all commands that are executed for
services: services:
Name | Description Name | Description
-----------------------|-------------- ------------------------|--------------
service.description | The short name of the service object. service.description | The short name of the service object.
service.displayname | The value of the `display_name` attribute. service.displayname | The value of the `display_name` attribute.
service.checkcommand | This is an alias for the `SERVICEDISPLAYNAME` macro. service.checkcommand | This is an alias for the `SERVICEDISPLAYNAME` macro.
@ -199,7 +177,7 @@ services:
service.laststate | The service's previous state. Can be one of `OK`, `WARNING`, `CRITICAL` and `UNKNOWN`. service.laststate | The service's previous state. Can be one of `OK`, `WARNING`, `CRITICAL` and `UNKNOWN`.
service.laststateid | The service's previous state. Can be one of `0` (ok), `1` (warning), `2` (critical) and `3` (unknown). service.laststateid | The service's previous state. Can be one of `0` (ok), `1` (warning), `2` (critical) and `3` (unknown).
service.laststatetype | The service's previous state type. Can be one of `SOFT` and `HARD`. service.laststatetype | The service's previous state type. Can be one of `SOFT` and `HARD`.
service.laststatechange| The last state change's timestamp. service.laststatechange | The last state change's timestamp.
service.durationsec | The time since the last state change. service.durationsec | The time since the last state change.
service.latency | The service's check latency. service.latency | The service's check latency.
service.executiontime | The service's check execution time. service.executiontime | The service's check execution time.
@ -207,8 +185,6 @@ services:
service.perfdata | The last check's performance data. service.perfdata | The last check's performance data.
service.lastcheck | The timestamp when the last check was executed. service.lastcheck | The timestamp when the last check was executed.
### <a id="user-runtime-macros"></a> User Runtime Macros ### <a id="user-runtime-macros"></a> User Runtime Macros
The following custom attributes are available in all commands that are executed for The following custom attributes are available in all commands that are executed for

View File

@ -115,13 +115,13 @@ TODO
Use the `apply` keyword to create `Notification` objects for your services: Use the `apply` keyword to create `Notification` objects for your services:
apply Notification "mail" { apply Notification "mail" to Service {
import "generic-notification" import "generic-notification"
notification_command = "mail-notification" notification_command = "mail-notification"
users = [ "icingaadmin" ] users = [ "icingaadmin" ]
assign where service.short_name == "ping4" assign where service.name == "ping4"
} }
> **Note** > **Note**
@ -193,15 +193,15 @@ If the problem does not get resolved or acknowledged preventing further notifica
the `escalation-sms-1st-level` user will be escalated `1h` after the initial problem was the `escalation-sms-1st-level` user will be escalated `1h` after the initial problem was
notified, but only for one hour (`2h` as `end` key for the `times` dictionary). notified, but only for one hour (`2h` as `end` key for the `times` dictionary).
apply Notification "mail" { apply Notification "mail" to Service {
import "generic-notification" import "generic-notification"
notification_command = "mail-notification" notification_command = "mail-notification"
users = [ "icingaadmin" ] users = [ "icingaadmin" ]
assign where service.short_name == "ping4" assign where service.name == "ping4"
} }
apply Notification "escalation-sms-2nd-level" { apply Notification "escalation-sms-2nd-level" to Service {
import "generic-notification" import "generic-notification"
notification_command = "sms-notification" notification_command = "sms-notification"
users = [ "icinga-oncall-2nd-level" ] users = [ "icinga-oncall-2nd-level" ]
@ -210,9 +210,11 @@ notified, but only for one hour (`2h` as `end` key for the `times` dictionary).
begin = 30m begin = 30m
end = 1h end = 1h
} }
assign where service.name == "ping4"
} }
apply Notification "escalation-sms-1st-level" { apply Notification "escalation-sms-1st-level" to Service {
import "generic-notification" import "generic-notification"
notification_command = "sms-notification" notification_command = "sms-notification"
users = [ "icinga-oncall-1st-level" ] users = [ "icinga-oncall-1st-level" ]
@ -221,6 +223,8 @@ notified, but only for one hour (`2h` as `end` key for the `times` dictionary).
begin = 1h begin = 1h
end = 2h end = 2h
} }
assign where service.name == "ping4"
} }
> **Note** > **Note**
@ -238,12 +242,14 @@ dictionary and set `begin = 15m` as key and value if you want to suppress notifi
in the first 15 minutes. Leave out the `end` key - if not set, Icinga 2 will not check against any in the first 15 minutes. Leave out the `end` key - if not set, Icinga 2 will not check against any
end time for this notification. end time for this notification.
apply Notification "mail" { apply Notification "mail" to Service {
import "generic-notification" import "generic-notification"
notification_command = "mail-notification" notification_command = "mail-notification"
users = [ "icingaadmin" ] users = [ "icingaadmin" ]
times.begin = 15m // delay first notification times.begin = 15m // delay first notification
assign where service.name == "ping4"
} }
> **Note** > **Note**

View File

@ -24,7 +24,6 @@ Then add your hosts to this hostgroup
groups = [ "windows" ] groups = [ "windows" ]
vars.mssql_port = 1433 vars.mssql_port = 1433
} }
}
> **Best Practice** > **Best Practice**
> >
@ -36,7 +35,6 @@ Then add your hosts to this hostgroup
groups = [ "windows" ] groups = [ "windows" ]
vars.mssql_port = 1433 vars.mssql_port = 1433
} }
}
object Host "mssql-srv1" { object Host "mssql-srv1" {
import "windows-mssql-template" import "windows-mssql-template"

View File

@ -63,10 +63,10 @@ create a new timeperiod named `workhours` defining a work day with
} }
} }
Assign the timeperiod as `notification_period` to the `Notification` Use the `notification_period` attribute to assign time periods to
object then. `Notification` objects:
apply Notification "mail" { apply Notification "mail" to Host {
import "generic-notification" import "generic-notification"
notification_command = "mail-notification" notification_command = "mail-notification"

View File

@ -12,5 +12,3 @@ events being triggered.
Common use case scenarios are a failing HTTP check requiring an immediate Common use case scenarios are a failing HTTP check requiring an immediate
restart via event command, or if an application is locked and requires restart via event command, or if an application is locked and requires
a restart upon detection. a restart upon detection.

View File

@ -58,8 +58,8 @@ You can enable the feature using
# icinga2-enable-feature graphite # icinga2-enable-feature graphite
The `GraphiteWriter` object expects the Graphite Carbon Cache socket listening By default the `GraphiteWriter` object expects the Graphite Carbon Cache to listen at
at `127.0.0.1` on port `2003` by default. `127.0.0.1` on port `2003`.
The current naming schema is The current naming schema is

View File

@ -5,7 +5,7 @@ in Icinga 2 provided with the `CompatLogger` object.
These logs are not only used for informational representation in These logs are not only used for informational representation in
external web interfaces parsing the logs, but also to generate external web interfaces parsing the logs, but also to generate
sla reports and trends in Icinga 1.x Classic UI. Futhermore the SLA reports and trends in Icinga 1.x Classic UI. Futhermore the
`Livestatus` feature uses these logs for answering queries to `Livestatus` feature uses these logs for answering queries to
historical tables. historical tables.

View File

@ -16,4 +16,3 @@ on-demand in your Icinga 2 objects configuration.
object CheckResultReader "reader" { object CheckResultReader "reader" {
spool_dir = "/data/check-results" spool_dir = "/data/check-results"
} }

View File

@ -23,7 +23,7 @@ for specific use cases already around, for example monitoring Cisco routers.
The following example uses the [SNMP ITL](#itl-snmp) `CheckCommand` and just The following example uses the [SNMP ITL](#itl-snmp) `CheckCommand` and just
overrides the `oid` custom attribute. A service is created for all hosts which overrides the `oid` custom attribute. A service is created for all hosts which
have the `community` custom attribute set. have the `community` custom attribute.
apply Service "uptime" { apply Service "uptime" {
import "generic-service" import "generic-service"

View File

@ -376,7 +376,7 @@ once they are set.
The `apply` keyword can be used to create new objects which are associated with The `apply` keyword can be used to create new objects which are associated with
another group of objects. another group of objects.
apply Service "ping" { apply Service "ping" to Host {
import "generic-service" import "generic-service"
check_command = "ping4" check_command = "ping4"
@ -388,15 +388,21 @@ In this example the `assign where` condition is a boolean expression which is
evaluated for all objects of type `Host` and a new service with name "ping" evaluated for all objects of type `Host` and a new service with name "ping"
is created for each matching host. is created for each matching host.
The `to` keyword and the target type may be omitted if there is only target
type, e.g. for the `Service` type.
Depending on the object type used in the `apply` expression additional local Depending on the object type used in the `apply` expression additional local
variables may be available for use in the `where` condition: variables may be available for use in the `where` condition:
Source Type | Target Type | Variables Source Type | Target Type | Variables
-----------------|-------------|-------------- ------------------|-------------|--------------
Service | Host | host Service | Host | host
Dependency | Host | host
Dependency | Service | host, service Dependency | Service | host, service
Notification | Host | host
Notification | Service | host, service Notification | Service | host, service
ScheduledDowntime| Service | host, service ScheduledDowntime | Host | host
ScheduledDowntime | Service | host, service
> **Note** > **Note**
> >

View File

@ -19,9 +19,24 @@ Attributes:
Name |Description Name |Description
----------------|---------------- ----------------|----------------
display_name |**Optional.** A short description of the host. display_name |**Optional.** A short description of the host.
check |**Optional.** A service that is used to determine whether the host is up or down. This must be a service short name of a service that belongs to the host.
groups |**Optional.** A list of host groups this host belongs to. groups |**Optional.** A list of host groups this host belongs to.
vars |**Optional.** A dictionary containing custom attributes that are specific to this host. vars |**Optional.** A dictionary containing custom attributes that are specific to this host.
check\_command |**Required.** The name of the check command.
max\_check\_attempts|**Optional.** The number of times a host is re-checked before changing into a hard state. Defaults to 3.
check\_period |**Optional.** The name of a time period which determines when this host should be checked. Not set by default.
check\_interval |**Optional.** The check interval (in seconds). This interval is used for checks when the host is in a `HARD` state. Defaults to 5 minutes.
retry\_interval |**Optional.** The retry interval (in seconds). This interval is used for checks when the host is in a `SOFT` state. Defaults to 1 minute.
enable\_notifications|**Optional.** Whether notifications are enabled. Defaults to true.
enable\_active\_checks|**Optional.** Whether active checks are enabled. Defaults to true.
enable\_passive\_checks|**Optional.** Whether passive checks are enabled. Defaults to true.
enable\_event\_handler|**Optional.** Enables event handlers for this host. Defaults to true.
enable\_flap\_detection|**Optional.** Whether flap detection is enabled. Defaults to true.
enable\_perfdata|**Optional.** Whether performance data processing is enabled. Defaults to true.
event\_command |**Optional.** The name of an event command that should be executed every time the host's state changes.
flapping\_threshold|**Optional.** The flapping threshold in percent when a host is considered to be flapping.
volatile |**Optional.** The volatile setting enables always `HARD` state types if `NOT-OK` state changes occur.
authorities |**Optional.** A list of Endpoints on which this host check will be executed in a cluster scenario.
domains |**Optional.** A list of Domains for this host object in a cluster scenario.
### <a id="objecttype-hostgroup"></a> HostGroup ### <a id="objecttype-hostgroup"></a> HostGroup
@ -52,9 +67,8 @@ by Icinga 2.
Example: Example:
object Service "localhost-uptime" { object Service "uptime" {
host_name = "localhost" host_name = "localhost"
name = "uptime"
display_name = "localhost Uptime" display_name = "localhost Uptime"
@ -77,25 +91,9 @@ Attributes:
----------------|---------------- ----------------|----------------
host_name |**Required.** The host this service belongs to. There must be a `Host` object with that name. host_name |**Required.** The host this service belongs to. There must be a `Host` object with that name.
name |**Required.** The service name. Must be unique on a per-host basis (Similar to the service_description attribute in Icinga 1.x). name |**Required.** The service name. Must be unique on a per-host basis (Similar to the service_description attribute in Icinga 1.x).
display_name |**Optional.** A short description of the service.
vars |**Optional.** A dictionary containing custom attributes that are specific to this host.
check\_command |**Required.** The name of the check command.
max\_check\_attempts|**Optional.** The number of times a service is re-checked before changing into a hard state. Defaults to 3.
check\_period |**Optional.** The name of a time period which determines when this service should be checked. Not set by default.
check\_interval |**Optional.** The check interval (in seconds). This interval is used for checks when the service is in a `HARD` state. Defaults to 5 minutes.
retry\_interval |**Optional.** The retry interval (in seconds). This interval is used for checks when the service is in a `SOFT` state. Defaults to 1 minute.
enable\_notifications|**Optional.** Whether notifications are enabled. Defaults to true.
enable\_active\_checks|**Optional.** Whether active checks are enabled. Defaults to true.
enable\_passive\_checks|**Optional.** Whether passive checks are enabled. Defaults to true.
enable\_event\_handler|**Optional.** Enables event handlers for this service. Defaults to true.
enable\_flap\_detection|**Optional.** Whether flap detection is enabled. Defaults to true.
enable\_perfdata|**Optional.** Whether performance data processing is enabled. Defaults to true.
event\_command |**Optional.** The name of an event command that should be executed every time the service's state changes.
flapping\_threshold|**Optional.** The flapping threshold in percent when a service is considered to be flapping.
volatile |**Optional.** The volatile setting enables always `HARD` state types if `NOT-OK` state changes occur.
groups |**Optional.** The service groups this service belongs to. groups |**Optional.** The service groups this service belongs to.
authorities |**Optional.** A list of Endpoints on which this service check will be executed in a cluster scenario.
domains |**Optional.** A list of Domains for this service object in a cluster scenario. In addition to these attributes you can also use any of the attributes which are also valid for `Host` objects.
### <a id="objecttype-servicegroup"></a> ServiceGroup ### <a id="objecttype-servicegroup"></a> ServiceGroup

View File

@ -73,7 +73,7 @@ recurring downtimes for services.
Example: Example:
apply ScheduledDowntime "backup-downtime" { apply ScheduledDowntime "backup-downtime" to Service {
author = "icingaadmin" author = "icingaadmin"
comment = "Scheduled downtime for backup" comment = "Scheduled downtime for backup"
@ -89,4 +89,3 @@ Example:
assign where "backup" in service.groups assign where "backup" in service.groups
} }

View File

@ -17,17 +17,20 @@ from the `icinga-node-dmz-1` endpoint.
object Host "dmz-host1" { object Host "dmz-host1" {
import "generic-host" import "generic-host"
}
object Service "dmz-oracledb" {
import "generic-service"
host_name = "dmz-host1"
services["dmz-oracledb"] = {
templates = [ "generic-service" ]
domains = [ "dmz-db" ] domains = [ "dmz-db" ]
authorities = [ "icinga-node-dmz-1", "icinga-node-dmz-2"] authorities = [ "icinga-node-dmz-1", "icinga-node-dmz-2"]
} }
}
object Domain "dmz-db" { object Domain "dmz-db" {
acl = { acl = {
icinga-node-dmz-1 = DomainPrivReadOnly "icinga-node-dmz-1" = DomainPrivReadOnly
icinga-node-dmz-2 = DomainPrivReadWrite "icinga-node-dmz-2" = DomainPrivReadWrite
} }
} }

View File

@ -36,7 +36,7 @@ be suppressed. This is achieved by setting the `disable_checks` attribute to `tr
assign where host.vars.address assign where host.vars.address
} }
apply Dependency "internet" { apply Dependency "internet" to Service {
parent_host = "dsl-router" parent_host = "dsl-router"
disable_checks = true disable_checks = true

View File

@ -114,7 +114,9 @@ services) like in Icinga 1.x but directly after their type definition.
service_description ping4 service_description ping4
} }
object Service "localhost-ping4" { } object Service "ping4" {
host_name = "localhost"
}
## <a id="differences-1x-2-templates"></a> Templates ## <a id="differences-1x-2-templates"></a> Templates
@ -153,7 +155,7 @@ requires an equal sign (=) between them.
> **Note** > **Note**
> >
> Please note that the default time value is seconds, if no duration literal > Please note that the default time value is seconds, if no duration literal
> is given. check_interval = 5 behaves the same as check_interval = 5s. > is given. `check_interval = 5` behaves the same as `check_interval = 5s`.
All strings require double quotes in Icinga 2. Therefore a double-quote All strings require double quotes in Icinga 2. Therefore a double-quote
must be escaped with a backslash (e.g. in command line). must be escaped with a backslash (e.g. in command line).
@ -212,7 +214,6 @@ TODO
> If you are planning to access custom variables as runtime macros you may access > If you are planning to access custom variables as runtime macros you may access
> them with `_HOST`name as known from Icinga 1.x > them with `_HOST`name as known from Icinga 1.x
## <a id="differences-1x-2-host-service-relation"></a> Host Service Relation ## <a id="differences-1x-2-host-service-relation"></a> Host Service Relation
In Icinga 1.x a service object is associated with a host by defining the In Icinga 1.x a service object is associated with a host by defining the

View File

@ -21,8 +21,6 @@ The Vagrant VM is based on CentOS 6.4 and uses the official Icinga 2 RPM
packages from `packages.icinga.org`. The check plugins are installed from packages from `packages.icinga.org`. The check plugins are installed from
EPEL providing RPMs with sources from the Monitoring Plugins project. EPEL providing RPMs with sources from the Monitoring Plugins project.
SSH login is available using `vagrant ssh`.
## <a id="vagrant-demo-guis"></a> Demo GUIs ## <a id="vagrant-demo-guis"></a> Demo GUIs
In addition to installing Icinga 2 the Vagrant puppet modules also install the In addition to installing Icinga 2 the Vagrant puppet modules also install the