Wir nutzen Cookies, um Ihnen eine optimale Nutzung dieser Webseite zu ermöglichen.Visit our Privacy Policy to learn more. Wir nehmen an, dass Sie damit einverstanden sind, falls Sie diese Webseite weiter besuchen.

Ihre Cookie-Einstellungen
Ihre Einstellungen wurden aktualisiert.
Damit die Änderungen wirksam werden, löschen Sie bitte Ihre Browser-Cookies und den Cache und laden dann die Seite neu.

Werk #6972: Support SQL-style quoting for filtering dict-valued columns

KomponenteLivestatus
TitelSupport SQL-style quoting for filtering dict-valued columns
Datum2019-06-07 11:09:21
Checkmk EditionCheckmk Raw Edition (CRE)
Checkmk Version1.6.0b2,1.7.0i1
LevelTrivial Change
KlasseNew Feature
KompatibilitätKompatibel - benötigt kein manuelles Eingreifen

Some Livestatus columns do not contain a simple value or a list of such values, they contain a dictionary of key/value pairs. More concretely, the

  • custom_variables
  • label_sources
  • labels
  • tags

columns in the

  • contacts
  • hosts
  • hostsbygroup
  • services
  • servicesbygroup
  • servicesbyhostgroup

tables contain dictionary values. Livestatus filter for such columns have a special syntax:

Filter: COLUMN OPERATOR KEY VALUE

As an example, the query:

GET hosts
Filter: tag = agent cmk-agent

returns all hosts where the tag "agent" has the value "cmk-agent". Note that the key and the value are separated by whitespace. But this makes it impossible to query for a tag name with spaces. To support more general keys and values in such filters, Livestatus now additionally supports SQL-style quoting for such column filters:

Filter: labels = 'It''s so' 'cool, man!'

This filter matches a label with key "It's so" and value "cool, man!". Note the use of 2 consecutive single quotes to represent 1 single quote. The previous syntax still works, the new syntax is triggered by a leading single quote in the key and/or value.