# Appendix
## Icinga Template Library
### Overview
The Icinga Template Library (ITL) implements standard templates and object
definitions for commonly used services.
You can include the ITL by using the `include` directive in your configuration
file:
include
The ITL assumes that there's a global constant named `PluginDir` which contains
the path of the plugins from the Monitoring Plugins project.
### Check Commands
#### ping4
Check command object for the `check_ping` plugin.
Custom Attributes:
Name | Description
----------------|--------------
ping_address | **Optional.** The host's IPv4 address. Defaults to "$address$".
ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 100.
ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 5.
ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 200.
ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 15.
ping_packets | **Optional.** The number of packets to send. Defaults to 5.
ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout).
#### ping6
Check command object for the `check_ping` plugin.
Custom Attributes:
Name | Description
----------------|--------------
ping_address | **Optional.** The host's IPv6 address. Defaults to "$address6$".
ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 100.
ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 5.
ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 200.
ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 15.
ping_packets | **Optional.** The number of packets to send. Defaults to 5.
ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout).
#### hostalive
Check command object for the `check_ping` plugin with host check default values.
Custom Attributes:
Name | Description
----------------|--------------
ping_address | **Optional.** The host's IPv4 address. Defaults to "$address$".
ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 3000.
ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 80.
ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 5000.
ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 100.
ping_packets | **Optional.** The number of packets to send. Defaults to 5.
ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout).
#### dummy
Check command object for the `check_dummy` plugin.
Custom Attributes:
Name | Description
----------------|--------------
dummy_state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 (critical) and 3 (unknown). Defaults to 0.
dummy_text | **Optional.** Plugin output. Defaults to "Check was successful.".
#### passive
Specialised check command object for passive checks executing the `check_dummy` plugin with appropriate default values.
Custom Attributes:
Name | Description
----------------|--------------
dummy_state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 (critical) and 3 (unknown). Defaults to 3.
dummy_text | **Optional.** Plugin output. Defaults to "No Passive Check Result Received.".
#### tcp
Check command object for the `check_tcp` plugin.
Custom Attributes:
Name | Description
----------------|--------------
tcp_address | **Optional.** The host's address. Defaults to "$address$".
tcp_port | **Required.** The port that should be checked.
#### udp
Check command object for the `check_udp` plugin.
Custom Attributes:
Name | Description
----------------|--------------
udp_address | **Optional.** The host's address. Defaults to "$address$".
udp_port | **Required.** The port that should be checked.
#### http
Check command object for the `check_http` plugin.
Custom Attributes:
Name | Description
-------------------|--------------
http_address | **Optional.** The host's address. Defaults to "$address".
http_vhost | **Optional.** The virtual host that should be sent in the "Host" header.
http_uri | **Optional.** The request URI.
http_port | **Optional.** The TCP port. Defaults to 80 when not using SSL, 443 otherwise.
http_ssl | **Optional.** Whether to use SSL. Defaults to false.
http_warn_time | **Optional.** The warning threshold.
http_critical_time | **Optional.** The critical threshold.
#### smtp
Check command object for the `check_smtp` plugin.
Custom Attributes:
Name | Description
---------------------|--------------
smtp_address | **Optional.** The host's address. Defaults to "$address$".
#### ssmtp
Check command object for the `check_ssmtp` plugin.
Custom Attributes:
Name | Description
----------------|--------------
ssmtp_address | **Required.** The host's address. Defaults to "$address$".
ssmtp_port | **Optional.** The port that should be checked. Defaults to 465.
#### ntp_time
Check command object for the `check_ntp_time` plugin.
Custom Attributes:
Name | Description
----------------|--------------
ntp_address | **Optional.** The host's address. Defaults to "$address$".
#### ssh
Check command object for the `check_ssh` plugin.
Custom Attributes:
Name | Description
----------------|--------------
ssh_address | **Optional.** The host's address. Defaults to "$address$".
ssh_port | **Optional.** The port that should be checked. Defaults to 22.
#### disk
Check command object for the `check_disk` plugin.
Custom Attributes:
Name | Description
----------------|--------------
disk_wfree | **Optional.** The free space warning threshold in %. Defaults to 20.
disk_cfree | **Optional.** The free space critical threshold in %. Defaults to 10.
#### users
Check command object for the `check_disk` plugin.
Custom Attributes:
Name | Description
----------------|--------------
users_wgreater | **Optional.** The user count warning threshold. Defaults to 20.
users_cgreater | **Optional.** The user count critical threshold. Defaults to 50.
#### procs
Check command object for the `check_procs` plugin.
Custom Attributes:
Name | Description
----------------|--------------
procs_wgreater | **Optional.** The process count warning threshold. Defaults to 250.
procs_cgreater | **Optional.** The process count critical threshold. Defaults to 400.
#### swap
Check command object for the `check_swap` plugin.
Custom Attributes:
Name | Description
----------------|--------------
swap_wfree | **Optional.** The free swap space warning threshold in %. Defaults to 50.
swap_cfree | **Optional.** The free swap space critical threshold in %. Defaults to 25.
#### load
Check command object for the `check_load` plugin.
Custom Attributes:
Name | Description
----------------|--------------
load_wload1 | **Optional.** The 1-minute warning threshold. Defaults to 5.
load_wload5 | **Optional.** The 5-minute warning threshold. Defaults to 4.
load_wload15 | **Optional.** The 15-minute warning threshold. Defaults to 3.
load_cload1 | **Optional.** The 1-minute critical threshold. Defaults to 10.
load_cload5 | **Optional.** The 5-minute critical threshold. Defaults to 6.
load_cload15 | **Optional.** The 15-minute critical threshold. Defaults to 4.
#### snmp
Check command object for the `check_snmp` plugin.
Custom Attributes:
Name | Description
----------------|--------------
snmp_address | **Optional.** The host's address. Defaults to "$address$".
snmp_oid | **Required.** The SNMP OID.
snmp_community | **Optional.** The SNMP community. Defaults to "public".
#### snmp-uptime
Check command object for the `check_snmp` plugin.
Custom Attributes:
Name | Description
----------------|--------------
snmp_address | **Optional.** The host's address. Defaults to "$address$".
snmp_oid | **Optional.** The SNMP OID. Defaults to "1.3.6.1.2.1.1.3.0".
snmp_community | **Optional.** The SNMP community. Defaults to "public".
#### apt
Check command for the `check_apt` plugin.
The `apt` check command does not support any vars.
#### icinga
Check command for the built-in `icinga` check. This check returns performance
data for the current Icinga instance.
The `icinga` check command does not support any vars.
#### plugin-check-command
Check command template for plugins executed by Icinga 2.
The `plugin-check-command` check command does not support any vars.
#### plugin-check-command
Check command template for notification scripts executed by Icinga 2.
The `plugin-notification-command` check command does not support any vars.
#### plugin-check-command
Check command template for event handler scripts executed by Icinga 2.
The `plugin-event-command` check command does not support any vars.
## Schemas
### DB IDO
There is a detailed documentation for the Icinga IDOUtils 1.x
database schema available on [http://docs.icinga.org/latest/en/db_model.html]
#### DB IDO Schema Extensions
Icinga 2 specific extensions are shown below:
New tables: `endpoints`, `endpointstatus`
Table | Column | Type | Default | Description
--------------------|--------------------|----------|---------|-------------
endpoints | endpoint_object_id | bigint | NULL | FK: objects table
endpoints | identity | TEXT | NULL | endpoint name
endpoints | node | TEXT | NULL | local node name
Table | Column | Type | Default | Description
--------------------|--------------------|----------|---------|-------------
endpointstatus | endpoint_object_id | bigint | NULL | FK: objects table
endpointstatus | identity | TEXT | NULL | endpoint name
endpointstatus | node | TEXT | NULL | local node name
endpointstatus | is_connected | smallint | 0 | update on endpoint connect/disconnect
New columns:
Table | Column | Type | Default | Description
--------------------|-------------------------|----------|---------|-------------
all status/history | endpoint_object_id | bigint | NULL | FK: objects table
servicestatus | check_source | TEXT | NULL | node name where check was executed
hoststatus | check_source | TEXT | NULL | node name where check was executed
statehistory | check_source | TEXT | NULL | node name where check was executed
logentries | object_id | bigint | NULL | FK: objects table (service associated with column)
Additional command custom variables populated from 'vars' dictionary.
Additional global custom variables populated from 'Vars' constant (object_id is NULL).
### Livestatus
#### Livestatus Tables
Table | Join |Description
--------------|-----------|----------------------------
hosts | | host config and status attributes, services counter
hostgroups | | hostgroup config, status attributes and host/service counters
services | hosts | service config and status attributes
servicegroups | | servicegroup config, status attributes and service counters
contacts | | contact config and status attributes
contactgroups | | contact config, members
commands | | command name and line
status | | programstatus, config and stats
comments | services | status attributes
downtimes | services | status attributes
timeperiods | | name and is inside flag
endpoints | | config and status attributes
log | services, hosts, contacts, commands | parses [compatlog](#objecttype-compatlogger) and shows log attributes
statehist | hosts, services | parses [compatlog](#objecttype-compatlogger) and aggregates state change attributes
The `commands` table is populated with `CheckCommand`, `EventCommand` and `NotificationCommand` objects.
#### Livestatus Table Attributes
A detailed list which table attributes are supported can be found here: [https://wiki.icinga.org/display/icinga2/Livestatus#Livestatus-Attributes]
#### Livestatus GET Queries
$ echo -e 'GET services' | netcat 127.0.0.1 6558
$ cat servicegroups < Livestatus COMMAND Queries
A list of available external commands and their parameters can be found [here](#external-commands-list-detail)
$ echo -e 'COMMAND ' | netcat 127.0.0.1 6558
#### Livestatus Filters
and, or, negate
Operator | Negate | Description
----------|------------------------
= | != | Euqality
~ | !~ | Regex match
=~ | !=~ | Euqality ignoring case
~~ | !~~ | Regex ignoring case
> | | Less than
< | | Greater than
>= | | Less than or equal
<= | | Greater than or equal
#### Livestatus Stats
Schema: "Stats: aggregatefunction aggregateattribute"
Aggregate Function | Description
-------------------|--------------
sum |
min |
max |
avg | sum / count
std | standard deviation
suminv | sum (1 / value)
avginv | suminv / count
count | ordinary default for any stats query if not aggregate function defined
Example:
GET hosts
Filter: has_been_checked = 1
Filter: check_type = 0
Stats: sum execution_time
Stats: sum latency
Stats: sum percent_state_change
Stats: min execution_time
Stats: min latency
Stats: min percent_state_change
Stats: max execution_time
Stats: max latency
Stats: max percent_state_change
OutputFormat: json
ResponseHeader: fixed16
#### Livestatus Output
* CSV
CSV Output uses two levels of array seperators: The members array separator
is a comma (1st level) while extra info and host|service relation separator
is a pipe (2nd level).
Seperators can be set using ASCII codes like:
Separators: 10 59 44 124
* JSON
Default separators.
#### Livestatus Error Codes
Code | Description
----------|--------------
200 | OK
404 | Table does not exist
452 | Exception on query
#### Livestatus Schema Extensions
Icinga 2 specific extensions are shown below:
New table: `endpoints`
Table | Column
----------|--------------
endpoints | name
endpoints | identity
endpoints | node
endpoints | is_connected
New columns:
Table | Column
----------|--------------
services | check_source
downtimes | triggers
downtimes | trigger_time
commands | custom_variable_names
commands | custom_variable_values
commands | custom_variables
commands | modified_attributes
commands | modified_attributes_list
status | custom_variable_names
status | custom_variable_values
status | custom_variables
Command custom variables reflect the local 'vars' dictionary.
Status custom variables reflect the global 'Vars' constant.
## External Commands List
Additional details can be found in the [Icinga 1.x Documentation](http://docs.icinga.org/latest/en/extcommands2.html)
Command name | Parameters | Description
------------------------------------------|-----------------------------------|--------------------------
PROCESS_HOST_CHECK_RESULT | ;;; (3) |
PROCESS_SERVICE_CHECK_RESULT | ;;;; (4) |
SCHEDULE_HOST_CHECK | ;; (2) |
SCHEDULE_FORCED_HOST_CHECK | ;; (2) |
SCHEDULE_SVC_CHECK | ;;; (3) |
SCHEDULE_FORCED_SVC_CHECK | ;;; (3) |
ENABLE_HOST_CHECK | ; (1) |
DISABLE_HOST_CHECK | ; (1) |
ENABLE_SVC_CHECK | ;; (2) |
DISABLE_SVC_CHECK | ;; (2) |
SHUTDOWN_PROCESS | (0) |
RESTART_PROCESS | (0) |
SCHEDULE_FORCED_HOST_SVC_CHECKS | ;; (2) |
SCHEDULE_HOST_SVC_CHECKS | ;; (2) |
ENABLE_HOST_SVC_CHECKS | ; (1) |
DISABLE_HOST_SVC_CHECKS | ; (1) |
ACKNOWLEDGE_SVC_PROBLEM | ;;;;;;; (7) | Note: Icinga 2 treats all comments as persistent.
ACKNOWLEDGE_SVC_PROBLEM_EXPIRE | ;;;;;;;; (8) | Note: Icinga 2 treats all comments as persistent.
REMOVE_SVC_ACKNOWLEDGEMENT | ;; (2) |
ACKNOWLEDGE_HOST_PROBLEM | ;;;;;; (6) | Note: Icinga 2 treats all comments as persistent.
ACKNOWLEDGE_HOST_PROBLEM_EXPIRE | ;;;;;;; (7) | Note: Icinga 2 treats all comments as persistent.
REMOVE_HOST_ACKNOWLEDGEMENT | ; (1) |
DISABLE_HOST_FLAP_DETECTION | ; (1) |
ENABLE_HOST_FLAP_DETECTION | ; (1) |
DISABLE_SVC_FLAP_DETECTION | ;; (2) |
ENABLE_SVC_FLAP_DETECTION | ;; (2) |
ENABLE_HOSTGROUP_SVC_CHECKS | ; (1) |
DISABLE_HOSTGROUP_SVC_CHECKS | ; (1) |
ENABLE_SERVICEGROUP_SVC_CHECKS | ; (1) |
DISABLE_SERVICEGROUP_SVC_CHECKS | ; (1) |
ENABLE_PASSIVE_HOST_CHECKS | ; (1) |
DISABLE_PASSIVE_HOST_CHECKS | ; (1) |
ENABLE_PASSIVE_SVC_CHECKS | ;; (2) |
DISABLE_PASSIVE_SVC_CHECKS | ;; (2) |
ENABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS | ; (1) |
DISABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS | ; (1) |
ENABLE_HOSTGROUP_PASSIVE_SVC_CHECKS | ; (1) |
DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS | ; (1) |
PROCESS_FILE | ;; (2) |
SCHEDULE_SVC_DOWNTIME | ;;;;;;;;; (9) |
DEL_SVC_DOWNTIME | ; (1) |
SCHEDULE_HOST_DOWNTIME | ;;;;;;;; (8) |
DEL_HOST_DOWNTIME | ; (1) |
SCHEDULE_HOST_SVC_DOWNTIME | ;;;;;;;; (8) |
SCHEDULE_HOSTGROUP_HOST_DOWNTIME | ;;;;;;;; (8) |
SCHEDULE_HOSTGROUP_SVC_DOWNTIME | ;;;;;;;; (8) |
SCHEDULE_SERVICEGROUP_HOST_DOWNTIME | ;;;;;;;; (8) |
SCHEDULE_SERVICEGROUP_SVC_DOWNTIME | ;;;;;;;; (8) |
ADD_HOST_COMMENT | ;;;; (4) | Note: Icinga 2 treats all comments as persistent.
DEL_HOST_COMMENT | ; (1) |
ADD_SVC_COMMENT | ;;;;; (5) | Note: Icinga 2 treats all comments as persistent.
DEL_SVC_COMMENT | ; (1) |
DEL_ALL_HOST_COMMENTS | ; (1) |
DEL_ALL_SVC_COMMENTS | ;; (2) |
SEND_CUSTOM_HOST_NOTIFICATION | ;;;; (4) |
SEND_CUSTOM_SVC_NOTIFICATION | ;;;;; (5) |
DELAY_HOST_NOTIFICATION | ;; (2) |
DELAY_SVC_NOTIFICATION | ;;; (3) |
ENABLE_HOST_NOTIFICATIONS | ; (1) |
DISABLE_HOST_NOTIFICATIONS | ; (1) |
ENABLE_SVC_NOTIFICATIONS | ;; (2) |
DISABLE_SVC_NOTIFICATIONS | ;; (2) |
DISABLE_HOSTGROUP_HOST_CHECKS | ; (1) |
DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS | ; (1) |
DISABLE_SERVICEGROUP_HOST_CHECKS | ; (1) |
DISABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS | ; (1) |
ENABLE_HOSTGROUP_HOST_CHECKS | ; (1) |
ENABLE_HOSTGROUP_PASSIVE_HOST_CHECKS | ; (1) |
ENABLE_SERVICEGROUP_HOST_CHECKS | ; (1) |
ENABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS | ; (1) |
ENABLE_NOTIFICATIONS | (0) |
DISABLE_NOTIFICATIONS | (0) |
ENABLE_FLAP_DETECTION | (0) |
DISABLE_FLAP_DETECTION | (0) |
ENABLE_EVENT_HANDLERS | (0) |
DISABLE_EVENT_HANDLERS | (0) |
ENABLE_PERFORMANCE_DATA | (0) |
DISABLE_PERFORMANCE_DATA | (0) |
START_EXECUTING_HOST_CHECKS | (0) |
STOP_EXECUTING_HOST_CHECKS | (0) |
START_EXECUTING_SVC_CHECKS | (0) |
STOP_EXECUTING_SVC_CHECKS | (0) |
CHANGE_SVC_MODATTR | ;;; (3) |
CHANGE_HOST_MODATTR | ;; (2) |
CHANGE_USER_MODATTR | ;; (2) |
CHANGE_CHECKCOMMAND_MODATTR | ;; (2) |
CHANGE_EVENTCOMMAND_MODATTR | ;; (2) |
CHANGE_NOTIFICATIONCOMMAND_MODATTR | ;; (2) |
CHANGE_NORMAL_SVC_CHECK_INTERVAL | ;;; (3) |
CHANGE_NORMAL_HOST_CHECK_INTERVAL | ;; (2) |
CHANGE_RETRY_SVC_CHECK_INTERVAL | ;;; (3) |
CHANGE_RETRY_HOST_CHECK_INTERVAL | ;; (2) |
ENABLE_HOST_EVENT_HANDLER | ; (1) |
DISABLE_HOST_EVENT_HANDLER | ; (1) |
ENABLE_SVC_EVENT_HANDLER | ;; (2) |
DISABLE_SVC_EVENT_HANDLER | ;; (2) |
CHANGE_HOST_EVENT_HANDLER | ;; (2) |
CHANGE_SVC_EVENT_HANDLER | ;;; (3) |
CHANGE_HOST_CHECK_COMMAND | ;; (2) |
CHANGE_SVC_CHECK_COMMAND | ;;; (3) |
CHANGE_MAX_HOST_CHECK_ATTEMPTS | ;; (2) |
CHANGE_MAX_SVC_CHECK_ATTEMPTS | ;;; (3) |
CHANGE_HOST_CHECK_TIMEPERIOD | ;; (2) |
CHANGE_SVC_CHECK_TIMEPERIOD | ;;; |
CHANGE_CUSTOM_HOST_VAR | ;;; (3) |
CHANGE_CUSTOM_SVC_VAR | ;;;; (4) |
CHANGE_CUSTOM_USER_VAR | ;;; (3) |
CHANGE_CUSTOM_CHECKCOMMAND_VAR | ;;; (3) |
CHANGE_CUSTOM_EVENTCOMMAND_VAR | ;;; (3) |
CHANGE_CUSTOM_NOTIFICATIONCOMMAND_VAR | ;;; (3) |
ENABLE_HOSTGROUP_HOST_NOTIFICATIONS | ;