[checkmk-commits] [tribe29/checkmk] 7f22fb: More tests for CustomVarsDictFilter.

Sven Panne noreply at github.com
Fri Jun 7 11:50:47 CEST 2019


  Branch: refs/heads/1.6.0
  Home:   https://github.com/tribe29/checkmk
  Commit: 7f22fb27c600e5b6a00cfa690979bc181a233d93
      https://github.com/tribe29/checkmk/commit/7f22fb27c600e5b6a00cfa690979bc181a233d93
  Author: Sven Panne <sven.panne at tribe29.com>
  Date:   2019-06-07 (Fri, 07 Jun 2019)

  Changed paths:
    M livestatus/src/test/test_CustomVarsDictFilter.cc

  Log Message:
  -----------
  More tests for CustomVarsDictFilter.

Change-Id: Ia3db6c0e1a5d3cf682fe24c96e86b4a665f841c2


  Commit: 8132c8ba47e5c6fb4f83efc7fbaa799163d96b0f
      https://github.com/tribe29/checkmk/commit/8132c8ba47e5c6fb4f83efc7fbaa799163d96b0f
  Author: Sven Panne <sven.panne at tribe29.com>
  Date:   2019-06-07 (Fri, 07 Jun 2019)

  Changed paths:
    M livestatus/src/CustomVarsDictFilter.cc
    M livestatus/src/test/test_CustomVarsDictFilter.cc

  Log Message:
  -----------
  Livestatus filter for dict-valued columns can now use SQL-style quoting.

CMK-1892

Change-Id: I71a141ab9a8ad779e95e9a34d73e981feeec5763


  Commit: 36393fc64d657aef2adb3943b4d608495b511f9d
      https://github.com/tribe29/checkmk/commit/36393fc64d657aef2adb3943b4d608495b511f9d
  Author: Sven Panne <sven.panne at tribe29.com>
  Date:   2019-06-07 (Fri, 07 Jun 2019)

  Changed paths:
    A .werks/6972

  Log Message:
  -----------
  6972 Support SQL-style quoting for filtering dict-valued columns

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

<ul>
<li><tt>custom_variables</tt></li>
<li><tt>label_sources</tt></li>
<li><tt>labels</tt></li>
<li><tt>tags</tt></li>
</ul>

columns in the

<ul>
<li><tt>contacts</tt></li>
<li><tt>hosts</tt></li>
<li><tt>hostsbygroup</tt></li>
<li><tt>services</tt></li>
<li><tt>servicesbygroup</tt></li>
<li><tt>servicesbyhostgroup</tt></li>
</ul>

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

C+:
Filter: COLUMN OPERATOR KEY VALUE
C-:

As an example, the query:

C+:
GET hosts
Filter: tag = agent cmk-agent
C-:

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:

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

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.

Change-Id: I14d72f742f4d81132568455f180ee01a577e0322


Compare: https://github.com/tribe29/checkmk/compare/e35dc9fd00d8...36393fc64d65


More information about the checkmk-commits mailing list