Livestatus command reference

Check_MK Manual

Search in the manual

This article is just a draft and not yet finished!

1. Available tables

The following tables are available for use in Livestatus. Some of them additionally function over the columns of another table. These columns will be identified by the table's name as a prefix:

Table Comments
hosts Contains all information for the configured hosts.
services Contains all information for the configured services, and additionally the columns from hosts.
hostgroups Information for the host groups.
servicegroups Information for the service groups.
contactgroups Information for the contact groups.
servicesbygroup As for services, but additionally with the columns from servicegroups.
servicesbyhostgroup Like services, but additionally with the columns from hostgroups.
hostsbygroup Like hosts, but additionally with the columns from hostgroups.
contacts Information for the contacts.
commands All configured Check-Commands, as found for a service under Service check command.
timeperiods All information for the configured Time Periods.
downtimes As for timeperiods, but for scheduled maintenance times.
comments Contains all information for comments, and in addition the columns from hosts and services.
log All information for logged events. These should be filtered by class and time stamp/time period.
status Information for the core's status and performance.
columns All available tables will be listed here. Additionally,a description of all of a table's columns is also provided.
statehist The past-statuses for a host/service can be comprehensively searched with this table.
eventconsoleevents Lists all of the Event Console's events. This table additionally has all columns from hosts.
eventconsolehistory Like eventconsoleevents, but also with additional columns for an event's history.
eventconsolestatus Lists statistics from the performance of the Event Console.
eventconsolerules Statistics for how often the rule-matching for an incoming event was successful.

Should you wish to know which columns a table uses, these can be easily shown with the following command:

OMD[mysite]:~$ lq "GET columns\nColumns: name\nFilter: table = columns"
description
name
table
type

Other tables can also be selected by using filters. All of the columns available for searching by column and table can be seen in the output from the example shown.

2. Available headers

