]> granicus.if.org Git - icinga2/blob - doc/15-features.md
f01c54d747683a1482275b022171c48f2c0d5b74
[icinga2] / doc / 15-features.md
1 # <a id="icinga2-features"></a> Icinga 2 Features
2
3 ## <a id="logging"></a> Logging
4
5 Icinga 2 supports three different types of logging:
6
7 * File logging
8 * Syslog (on *NIX-based operating systems)
9 * Console logging (`STDOUT` on tty)
10
11 You can enable additional loggers using the `icinga2 feature enable`
12 and `icinga2 feature disable` commands to configure loggers:
13
14 Feature  | Description
15 ---------|------------
16 debuglog | Debug log (path: `/var/log/icinga2/debug.log`, severity: `debug` or higher)
17 mainlog  | Main log (path: `/var/log/icinga2/icinga2.log`, severity: `information` or higher)
18 syslog   | Syslog (severity: `warning` or higher)
19
20 By default file the `mainlog` feature is enabled. When running Icinga 2
21 on a terminal log messages with severity `information` or higher are
22 written to the console.
23
24 ## <a id="db-ido"></a> DB IDO
25
26 The IDO (Icinga Data Output) modules for Icinga 2 take care of exporting all
27 configuration and status information into a database. The IDO database is used
28 by a number of projects including Icinga Web 1.x and 2.
29
30 Details on the installation can be found in the [Configuring DB IDO](2-getting-started.md#configuring-db-ido-mysql)
31 chapter. Details on the configuration can be found in the
32 [IdoMysqlConnection](6-object-types.md#objecttype-idomysqlconnection) and
33 [IdoPgsqlConnection](6-object-types.md#objecttype-idopgsqlconnection)
34 object configuration documentation.
35 The DB IDO feature supports [High Availability](13-distributed-monitoring-ha.md#high-availability-db-ido) in
36 the Icinga 2 cluster.
37
38 The following example query checks the health of the current Icinga 2 instance
39 writing its current status to the DB IDO backend table `icinga_programstatus`
40 every 10 seconds. By default it checks 60 seconds into the past which is a reasonable
41 amount of time -- adjust it for your requirements. If the condition is not met,
42 the query returns an empty result.
43
44 > **Tip**
45 >
46 > Use [check plugins](14-addons-plugins.md#plugins) to monitor the backend.
47
48 Replace the `default` string with your instance name if different.
49
50 Example for MySQL:
51
52     # mysql -u root -p icinga -e "SELECT status_update_time FROM icinga_programstatus ps
53       JOIN icinga_instances i ON ps.instance_id=i.instance_id
54       WHERE (UNIX_TIMESTAMP(ps.status_update_time) > UNIX_TIMESTAMP(NOW())-60)
55       AND i.instance_name='default';"
56
57     +---------------------+
58     | status_update_time  |
59     +---------------------+
60     | 2014-05-29 14:29:56 |
61     +---------------------+
62
63
64 Example for PostgreSQL:
65
66     # export PGPASSWORD=icinga; psql -U icinga -d icinga -c "SELECT ps.status_update_time FROM icinga_programstatus AS ps
67       JOIN icinga_instances AS i ON ps.instance_id=i.instance_id
68       WHERE ((SELECT extract(epoch from status_update_time) FROM icinga_programstatus) > (SELECT extract(epoch from now())-60))
69       AND i.instance_name='default'";
70
71     status_update_time
72     ------------------------
73      2014-05-29 15:11:38+02
74     (1 Zeile)
75
76
77 A detailed list on the available table attributes can be found in the [DB IDO Schema documentation](23-appendix.md#schema-db-ido).
78
79
80 ## <a id="external-commands"></a> External Commands
81
82 Icinga 2 provides an external command pipe for processing commands
83 triggering specific actions (for example rescheduling a service check
84 through the web interface).
85
86 In order to enable the `ExternalCommandListener` configuration use the
87 following command and restart Icinga 2 afterwards:
88
89     # icinga2 feature enable command
90
91 Icinga 2 creates the command pipe file as `/var/run/icinga2/cmd/icinga2.cmd`
92 using the default configuration.
93
94 Web interfaces and other Icinga addons are able to send commands to
95 Icinga 2 through the external command pipe, for example for rescheduling
96 a forced service check:
97
98     # /bin/echo "[`date +%s`] SCHEDULE_FORCED_SVC_CHECK;localhost;ping4;`date +%s`" >> /var/run/icinga2/cmd/icinga2.cmd
99
100     # tail -f /var/log/messages
101
102     Oct 17 15:01:25 icinga-server icinga2: Executing external command: [1382014885] SCHEDULE_FORCED_SVC_CHECK;localhost;ping4;1382014885
103     Oct 17 15:01:25 icinga-server icinga2: Rescheduling next check for service 'ping4'
104
105 A list of currently supported external commands can be found [here](23-appendix.md#external-commands-list-detail).
106
107 Detailed information on the commands and their required parameters can be found
108 on the [Icinga 1.x documentation](http://docs.icinga.org/latest/en/extcommands2.html).
109
110 ## <a id="performance-data"></a> Performance Data
111
112 When a host or service check is executed plugins should provide so-called
113 `performance data`. Next to that additional check performance data
114 can be fetched using Icinga 2 runtime macros such as the check latency
115 or the current service state (or additional custom attributes).
116
117 The performance data can be passed to external applications which aggregate and
118 store them in their backends. These tools usually generate graphs for historical
119 reporting and trending.
120
121 Well-known addons processing Icinga performance data are [PNP4Nagios](14-addons-plugins.md#addons-graphing-pnp),
122 [Graphite](14-addons-plugins.md#addons-graphing-graphite) or [OpenTSDB](15-features.md#opentsdb-writer).
123
124 ### <a id="writing-performance-data-files"></a> Writing Performance Data Files
125
126 PNP4Nagios and Graphios use performance data collector daemons to fetch
127 the current performance files for their backend updates.
128
129 Therefore the Icinga 2 [PerfdataWriter](6-object-types.md#objecttype-perfdatawriter)
130 feature allows you to define the output template format for host and services helped
131 with Icinga 2 runtime vars.
132
133     host_format_template = "DATATYPE::HOSTPERFDATA\tTIMET::$icinga.timet$\tHOSTNAME::$host.name$\tHOSTPERFDATA::$host.perfdata$\tHOSTCHECKCOMMAND::$host.check_command$\tHOSTSTATE::$host.state$\tHOSTSTATETYPE::$host.state_type$"
134     service_format_template = "DATATYPE::SERVICEPERFDATA\tTIMET::$icinga.timet$\tHOSTNAME::$host.name$\tSERVICEDESC::$service.name$\tSERVICEPERFDATA::$service.perfdata$\tSERVICECHECKCOMMAND::$service.check_command$\tHOSTSTATE::$host.state$\tHOSTSTATETYPE::$host.state_type$\tSERVICESTATE::$service.state$\tSERVICESTATETYPE::$service.state_type$"
135
136 The default templates are already provided with the Icinga 2 feature configuration
137 which can be enabled using
138
139     # icinga2 feature enable perfdata
140
141 By default all performance data files are rotated in a 15 seconds interval into
142 the `/var/spool/icinga2/perfdata/` directory as `host-perfdata.<timestamp>` and
143 `service-perfdata.<timestamp>`.
144 External collectors need to parse the rotated performance data files and then
145 remove the processed files.
146
147 ### <a id="graphite-carbon-cache-writer"></a> Graphite Carbon Cache Writer
148
149 While there are some [Graphite](14-addons-plugins.md#addons-graphing-graphite)
150 collector scripts and daemons like Graphios available for Icinga 1.x it's more
151 reasonable to directly process the check and plugin performance
152 in memory in Icinga 2. Once there are new metrics available, Icinga 2 will directly
153 write them to the defined Graphite Carbon daemon tcp socket.
154
155 You can enable the feature using
156
157     # icinga2 feature enable graphite
158
159 By default the [GraphiteWriter](6-object-types.md#objecttype-graphitewriter) feature
160 expects the Graphite Carbon Cache to listen at `127.0.0.1` on TCP port `2003`.
161
162 #### <a id="graphite-carbon-cache-writer-schema"></a> Current Graphite Schema
163
164 The current naming schema is defined as follows. The official Icinga Web 2 Graphite
165 module will use that schema too.
166
167 The default prefix for hosts and services is configured using
168 [runtime macros](3-monitoring-basics.md#runtime-macros)like this:
169
170     icinga2.$host.name$.host.$host.check_command$
171     icinga2.$host.name$.services.$service.name$.$service.check_command$
172
173 You can customize the prefix name by using the `host_name_template` and
174 `service_name_template` configuration attributes.
175
176 The additional levels will allow fine granular filters and also template
177 capabilities, e.g. by using the check command `disk` for specific
178 graph templates in web applications rendering the Graphite data.
179
180 The following characters are escaped in prefix labels:
181
182   Character     | Escaped character
183   --------------|--------------------------
184   whitespace    | _
185   .             | _
186   \             | _
187   /             | _
188
189 Metric values are stored like this:
190
191     <prefix>.perfdata.<perfdata-label>.value
192
193 The following characters are escaped in perfdata labels:
194
195   Character     | Escaped character
196   --------------|--------------------------
197   whitespace    | _
198   \             | _
199   /             | _
200   ::            | .
201
202 Note that perfdata labels may contain dots (`.`) allowing to
203 add more subsequent levels inside the Graphite tree.
204 `::` adds support for [multi performance labels](http://my-plugin.de/wiki/projects/check_multi/configuration/performance)
205 and is therefore replaced by `.`.
206
207 By enabling `enable_send_thresholds` Icinga 2 automatically adds the following threshold metrics:
208
209     <prefix>.perfdata.<perfdata-label>.min
210     <prefix>.perfdata.<perfdata-label>.max
211     <prefix>.perfdata.<perfdata-label>.warn
212     <prefix>.perfdata.<perfdata-label>.crit
213
214 By enabling `enable_send_metadata` Icinga 2 automatically adds the following metadata metrics:
215
216     <prefix>.metadata.current_attempt
217     <prefix>.metadata.downtime_depth
218     <prefix>.metadata.acknowledgement
219     <prefix>.metadata.execution_time
220     <prefix>.metadata.latency
221     <prefix>.metadata.max_check_attempts
222     <prefix>.metadata.reachable
223     <prefix>.metadata.state
224     <prefix>.metadata.state_type
225
226 Metadata metric overview:
227
228   metric             | description
229   -------------------|------------------------------------------
230   current_attempt    | current check attempt
231   max_check_attempts | maximum check attempts until the hard state is reached
232   reachable          | checked object is reachable
233   downtime_depth     | number of downtimes this object is in
234   acknowledgement    | whether the object is acknowledged or not
235   execution_time     | check execution time
236   latency            | check latency
237   state              | current state of the checked object
238   state_type         | 0=SOFT, 1=HARD state
239
240 The following example illustrates how to configure the storage schemas for Graphite Carbon
241 Cache.
242
243     [icinga2_default]
244     # intervals like PNP4Nagios uses them per default
245     pattern = ^icinga2\.
246     retentions = 1m:2d,5m:10d,30m:90d,360m:4y
247
248 #### <a id="graphite-carbon-cache-writer-schema-legacy"></a> Graphite Schema < 2.4
249
250 In order to restore the old legacy schema, you'll need to adopt the `GraphiteWriter`
251 configuration:
252
253     object GraphiteWriter "graphite" {
254
255       enable_legacy_mode = true
256
257       host_name_template = "icinga.$host.name$"
258       service_name_template = "icinga.$host.name$.$service.name$"
259     }
260
261 The old legacy naming schema is
262
263     icinga.<hostname>.<metricname>
264     icinga.<hostname>.<servicename>.<metricname>
265
266 You can customize the metric prefix name by using the `host_name_template` and
267 `service_name_template` configuration attributes.
268
269 The example below uses [runtime macros](3-monitoring-basics.md#runtime-macros) and a
270 [global constant](18-language-reference.md#constants) named `GraphiteEnv`. The constant name
271 is freely definable and should be put in the [constants.conf](4-configuring-icinga-2.md#constants-conf) file.
272
273     const GraphiteEnv = "icinga.env1"
274
275     object GraphiteWriter "graphite" {
276       host_name_template = GraphiteEnv + ".$host.name$"
277       service_name_template = GraphiteEnv + ".$host.name$.$service.name$"
278     }
279
280 To make sure Icinga 2 writes a valid label into Graphite some characters are replaced
281 with `_` in the target name:
282
283     \/.-  (and space)
284
285 The resulting name in Graphite might look like:
286
287     www-01 / http-cert / response time
288     icinga.www_01.http_cert.response_time
289
290 In addition to the performance data retrieved from the check plugin, Icinga 2 sends
291 internal check statistic data to Graphite:
292
293   metric             | description
294   -------------------|------------------------------------------
295   current_attempt    | current check attempt
296   max_check_attempts | maximum check attempts until the hard state is reached
297   reachable          | checked object is reachable
298   downtime_depth     | number of downtimes this object is in
299   acknowledgement    | whether the object is acknowledged or not
300   execution_time     | check execution time
301   latency            | check latency
302   state              | current state of the checked object
303   state_type         | 0=SOFT, 1=HARD state
304
305 The following example illustrates how to configure the storage-schemas for Graphite Carbon
306 Cache. Please make sure that the order is correct because the first match wins.
307
308     [icinga_internals]
309     pattern = ^icinga\..*\.(max_check_attempts|reachable|current_attempt|execution_time|latency|state|state_type)
310     retentions = 5m:7d
311
312     [icinga_default]
313     # intervals like PNP4Nagios uses them per default
314     pattern = ^icinga\.
315     retentions = 1m:2d,5m:10d,30m:90d,360m:4y
316
317 ### <a id="influxdb-writer"></a> InfluxDB Writer
318
319 Once there are new metrics available, Icinga 2 will directly write them to the
320 defined InfluxDB HTTP API.
321
322 You can enable the feature using
323
324     # icinga2 feature enable influxdb
325
326 By default the [InfluxdbWriter](6-object-types.md#objecttype-influxdbwriter) feature
327 expects the InfluxDB daemon to listen at `127.0.0.1` on port `8086`.
328
329 More configuration details can be found [here](6-object-types.md#objecttype-influxdbwriter).
330
331 ### <a id="gelfwriter"></a> GELF Writer
332
333 The `Graylog Extended Log Format` (short: [GELF](http://www.graylog2.org/resources/gelf))
334 can be used to send application logs directly to a TCP socket.
335
336 While it has been specified by the [graylog2](http://www.graylog2.org/) project as their
337 [input resource standard](http://www.graylog2.org/resources/gelf), other tools such as
338 [Logstash](http://www.logstash.net) also support `GELF` as
339 [input type](http://logstash.net/docs/latest/inputs/gelf).
340
341 You can enable the feature using
342
343     # icinga2 feature enable gelf
344
345 By default the `GelfWriter` object expects the GELF receiver to listen at `127.0.0.1` on TCP port `12201`.
346 The default `source`  attribute is set to `icinga2`. You can customize that for your needs if required.
347
348 Currently these events are processed:
349 * Check results
350 * State changes
351 * Notifications
352
353 ### <a id="opentsdb-writer"></a> OpenTSDB Writer
354
355 While there are some OpenTSDB collector scripts and daemons like tcollector available for
356 Icinga 1.x it's more reasonable to directly process the check and plugin performance
357 in memory in Icinga 2. Once there are new metrics available, Icinga 2 will directly
358 write them to the defined TSDB TCP socket.
359
360 You can enable the feature using
361
362     # icinga2 feature enable opentsdb
363
364 By default the `OpenTsdbWriter` object expects the TSD to listen at
365 `127.0.0.1` on port `4242`.
366
367 The current naming schema is
368
369     icinga.host.<metricname>
370     icinga.service.<servicename>.<metricname>
371
372 for host and service checks. The tag host is always applied.
373
374 To make sure Icinga 2 writes a valid metric into OpenTSDB some characters are replaced
375 with `_` in the target name:
376
377     \  (and space)
378
379 The resulting name in OpenTSDB might look like:
380
381     www-01 / http-cert / response time
382     icinga.http_cert.response_time
383
384 In addition to the performance data retrieved from the check plugin, Icinga 2 sends
385 internal check statistic data to OpenTSDB:
386
387   metric             | description
388   -------------------|------------------------------------------
389   current_attempt    | current check attempt
390   max_check_attempts | maximum check attempts until the hard state is reached
391   reachable          | checked object is reachable
392   downtime_depth     | number of downtimes this object is in
393   acknowledgement    | whether the object is acknowledged or not
394   execution_time     | check execution time
395   latency            | check latency
396   state              | current state of the checked object
397   state_type         | 0=SOFT, 1=HARD state
398
399 While reachable, state and state_type are metrics for the host or service the
400 other metrics follow the current naming schema
401
402     icinga.check.<metricname>
403
404 with the following tags
405
406   tag     | description
407   --------|------------------------------------------
408   type    | the check type, one of [host, service]
409   host    | hostname, the check ran on
410   service | the service name (if type=service)
411
412 > **Note**
413 >
414 > You might want to set the tsd.core.auto_create_metrics setting to `true`
415 > in your opentsdb.conf configuration file.
416
417
418 ## <a id="setting-up-livestatus"></a> Livestatus
419
420 The [MK Livestatus](http://mathias-kettner.de/checkmk_livestatus.html) project
421 implements a query protocol that lets users query their Icinga instance for
422 status information. It can also be used to send commands.
423
424 > **Tip**
425 >
426 > Only install the Livestatus feature if your web interface or addon requires
427 > you to do so (for example, [Icinga Web 2](2-getting-started.md#setting-up-icingaweb2)).
428 > Icinga Classic UI 1.x and Icinga Web 1.x do not use Livestatus as backend.
429
430 The Livestatus component that is distributed as part of Icinga 2 is a
431 re-implementation of the Livestatus protocol which is compatible with MK
432 Livestatus.
433
434 Details on the available tables and attributes with Icinga 2 can be found
435 in the [Livestatus Schema](23-appendix.md#schema-livestatus) section.
436
437 You can enable Livestatus using icinga2 feature enable:
438
439     # icinga2 feature enable livestatus
440
441 After that you will have to restart Icinga 2:
442
443 Debian/Ubuntu, RHEL/CentOS 6 and SUSE:
444
445     # service icinga2 restart
446
447 RHEL/CentOS 7 and Fedora:
448
449     # systemctl restart icinga2
450
451 By default the Livestatus socket is available in `/var/run/icinga2/cmd/livestatus`.
452
453 In order for queries and commands to work you will need to add your query user
454 (e.g. your web server) to the `icingacmd` group:
455
456     # usermod -a -G icingacmd www-data
457
458 The Debian packages use `nagios` as the user and group name. Make sure to change `icingacmd` to
459 `nagios` if you're using Debian.
460
461 Change `www-data` to the user you're using to run queries.
462
463 In order to use the historical tables provided by the livestatus feature (for example, the
464 `log` table) you need to have the `CompatLogger` feature enabled. By default these logs
465 are expected to be in `/var/log/icinga2/compat`. A different path can be set using the
466 `compat_log_path` configuration attribute.
467
468     # icinga2 feature enable compatlog
469
470
471 ### <a id="livestatus-sockets"></a> Livestatus Sockets
472
473 Other to the Icinga 1.x Addon, Icinga 2 supports two socket types
474
475 * Unix socket (default)
476 * TCP socket
477
478 Details on the configuration can be found in the [LivestatusListener](6-object-types.md#objecttype-livestatuslistener)
479 object configuration.
480
481 ### <a id="livestatus-get-queries"></a> Livestatus GET Queries
482
483 > **Note**
484 >
485 > All Livestatus queries require an additional empty line as query end identifier.
486 > The `nc` tool (`netcat`) provides the `-U` parameter to communicate using
487 > a unix socket.
488
489 There also is a Perl module available in CPAN for accessing the Livestatus socket
490 programmatically: [Monitoring::Livestatus](http://search.cpan.org/~nierlein/Monitoring-Livestatus-0.74/)
491
492
493 Example using the unix socket:
494
495     # echo -e "GET services\n" | /usr/bin/nc -U /var/run/icinga2/cmd/livestatus
496
497 Example using the tcp socket listening on port `6558`:
498
499     # echo -e 'GET services\n' | netcat 127.0.0.1 6558
500
501     # cat servicegroups <<EOF
502     GET servicegroups
503
504     EOF
505
506     (cat servicegroups; sleep 1) | netcat 127.0.0.1 6558
507
508
509 ### <a id="livestatus-command-queries"></a> Livestatus COMMAND Queries
510
511 A list of available external commands and their parameters can be found [here](23-appendix.md#external-commands-list-detail)
512
513     $ echo -e 'COMMAND <externalcommandstring>' | netcat 127.0.0.1 6558
514
515
516 ### <a id="livestatus-filters"></a> Livestatus Filters
517
518 and, or, negate
519
520   Operator  | Negate   | Description
521   ----------|------------------------
522    =        | !=       | Equality
523    ~        | !~       | Regex match
524    =~       | !=~      | Equality ignoring case
525    ~~       | !~~      | Regex ignoring case
526    <        |          | Less than
527    >        |          | Greater than
528    <=       |          | Less than or equal
529    >=       |          | Greater than or equal
530
531
532 ### <a id="livestatus-stats"></a> Livestatus Stats
533
534 Schema: "Stats: aggregatefunction aggregateattribute"
535
536   Aggregate Function | Description
537   -------------------|--------------
538   sum                | &nbsp;
539   min                | &nbsp;
540   max                | &nbsp;
541   avg                | sum / count
542   std                | standard deviation
543   suminv             | sum (1 / value)
544   avginv             | suminv / count
545   count              | ordinary default for any stats query if not aggregate function defined
546
547 Example:
548
549     GET hosts
550     Filter: has_been_checked = 1
551     Filter: check_type = 0
552     Stats: sum execution_time
553     Stats: sum latency
554     Stats: sum percent_state_change
555     Stats: min execution_time
556     Stats: min latency
557     Stats: min percent_state_change
558     Stats: max execution_time
559     Stats: max latency
560     Stats: max percent_state_change
561     OutputFormat: json
562     ResponseHeader: fixed16
563
564 ### <a id="livestatus-output"></a> Livestatus Output
565
566 * CSV
567
568 CSV output uses two levels of array separators: The members array separator
569 is a comma (1st level) while extra info and host|service relation separator
570 is a pipe (2nd level).
571
572 Separators can be set using ASCII codes like:
573
574     Separators: 10 59 44 124
575
576 * JSON
577
578 Default separators.
579
580 ### <a id="livestatus-error-codes"></a> Livestatus Error Codes
581
582   Code      | Description
583   ----------|--------------
584   200       | OK
585   404       | Table does not exist
586   452       | Exception on query
587
588 ### <a id="livestatus-tables"></a> Livestatus Tables
589
590   Table         | Join      |Description
591   --------------|-----------|----------------------------
592   hosts         | &nbsp;    | host config and status attributes, services counter
593   hostgroups    | &nbsp;    | hostgroup config, status attributes and host/service counters
594   services      | hosts     | service config and status attributes
595   servicegroups | &nbsp;    | servicegroup config, status attributes and service counters
596   contacts      | &nbsp;    | contact config and status attributes
597   contactgroups | &nbsp;    | contact config, members
598   commands      | &nbsp;    | command name and line
599   status        | &nbsp;    | programstatus, config and stats
600   comments      | services  | status attributes
601   downtimes     | services  | status attributes
602   timeperiods   | &nbsp;    | name and is inside flag
603   endpoints     | &nbsp;    | config and status attributes
604   log           | services, hosts, contacts, commands | parses [compatlog](6-object-types.md#objecttype-compatlogger) and shows log attributes
605   statehist     | hosts, services | parses [compatlog](6-object-types.md#objecttype-compatlogger) and aggregates state change attributes
606   hostsbygroup  | hostgroups | host attributes grouped by hostgroup and its attributes
607   servicesbygroup | servicegroups | service attributes grouped by servicegroup and its attributes
608   servicesbyhostgroup  | hostgroups | service attributes grouped by hostgroup and its attributes
609
610 The `commands` table is populated with `CheckCommand`, `EventCommand` and `NotificationCommand` objects.
611
612 A detailed list on the available table attributes can be found in the [Livestatus Schema documentation](23-appendix.md#schema-livestatus).
613
614
615 ## <a id="status-data"></a> Status Data Files
616
617 Icinga 1.x writes object configuration data and status data in a cyclic
618 interval to its `objects.cache` and `status.dat` files. Icinga 2 provides
619 the `StatusDataWriter` object which dumps all configuration objects and
620 status updates in a regular interval.
621
622     # icinga2 feature enable statusdata
623
624 Icinga 1.x Classic UI requires this data set as part of its backend.
625
626 > **Note**
627 >
628 > If you are not using any web interface or addon which uses these files,
629 > you can safely disable this feature.
630
631
632 ## <a id="compat-logging"></a> Compat Log Files
633
634 The Icinga 1.x log format is considered being the `Compat Log`
635 in Icinga 2 provided with the `CompatLogger` object.
636
637 These logs are not only used for informational representation in
638 external web interfaces parsing the logs, but also to generate
639 SLA reports and trends in Icinga 1.x Classic UI. Furthermore the
640 [Livestatus](15-features.md#setting-up-livestatus) feature uses these logs for answering queries to
641 historical tables.
642
643 The `CompatLogger` object can be enabled with
644
645     # icinga2 feature enable compatlog
646
647 By default, the Icinga 1.x log file called `icinga.log` is located
648 in `/var/log/icinga2/compat`. Rotated log files are moved into
649 `var/log/icinga2/compat/archives`.
650
651 The format cannot be changed without breaking compatibility to
652 existing log parsers.
653
654     # tail -f /var/log/icinga2/compat/icinga.log
655
656     [1382115688] LOG ROTATION: HOURLY
657     [1382115688] LOG VERSION: 2.0
658     [1382115688] HOST STATE: CURRENT;localhost;UP;HARD;1;
659     [1382115688] SERVICE STATE: CURRENT;localhost;disk;WARNING;HARD;1;
660     [1382115688] SERVICE STATE: CURRENT;localhost;http;OK;HARD;1;
661     [1382115688] SERVICE STATE: CURRENT;localhost;load;OK;HARD;1;
662     [1382115688] SERVICE STATE: CURRENT;localhost;ping4;OK;HARD;1;
663     [1382115688] SERVICE STATE: CURRENT;localhost;ping6;OK;HARD;1;
664     [1382115688] SERVICE STATE: CURRENT;localhost;processes;WARNING;HARD;1;
665     [1382115688] SERVICE STATE: CURRENT;localhost;ssh;OK;HARD;1;
666     [1382115688] SERVICE STATE: CURRENT;localhost;users;OK;HARD;1;
667     [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;disk;1382115705
668     [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;http;1382115705
669     [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;load;1382115705
670     [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;ping4;1382115705
671     [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;ping6;1382115705
672     [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;processes;1382115705
673     [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;ssh;1382115705
674     [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;users;1382115705
675     [1382115731] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;localhost;ping6;2;critical test|
676     [1382115731] SERVICE ALERT: localhost;ping6;CRITICAL;SOFT;2;critical test
677
678
679 ## <a id="check-result-files"></a> Check Result Files
680
681 Icinga 1.x writes its check result files to a temporary spool directory
682 where they are processed in a regular interval.
683 While this is extremely inefficient in performance regards it has been
684 rendered useful for passing passive check results directly into Icinga 1.x
685 skipping the external command pipe.
686
687 Several clustered/distributed environments and check-aggregation addons
688 use that method. In order to support step-by-step migration of these
689 environments, Icinga 2 supports the `CheckResultReader` object.
690
691 There is no feature configuration available, but it must be defined
692 on-demand in your Icinga 2 objects configuration.
693
694     object CheckResultReader "reader" {
695       spool_dir = "/data/check-results"
696     }
697