2014-03-21 11:54:33 +01:00
|
|
|
## <a id="schemas"></a> Schemas
|
2014-03-20 19:17:15 +01:00
|
|
|
|
2014-03-21 11:54:33 +01:00
|
|
|
### <a id="schema-db-ido"></a> DB IDO
|
2014-03-20 19:17:15 +01:00
|
|
|
|
2014-03-21 11:54:33 +01:00
|
|
|
There is a detailed documentation for the Icinga IDOUtils 1.x
|
|
|
|
database schema available on [http://docs.icinga.org/latest/en/db_model.html]
|
2014-03-20 19:17:15 +01:00
|
|
|
|
2014-03-21 15:15:51 +01:00
|
|
|
#### <a id="schema-db-ido-extensions"></a> DB IDO Schema Extensions
|
2014-03-20 19:17:15 +01:00
|
|
|
|
2014-03-21 11:54:33 +01:00
|
|
|
Icinga 2 specific extensions are shown below:
|
2014-03-20 19:17:15 +01:00
|
|
|
|
2014-03-21 11:54:33 +01:00
|
|
|
New tables: `endpoints`, `endpointstatus`
|
2014-03-20 19:17:15 +01:00
|
|
|
|
2014-03-21 11:54:33 +01:00
|
|
|
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:
|
|
|
|
|
2014-03-21 17:57:24 +01:00
|
|
|
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)
|
2014-03-21 11:54:33 +01:00
|
|
|
|
2014-04-06 21:15:25 +02:00
|
|
|
Additional command custom variables populated from 'vars' dictionary.
|
2014-04-07 21:30:27 +02:00
|
|
|
Additional global custom variables populated from 'Vars' constant (object_id is NULL).
|
2014-03-21 11:54:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
### <a id="schema-livestatus"></a> Livestatus
|
|
|
|
|
|
|
|
|
|
|
|
#### <a id="schema-livestatus-tables"></a> Livestatus Tables
|
|
|
|
|
|
|
|
Table | Join |Description
|
|
|
|
--------------|-----------|----------------------------
|
2014-04-06 08:28:28 +02:00
|
|
|
hosts | | host config and status attributes, services counter
|
|
|
|
hostgroups | | hostgroup config, status attributes and host/service counters
|
2014-03-21 11:54:33 +01:00
|
|
|
services | hosts | service config and status attributes
|
2014-04-06 08:28:28 +02:00
|
|
|
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
|
2014-03-21 11:54:33 +01:00
|
|
|
comments | services | status attributes
|
|
|
|
downtimes | services | status attributes
|
2014-04-06 08:28:28 +02:00
|
|
|
timeperiods | | name and is inside flag
|
|
|
|
endpoints | | config and status attributes
|
2014-03-21 11:54:33 +01:00
|
|
|
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
|
|
|
|
|
2014-04-06 21:15:25 +02:00
|
|
|
The `commands` table is populated with `CheckCommand`, `EventCommand` and `NotificationCommand` objects.
|
2014-03-21 11:54:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
#### <a id="schema-livestatus-table-attributes"></a> Livestatus Table Attributes
|
|
|
|
|
|
|
|
A detailed list which table attributes are supported can be found here: [https://wiki.icinga.org/display/icinga2/Livestatus#Livestatus-Attributes]
|
|
|
|
|
|
|
|
|
|
|
|
#### <a id="schema-livestatus-get-queries"></a> Livestatus GET Queries
|
|
|
|
|
|
|
|
$ echo -e 'GET services' | netcat 127.0.0.1 6558
|
|
|
|
|
|
|
|
$ cat servicegroups <<EOF
|
|
|
|
GET servicegroups
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
(cat servicegroups; sleep 1) | netcat 127.0.0.1 6558
|
|
|
|
|
|
|
|
#### <a id="schema-livestatus-command-queries"></a> Livestatus COMMAND Queries
|
|
|
|
|
2014-04-16 16:47:25 +02:00
|
|
|
A list of available external commands and their parameters can be found [here](#external-commands-list-detail)
|
|
|
|
|
2014-03-21 11:54:33 +01:00
|
|
|
$ echo -e 'COMMAND <externalcommandstring>' | netcat 127.0.0.1 6558
|
|
|
|
|
|
|
|
|
|
|
|
#### <a id="schema-livestatus-filters"></a> 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
|
|
|
|
|
|
|
|
|
|
|
|
#### <a id="schema-livestatus-stats"></a> Livestatus Stats
|
|
|
|
|
|
|
|
Schema: "Stats: aggregatefunction aggregateattribute"
|
|
|
|
|
|
|
|
Aggregate Function | Description
|
|
|
|
-------------------|--------------
|
2014-04-06 13:18:57 +02:00
|
|
|
sum |
|
|
|
|
min |
|
|
|
|
max |
|
2014-03-21 11:54:33 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
#### <a id="schema-livestatus-output"></a> 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.
|
|
|
|
|
|
|
|
#### <a id="schema-livestatus-error-codes"></a> Livestatus Error Codes
|
|
|
|
|
|
|
|
Code | Description
|
|
|
|
----------|--------------
|
|
|
|
200 | OK
|
|
|
|
404 | Table does not exist
|
|
|
|
452 | Exception on query
|
|
|
|
|
|
|
|
#### <a id="schema-livestatus-extensions"></a> 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
|
2014-04-04 17:36:28 +02:00
|
|
|
commands | custom_variable_names
|
|
|
|
commands | custom_variable_values
|
|
|
|
commands | custom_variables
|
2014-04-17 15:20:28 +02:00
|
|
|
commands | modified_attributes
|
|
|
|
commands | modified_attributes_list
|
2014-04-04 17:45:23 +02:00
|
|
|
status | custom_variable_names
|
|
|
|
status | custom_variable_values
|
|
|
|
status | custom_variables
|
2014-04-04 17:36:28 +02:00
|
|
|
|
2014-04-06 21:15:25 +02:00
|
|
|
Command custom variables reflect the local 'vars' dictionary.
|
2014-04-07 21:30:27 +02:00
|
|
|
Status custom variables reflect the global 'Vars' constant.
|