3 ### <a id="objecttype-host"></a> Host
9 > Unlike in Icinga 1.x hosts are not checkable objects in Icinga 2. Instead
10 > hosts inherit their state from the service that is specified using the `check`
15 object Host "localhost" {
16 display_name = "The best host there is",
18 groups = [ "all-hosts" ],
20 host_dependencies = [ "router" ],
22 service_dependencies = [
23 { host = "db-server", service = "mysql" }
27 templates = [ "ping" ]
31 templates = [ "my-http" ],
34 vhost = "test1.example.org",
45 ----------------|----------------
46 display_name |**Optional.** A short description of the host.
47 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.
48 groups |**Optional.** A list of host groups this host belongs to.
49 host_dependencies|**Optional.** A list of host names which this host depends on. These dependencies are used to determine whether the host is unreachable.
50 service_dependencies|**Optional.** A list of services which this host depends on. Each array element must be a dictionary containing the keys "host" and "service". These dependencies are used to determine whether the host is unreachable.
51 services |**Optional.** Inline definition of services. Each dictionary item specifies a service.<br /><br />The `templates` attribute can be used to specify an array of templates that should be inherited by the service.<br /><br />The new service's name is "hostname:service" - where "service" is the dictionary key in the services dictionary.<br /><br />The dictionary key is used as the service's short name.
52 macros |**Optional.** A dictionary containing macros that are specific to this host.
54 ### <a id="objecttype-hostgroup"></a> HostGroup
60 object HostGroup "my-hosts" {
61 display_name = "My hosts",
67 ----------------|----------------
68 display_name |**Optional.** A short description of the host group.
70 ### <a id="objecttype-service"></a> Service
72 Service objects describe network services and how they should be checked
77 > Rather than creating a `Service` object for a specific host it is usually easier
78 > to just create a `Service` template and using the `services` attribute in the `Host`
79 > object to associate these templates with a host.
83 object Service "localhost-uptime" {
85 short_name = "uptime",
87 display_name = "localhost Uptime",
89 check_command = "check_snmp",
93 oid = "DISMAN-EVENT-MIB::sysUpTimeInstance"
99 servicegroups = [ "all-services", "snmp" ],
105 ----------------|----------------
106 host |**Required.** The host this service belongs to. There must be a `Host` object with that name.
107 short_name |**Required.** The service name. Must be unique on a per-host basis (Similar to the service_description attribute in Icinga 1.x).
108 display_name |**Optional.** A short description of the service.
109 macros |**Optional.** A dictionary containing macros that are specific to this host.
110 check\_command |**Required.** The name of the check command.
111 max\_check\_attempts|**Optional.** The number of times a service is re-checked before changing into a hard state. Defaults to 3.
112 check\_period |**Optional.** The name of a time period which determines when this service should be checked. Not set by default.
113 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.
114 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/5th of the check interval if not specified.
115 enable\_active\_checks|**Optional.** Whether active checks are enabled. Defaults to true.
116 enable\_passive\_checks|**Optional.** Whether passive checks are enabled. Defaults to true.
117 enable\_event\_handler|**Optional.** Enables event handlers for this service. Defaults to true.
118 event\_command |**Optional.** The name of an event command that should be executed every time the service's state changes.
119 flapping\_threshold|TODO
121 host_dependencies|**Optional.** A list of host names which this host depends on. These dependencies are used to determine whether the host is unreachable.
122 service_dependencies|**Optional.** A list of services which this host depends on. Each array element must be a dictionary containing the keys "host" and "service". These dependencies are used to determine whether the host is unreachable.
123 groups |**Optional.** The service groups this service belongs to.
124 notifications |**Optional.** Inline definition of notifications. Each dictionary item specifies a notification.<br /><br />The `templates` attribute can be used to specify an array of templates that should be inherited by the notification object.<br /><br />The new notification object's name is "hostname:service:notification" - where "notification" is the dictionary key in the notifications dictionary.
126 ### <a id="objecttype-servicegroup"></a> ServiceGroup
132 object ServiceGroup "snmp" {
133 display_name = "SNMP services",
139 ----------------|----------------
140 display_name |**Optional.** A short description of the service group.
142 ### <a id="objecttype-notification"></a> Notification
144 Notification objects are used to specify how users should be notified in case
145 of service state changes and other events.
149 > Rather than creating a `Notification` object for a specific service it is usually easier
150 > to just create a `Notification` template and using the `notifications` attribute in the `Service`
151 > object to associate these templates with a service.
155 object Notification "localhost-ping-notification" {
159 notification_command = "mail-notification",
161 users = [ "user1", "user2" ]
167 ----------------|----------------
168 host |**Required.** The name of the host this notification belongs to.
169 service |**Required.** The short name of the service this notification belongs to.
170 macros |**Optional.** A dictionary containing macros that are specific to this notification object.
171 users |**Optional.** A list of user names who should be notified.
172 user_groups |**Optional.** A list of user group names who should be notified.
174 notification_command|TODO
175 notification_interval|TODO
176 notification_period|TODO
177 notification_type_filter|TODO
178 notification_state_filter|TODO
180 ### <a id="objecttype-user"></a> User
186 object User "icingaadmin" {
187 display_name = "Icinga 2 Admin",
188 groups = [ "icingaadmins" ],
190 enable_notifications = 1,
191 notification_period = "24x7",
193 notification_state_filter = (StateFilterWarning |
194 StateFilterCritical |
196 notification_type_filter = (NotificationFilterProblem |
197 NotificationFilterRecovery),
199 "name" = "Icinga 2 Admin",
200 "email" = "icinga@localhost",
201 "pager" = "icingaadmin@localhost.localdomain"
205 notes = "This is the Icinga 2 Admin account.",
213 ----------------|----------------
214 display_name |**Optional.** A short description of the user.
215 macros |**Optional.** A dictionary containing macros that are specific to this user.
216 custom |**Optional.** A dictionary containing custom attributes that are specific to this user.
218 enable_notifications|TODO
219 notification_period|TODO
220 notification_type_filter|TODO
221 notification_state_filter|TODO
223 ### <a id="objecttype-usergroup"></a> UserGroup
229 object UserGroup "icingaadmins" {
230 display_name = "Icinga 2 Admin Group"
236 ----------------|----------------
237 display_name |**Optional.** A short description of the user group.
239 ### <a id="objecttype-timeperiod"></a> TimePeriod
241 Time periods can be used to specify when services should be checked or to limit
242 when notifications should be sent out.
246 object TimePeriod "24x7" inherits "legacy-timeperiod" {
247 display_name = "Icinga 2 24x7 TimePeriod",
249 "monday" = "00:00-24:00",
250 "tuesday" = "00:00-24:00",
251 "wednesday" = "00:00-24:00",
252 "thursday" = "00:00-24:00",
253 "friday" = "00:00-24:00",
254 "saturday" = "00:00-24:00",
255 "sunday" = "00:00-24:00",
262 ----------------|----------------
263 display_name |**Optional.** A short description of the time period.
264 methods |**Required.** The "update" script method takes care of updating the internal representation of the time period. In virtually all cases you should just inherit from the "legacy-timeperiod" template to take care of this setting.
267 The `/etc/icinga2/conf.d/timeperiods.conf` file is usually used to define
268 timeperiods including this one.
271 ### <a id="objecttype-consolelogger"></a> ConsoleLogger
273 Specifies Icinga 2 logging to the console.
277 object ConsoleLogger "my-debug-console" {
284 ----------------|----------------
285 severity |**Optional.** The minimum severity for this log. Can be "debug", "information", "warning" or "critical". Defaults to "information".
287 ### <a id="objecttype-filelogger"></a> FileLogger
289 Specifies Icinga 2 logging to a file.
293 object FileLogger "my-debug-file" {
295 path = "/var/log/icinga2/icinga2-debug.log"
301 ----------------|----------------
302 path |**Required.** The log path.
303 severity |**Optional.** The minimum severity for this log. Can be "debug", "information", "warning" or "critical". Defaults to "information".
305 ### <a id="objecttype-sysloglogger"></a> SyslogLogger
307 Specifies Icinga 2 logging to syslog.
311 object SyslogLogger "my-crit-syslog" {
312 severity = "critical"
318 ----------------|----------------
319 severity |**Optional.** The minimum severity for this log. Can be "debug", "information", "warning" or "critical". Defaults to "information".
321 ### <a id="objecttype-checkcommand"></a> CheckCommand
323 A check command definition. Additional default command macros can be
328 object CheckCommand "check_snmp" inherits "plugin-check-command" {
329 command = "$plugindir$/check_snmp -H $address$ -C $community$ -o $oid$",
332 address = "127.0.0.1",
333 community = "public",
340 ----------------|----------------
341 methods |**Required.** The "execute" script method takes care of executing the check. In virtually all cases you should just inherit from the "plugin-check-command" template to take care of this setting.
342 command |**Required.** The command. This can either be an array of individual command arguments. Alternatively a string can be specified in which case the shell interpreter (usually /bin/sh) takes care of parsing the command.
343 export_macros |**Optional.** A list of macros which should be exported as environment variables prior to executing the command.
344 escape_macros |**Optional.** A list of macros which should be shell-escaped in the command.
345 macros |**Optional.** A dictionary containing macros that are specific to this command.
346 timeout |**Optional.** The command timeout in seconds. Defaults to 5 minutes.
348 ### <a id="objecttype-notificationcommand"></a> NotificationCommand
350 A notification command definition.
354 object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" {
356 "/opt/bin/send-mail-notification",
358 "$NOTIFICATIONTYPE$ - $HOSTNAME$ - $SERVICEDESC$ - $SERVICESTATE$",
359 {{{***** Icinga *****
361 Notification Type: $NOTIFICATIONTYPE$
363 Service: $SERVICEDESC$
365 Address: $HOSTADDRESS$
366 State: $SERVICESTATE$
368 Date/Time: $LONGDATETIME$
370 Additional Info: $SERVICEOUTPUT$
372 Comment: [$NOTIFICATIONAUTHORNAME$] $NOTIFICATIONCOMMENT$}}}
379 ----------------|----------------
380 methods |**Required.** The "execute" script method takes care of executing the notification. In virtually all cases you should just inherit from the "plugin-notification-command" template to take care of this setting.
381 command |**Required.** The command. This can either be an array of individual command arguments. Alternatively a string can be specified in which case the shell interpreter (usually /bin/sh) takes care of parsing the command.
382 export_macros |**Optional.** A list of macros which should be exported as environment variables prior to executing the command.
383 escape_macros |**Optional.** A list of macros which should be shell-escaped in the command.
384 macros |**Optional.** A dictionary containing macros that are specific to this command.
385 timeout |**Optional.** The command timeout in seconds. Defaults to 5 minutes.
387 ### <a id="objecttype-eventcommand"></a> EventCommand
389 An event command definition.
393 > Similar to Icinga 1.x event handlers.
397 object EventCommand "restart-httpd-event" inherits "plugin-event-command" {
398 command = "/opt/bin/restart-httpd.sh",
405 ----------------|----------------
406 methods |**Required.** The "execute" script method takes care of executing the event handler. In virtually all cases you should just inherit from the "plugin-event-command" template to take care of this setting.
407 command |**Required.** The command. This can either be an array of individual command arguments. Alternatively a string can be specified in which case the shell interpreter (usually /bin/sh) takes care of parsing the command.
408 export_macros |**Optional.** A list of macros which should be exported as environment variables prior to executing the command.
409 escape_macros |**Optional.** A list of macros which should be shell-escaped in the command.
410 macros |**Optional.** A dictionary containing macros that are specific to this command.
411 timeout |**Optional.** The command timeout in seconds. Defaults to 5 minutes.
413 ### <a id="objecttype-perfdatawriter"></a> PerfdataWriter
415 Writes check result performance data to a defined path using macro
422 object PerfdataWriter "pnp" {
423 perfdata_path = "/var/spool/icinga2/perfdata/service-perfdata",
425 format_template = "DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$",
427 rotation_interval = 15s,
433 ----------------|----------------
434 perfdata\_path |**Optional.** Path to the service performance data file. Defaults to IcingaLocalStateDir + "/cache/icinga2/perfdata/perfdata".
435 format\_template|**Optional.** Format template for the performance data file. Defaults to a template that's suitable for use with PNP4Nagios.
436 rotation\_interval|**Optional.** Rotation interval for the file specified in `perfdata\_path`. Defaults to 30 seconds.
440 > When rotating the performance data file the current UNIX timestamp is appended to the path specified
441 > in `perfdata\_path` to generate a unique filename.
443 ### <a id="objecttype-graphitewriter"></a> GraphiteWriter
445 Writes check result metrics and performance data to a defined
446 Graphite Carbon host.
452 object GraphiteWriter "graphite" {
460 ----------------|----------------
461 host |**Optional.** Graphite Carbon host address. Defaults to '127.0.0.1'.
462 port |**Optional.** Graphite Carbon port. Defaults to 2003.
464 ### <a id="objecttype-idomysqlconnection"></a> IdoMySqlConnection
466 IDO DB schema compatible output into MySQL database.
470 library "db_ido_mysql"
472 object IdoMysqlConnection "mysql-ido" {
478 table_prefix = "icinga_",
479 instance_name = "icinga2",
480 instance_description = "icinga2 dev instance",
483 downtimehistory_age = 48h,
484 logentries_age = 31d,
491 ----------------|----------------
492 host |**Optional.** MySQL database host address. Defaults to "localhost".
493 port |**Optional.** MySQL database port. Defaults to 3306.
494 user |**Optional.** MySQL database user with read/write permission to the icinga database. Defaults to "icinga".
495 password |**Optional.** MySQL database user's password. Defaults to "icinga".
496 database |**Optional.** MySQL database name. Defaults to "icinga".
497 table\_prefix |**Optional.** MySQL database table prefix. Defaults to "icinga\_".
498 instance\_name |**Optional.** Unique identifier for the local Icinga 2 instance. Defaults to "default".
499 instance\_description|**Optional.** Description for the Icinga 2 instance.
500 cleanup |**Optional.** Dictionary with items for historical table cleanup.
505 ----------------|----------------
506 acknowledgement_age |**Optional.** Max age for acknowledgement table rows (entry_time). Defaults to 0 (never).
507 commenthistory_age |**Optional.** Max age for commenthistory table rows (entry_time). Defaults to 0 (never).
508 contactnotifications_age |**Optional.** Max age for contactnotifications table rows (start_time). Defaults to 0 (never).
509 contactnotificationmethods_age |**Optional.** Max age for contactnotificationmethods table rows (start_time). Defaults to 0 (never).
510 downtimehistory_age |**Optional.** Max age for downtimehistory table rows (entry_time). Defaults to 0 (never).
511 eventhandlers_age |**Optional.** Max age for eventhandlers table rows (start_time). Defaults to 0 (never).
512 externalcommands_age |**Optional.** Max age for externalcommands table rows (entry_time). Defaults to 0 (never).
513 flappinghistory_age |**Optional.** Max age for flappinghistory table rows (event_time). Defaults to 0 (never).
514 hostchecks_age |**Optional.** Max age for hostchecks table rows (start_time). Defaults to 0 (never).
515 logentries_age |**Optional.** Max age for logentries table rows (logentry_time). Defaults to 0 (never).
516 notifications_age |**Optional.** Max age for notifications table rows (start_time). Defaults to 0 (never).
517 processevents_age |**Optional.** Max age for processevents table rows (event_time). Defaults to 0 (never).
518 statehistory_age |**Optional.** Max age for statehistory table rows (state_time). Defaults to 0 (never).
519 servicechecks_age |**Optional.** Max age for servicechecks table rows (start_time). Defaults to 0 (never).
520 systemcommands_age |**Optional.** Max age for systemcommands table rows (start_time). Defaults to 0 (never).
522 ### <a id="objecttype-livestatuslistener"></a> LiveStatusListener
524 Livestatus API interface available as TCP or UNIX socket.
530 object LivestatusListener "livestatus-tcp" {
532 bind_host = "127.0.0.1",
536 object LivestatusListener "livestatus-unix" {
537 socket_type = "unix",
538 socket_path = "/var/run/icinga2/livestatus"
544 ----------------|----------------
545 socket\_type |**Optional.** Specifies the socket type. Can be either "tcp" or "unix". Defaults to "unix".
546 bind\_host |**Optional.** Only valid when socket\_type is "tcp". Host address to listen on for connections. Defaults to "127.0.0.1".
547 bind\_port |**Optional.** Only valid when `socket\_type` is "tcp". Port to listen on for connections. Defaults to 6558.
548 socket\_path |**Optional.** Only valid when `socket\_type` is "unix". Specifies the path to the UNIX socket file. Defaults to IcingaLocalStateDir + "/run/icinga2/livestatus".
552 > UNIX sockets are not supported on Windows.
554 ### <a id="objecttype-statusdatawriter"></a> StatusDataWriter
556 Periodically writes status data files which are used by the Classic UI and other third-party tools.
562 object StatusDataWriter "status" {
563 status\_path = "/var/cache/icinga2/status.dat",
564 objects\_path = "/var/cache/icinga2/objects.path"
570 ----------------|----------------
571 status\_path |**Optional.** Path to the status.dat file. Defaults to IcingaLocalStateDir + "/cache/icinga2/status.dat".
572 objects\_path |**Optional.** Path to the objects.cache file. Defaults to IcingaLocalStateDir + "/cache/icinga2/objects.cache".
574 ### <a id="objecttype-externalcommandlistener"></a> ExternalCommandListener
576 Implements the Icinga 1.x command pipe which can be used to send commands to Icinga.
582 object ExternalCommandListener "external" {
583 command\_path = "/var/run/icinga2/cmd/icinga2.cmd"
589 ----------------|----------------
590 command\_path |**Optional.** Path to the command pipe. Defaults to IcingaLocalStateDir + "/run/icinga2/cmd/icinga2.cmd".
592 ### <a id="objecttype-compatlogger"></a> CompatLogger
594 Writes log files in a format that's compatible with Icinga 1.x.
600 object CompatLogger "my-log" {
601 log\_dir = "/var/log/icinga2/compat",
602 rotation\_method = "HOURLY"
608 ----------------|----------------
609 log\_dir |**Optional.** Path to the compat log directory. Defaults to IcingaLocalStateDir + "/log/icinga2/compat".
610 rotation\_method|**Optional.** Specifies when to rotate log files. Can be one of "HOURLY", "DAILY", "WEEKLY" or "MONTHLY". Defaults to "HOURLY".
612 ### <a id="objecttype-checkresultreader"></a> CheckResultReader
614 Reads Icinga 1.x check results from a directory. This functionality is provided
615 to help existing Icinga 1.x users and might be useful for certain cluster
622 object CheckResultReader "reader" {
623 spool_dir = "/data/check-results"
629 ----------------|----------------
630 spool\_dir |**Optional.** The directory which contains the check result files. Defaults to IcingaLocalStateDir + "/lib/icinga2/spool/checkresults/".
632 ### <a id="objecttype-checkcomponent"></a> CheckerComponent
634 The checker component is responsible for scheduling active checks. There are no configurable options.
640 object CheckerComponent "checker" { }
642 ### <a id="objecttype-notificationcomponent"></a> NotificationComponent
644 The notification component is responsible for sending notifications. There are no configurable options.
648 library "notification"
650 object NotificationComponent "notification" { }
652 ### <a id="objecttype-clusterlistener"></a> ClusterListener
663 ----------------|----------------
671 ### <a id="objecttype-endpoint"></a> Endpoint
673 Endpoint objects are used to specify connection information for remote
680 object Endpoint "icinga-c2" {
681 node = "192.168.5.46",
688 ----------------|----------------
689 node |**Required.** The hostname/IP address of the remote Icinga 2 instance.
690 service |**Required.** The service name/port of the remote Icinga 2 instance.
692 accept\_config |**Optional.** A list of endpoint names from which this endpoint accepts configuration files.
694 ### <a id="objecttype-domain"></a> Domain
705 ----------------|----------------