Header Argument Function
Columns Column name Restricts the output to the specified columns
Filter Column name, operator and object name Restricts the output to the defined object. See also [livestatus_references#filter]
OR Integer Links the last n filter(s) with a logical OR
AND Ganzzahl Links the last n filter(s) with a logical AND
NEGATE Integer Inverts the last n Filter(s)
Separators ASCII-values Defines the characters for separating elements
OutputFormat Name Defines an alternative output format for the data. Possible formats are json, python, python3, CSV and csv (the standard format)
Stats Operator and column names Generates statistics for specified columns
StatsOr Integer Provides the OR-header's functions in the statistics
StatsAnd Integer Provides the AND-header's functions in the statistics
StatsNegate Integer Provides the NEGATE-header's functions in the statistics
Limit Integer Limits the output to n lines
Timelimit Integer Restricts the time allowed for processing the query to n seconds
ColumnHeaders - The first line of the output contains the name of the column used. If the header ResponseHeader has additionally been set, the column name will be output in the second line
AuthUser User Name Restricts the output to the lines that the specified user is authorised to see
WaitObject Object Name The object for which a specified behaviour is expected. This is the object's name, or respectively in the case of the services table, the host's name followed by a blank character, followed in turn by the service description. If the host name itself contains blank characters the two elements can also be separated by a semicolon. This header is only supported by the hosts, services hostgroups servicegroups contacts and contactgroups tables
WaitCondition FilterCondition The condition that must be satisfied for the defined object. Any desired number of conditions can be defined – these are linked together with a logical and
WaitConditionOr Integer Provides the OR-header function in the Wait-conditions
WaitConditionAnd Integer Provides the AND-header function in the Wait-conditions
WaitConditionNegate Integer Provides the NEGATE-header function in the Wait-conditions
WaitTrigger Keyword* Keywords work like a normal condition if they are set by themselves. In combination with the WaitCondition this simplifies the locating of relevant log entries and reduces the overhead in Livestatus
WaitTimeout Integer Sets a time limit in milliseconds. Following, for example, 5000 Milliseconds (5 seconds), the query will be executed even if the condition has not been satisfied
Localtime Unix Time By using a specified reference time it is attempted to compensate for differing local time stamps in a distributed environment
ResponseHeader fixed16/off Returns a status line in the first line of the response. The output itself remains in the first line if the header ColumnHeaders has additionally been set
KeepAlive on Prevents the Livestatus-channel being closed following a query

* The following keywords are available for the WaitTrigger:

  • check
  • state
  • log
  • downtime
  • comment
  • command
  • program
  • all

3. Operators for filters

3.1. General operators

Operator* For numbers For character strings
= Equality Equality
~ Superset** Contains a character string as a regular expression.
=~ Subset** Case-insensitive equality
~~ Contains at least one of the values** Contains a case-insensitive character string as a regular expression
< Smaller than Lexicographically smaller than
> Larger than Lexicographically larger than
<= Smaller or equal Lexicographically smaller or equal
>= Larger or equal Lexicographically larger or equal

* All operators can be negated with an exclamation mark (!).

** These operators are useful when working with lists. Livestatus then interprets the specified values as a quantity.

3.2. Operators for lists

You can check whether an element is included in a list using the following operators:

Operator Type of check
= Checks for empty lists*
>= Equality
< Disparity
<= Case-insensitive equality
> Case-insensitive disparity
~ The character string for a regular expression*
~~ The case-insensitive character string for a regular expression*

* These operators can be negated with an exclamation mark (!).

4. Operators for statistics

Operator Description
sum Generates a sum from the values
min Searches for the smallest value
max Searches for the highest value
avg Calculates an average value (mean value)
std Outputs the standard deviation
suminv Inverts the sum of the values according to 1/sum
avginv Inverts the mean value of the values according to 1/avg

5. Status codes from the ResponseHeader

Status code Description
200 The query was successful and the response contains the requested data
400 The query contains a faulty header
404 The table could not be found
413 The time limit for the query has been exceeded
451 The query was incompletely transferred
452 The query is completely invalid

6. Commands

The following commands are available for you in  Check_MK Raw Edition,  Check_MK Enterprise Edition,  Check_MK Managed Services Edition:

Kommando Beschreibung
Hostkommandos
ACKNOWLEDGE_HOST_PROBLEM Probleme eines Hosts bestätigen
REMOVE_HOST_ACKNOWLEDGEMENT Bestätigung der Probleme eines Hosts löschen
ADD_HOST_COMMENT Einem Host einen Kommentar hinzufügen
DEL_HOST_COMMENT Einen Kommentar bei einem Host löschen
SCHEDULE_HOST_DOWNTIME Ein Wartungsfenster für einen Host festlegen
MODIFY_HOST_DOWNTIME Ein Wartungsfenster für einen Host bearbeiten
DEL_HOST_DOWNTIME Eine Downtime bei einem Host löschen
START_EXECUTING_HOST_CHECKS Die Ausführung von Hostchecks global erlauben
STOP_EXECUTING_HOST_CHECKS Die Ausführung von Hostschecks global verhindern
ENABLE_HOST_CHECK Aktive Checks für einen Host erlauben
DISABLE_HOST_CHECK Aktive Checks für einen Host verhindern
ENABLE_PASSIVE_HOST_CHECKS Passive Hostchecks für einen Host erlauben
DISABLE_PASSIVE_HOST_CHECKS Passive Hostchecks für einen Host verhindern
ENABLE_HOST_NOTIFICATIONS Benachrichtigungen für einen Host erlauben
DISABLE_HOST_NOTIFICATIONS Benachrichtigungen für einen Host verhindern
ENABLE_HOST_SVC_NOTIFICATIONS Benachrichtigungen für alle Services eines Hosts erlauben
DISABLE_HOST_SVC_NOTIFICATIONS Benachrichtigungen für alle Services eines Hosts verhindern
SCHEDULE_FORCED_HOST_CHECK Die Aktualisierung eines Hostchecks zu einem bestimmten Zeitpunkt erzwingen
PROCESS_HOST_CHECK_RESULT Das Ergebnis eines Hostchecks manuell setzen
SEND_CUSTOM_HOST_NOTIFICATION Eine eigene Benachrichtigung für einen Host erstellen
CHANGE_HOST_MODATTR Ändert die modifizierten Attribute eines Hosts
Servicekommandos
ACKNOWLEDGE_SVC_PROBLEM Probleme eines Service bestätigen
REMOVE_SVC_ACKNOWLEDGEMENT Bestätigung der Probleme eines Service löschen
ADD_SVC_COMMENT Einem Service einen Kommentar hinzufügen
DEL_SVC_COMMENT Einen Kommentar bei einem Service löschen
SCHEDULE_SVC_DOWNTIME Ein Wartungsfenster bei einem Service festlegen
MODIFY_SVC_DOWNTIME Ein Wartungsfenster bei einem Service bearbeiten
DEL_SVC_DOWNTIME Ein Wartungsfenster bei einem Service löschen
START_EXECUTING_SVC_CHECKS Die Ausführen von aktiven Services global erlauben
STOP_EXECUTING_SVC_CHECKS Die Ausführung von aktiven Services global verhindern
ENABLE_SVC_CHECK Die Ausführung für einen bestimmten aktiven Service erlauben
DISABLE_SVC_CHECK Die Ausführung für einen bestimmten aktiven Service verhindern
ENABLE_PASSIVE_SVC_CHECKS Die Ausführung für einen bestimmten passiven Service erlauben
DISABLE_PASSIVE_SVC_CHECKS Die Ausführung für einen bestimmten passiven Serviec verhindern
ENABLE_SVC_NOTIFICATIONS Benachrichtigungen für einen bestimmten Service erlauben
DISABLE_SVC_NOTIFICATIONS Benachrichtigungen für einen bestimmten Service verhindern
SCHEDULE_FORCED_SVC_CHECK Die Aktualisierung eines Service zu einem bestimmten Zeitpunkt erzwingen
PROCESS_SERVICE_CHECK_RESULT Das Ergebnis einer Serviceausgabe eines passiven Services manuell setzen
SEND_CUSTOM_SVC_NOTIFICATION Eine eigene Benachrichtigung für einen Service erstellen
CHANGE_SVC_MODATTR Ändert die modifizierten Attribute eines Service
Andere Befehle
ENABLE_NOTIFICATIONS Benachrichtigungen global erlauben
DISABLE_NOTIFICATIONS Benachrichtigungen global verhindern
ENABLE_FLAP_DETECTION Die Erkennung von unstetigen Hosts/Services global erlauben
DISABLE_FLAP_DETECTION Die Erkennung von unstetigen Hosts/Services global verhindern
ENABLE_PERFORMANCE_DATA Die Verarbeitung von Performancedaten global erlauben
DISABLE_PERFORMANCE_DATA Die Verarbeitung von Performancedaten global verhindern
ENABLE_EVENT_HANDLERS Die Ausführung von Alerthandlern/Eventhandlern global erlauben
DISABLE_EVENT_HANDLERS Die Ausführung von Alerthandlern/Eventhandlern global verhindern
SAVE_STATE_INFORMATION Alle Statusinformationen sofort abspeichern

Kommandos, welche Ihnen nur mit dem CMC in der  Check_MK Enterprise Edition oder  Check_MK Managed Services Edition zur Verfügung stehen:

Kommando Beschreibung
Hostkommandos
PROCESS_HOST_PERFDATA tba
UPDATE_SHADOW_HOST_STATE tba
Servicekommandos
PROCESS_SVC_PERFDATA tba
UPDATE_SHADOW_SERVICE_STATE tba
Andere Kommandos
LOG tba
MK_LOGWATCH_ACKNOWLEDGE tba
RELOAD_CONFIG tba
REOPEN_DAEMONLOG tba
ROTATE_LOGFILE tba
SEGFAULT tba