Module: check_mk
Branch: master
Commit: dfc928abb2de3af153964d756157be8646c9c2f3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dfc928abb2de3a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed May 9 10:24:55 2018 +0200
5808 FIX Quicksearch: Searching for groups did not always return full results
Choosing a specific value from the dropdown menu in the quicksearch snapin, also applied
a site filter for the chosen group. The group results were hereby incorrectly restricted to a specific site.
Change-Id: Ie07f0429e70f190c14989a581b1ffa681e1df84b
---
.werks/5808 | 12 ++++++++++++
web/htdocs/sidebar.py | 11 +++++++++--
web/plugins/sidebar/search.py | 12 +++++++++++-
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/.werks/5808 b/.werks/5808
new file mode 100644
index 0000000..6f2f89d
--- /dev/null
+++ b/.werks/5808
@@ -0,0 +1,12 @@
+Title: Quicksearch: Searching for groups did not always return full results
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1525853954
+
+Choosing a specific value from the dropdown menu in the quicksearch snapin, also applied
+a site filter for the chosen group. The group results were hereby incorrectly restricted to a specific site.
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 0e5b85d..c72306e 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -890,9 +890,13 @@ class LivestatusSearchConductor(LivestatusSearchBase):
for row in self._rows:
entry = {"text_tokens": []}
url_params = []
+ skip_site = False
for filter_shortname in self._used_filters:
plugin = self._get_plugin_with_shortname(filter_shortname)
+ if plugin.is_group_match():
+ skip_site = True
+
match_info = plugin.get_matches(target_view, row, self._livestatus_table, self._used_filters)
if not match_info:
continue
@@ -900,8 +904,11 @@ class LivestatusSearchConductor(LivestatusSearchBase):
url_params.extend(url_filters)
entry["text_tokens"].append((plugin.get_filter_shortname(), text))
- entry["url"] = self._build_url([("view_name", target_view),
- ("site", row.get("site"))] + url_params, restore_regex = True)
+ url_tokens = [("view_name", target_view)] + url_params
+ if not skip_site:
+ url_tokens.append(("site", row.get("site")))
+ entry["url"] = self._build_url(url_tokens, restore_regex = True)
+
entry["raw_data"] = row
self._elements.append(entry)
diff --git a/web/plugins/sidebar/search.py b/web/plugins/sidebar/search.py
index 3e2dcb71..0f29935 100644
--- a/web/plugins/sidebar/search.py
+++ b/web/plugins/sidebar/search.py
@@ -191,6 +191,10 @@ class QuicksearchMatchPlugin(object):
raise NotImplementedError()
+ def is_group_match(self):
+ return False
+
+
def _matches_regex(self, pattern, value):
return re.match(pattern, value)
@@ -212,6 +216,10 @@ class GroupMatchPlugin(QuicksearchMatchPlugin):
self._group_type = group_type
+ def is_group_match(self):
+ return True
+
+
def get_match_topic(self):
if self._group_type == "host":
return _("Hostgroup")
@@ -400,7 +408,9 @@ class HosttagMatchPlugin(QuicksearchMatchPlugin):
def _get_hosttag_dict(self):
lookup_dict = {}
- for group, text, values in config.host_tag_groups():
+ for entry in config.host_tag_groups():
+ group, text, values = entry[:3]
+
for value in values:
lookup_dict[value[0]] = group
return lookup_dict
Module: check_mk
Branch: master
Commit: e0629fe6b6308516cf223585a4c63c181c3d74e5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e0629fe6b63085…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed May 9 09:42:23 2018 +0200
6060 FIX Clusters: Add missing custom variable containing the node names
In addition to the existing custom attributes _NODEIPS, _NODEIPS_4 and
_NODEIPS_6 this change adds a new variable _NODENAMES. All the entries
in this variables are now sorted by the node name. This means that e.g.
the 2nd entry in all of the above variables belongs to the same node.
Change-Id: Ie8d4ffeadd50397666fe6eca6327bf0a54c265d1
---
.werks/6060 | 14 ++++++++++++++
cmk_base/core_config.py | 12 +++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/.werks/6060 b/.werks/6060
new file mode 100644
index 0000000..07f0f0f
--- /dev/null
+++ b/.werks/6060
@@ -0,0 +1,14 @@
+Title: Clusters: Add missing custom variable containing the node names
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1525851596
+
+In addition to the existing custom attributes _NODEIPS, _NODEIPS_4 and
+_NODEIPS_6 this change adds a new variable _NODENAMES. All the entries
+in this variables are now sorted by the node name. This means that e.g.
+the 2nd entry in all of the above variables belongs to the same node.
diff --git a/cmk_base/core_config.py b/cmk_base/core_config.py
index ce7ec8e..2e9621c 100644
--- a/cmk_base/core_config.py
+++ b/cmk_base/core_config.py
@@ -434,10 +434,14 @@ def _extra_host_attributes(hostname):
def get_cluster_attributes(hostname, nodes):
- attrs = {}
+ sorted_nodes = sorted(nodes)
+
+ attrs = {
+ "_NODENAMES": " ".join(sorted_nodes),
+ }
node_ips_4 = []
if config.is_ipv4_host(hostname):
- for h in nodes:
+ for h in sorted_nodes:
addr = ip_address_of(h, 4)
if addr != None:
node_ips_4.append(addr)
@@ -446,7 +450,7 @@ def get_cluster_attributes(hostname, nodes):
node_ips_6 = []
if config.is_ipv6_host(hostname):
- for h in nodes:
+ for h in sorted_nodes:
addr = ip_address_of(h, 6)
if addr != None:
node_ips_6.append(addr)
@@ -461,6 +465,8 @@ def get_cluster_attributes(hostname, nodes):
for suffix, val in [ ("", node_ips), ("_4", node_ips_4), ("_6", node_ips_6) ]:
attrs["_NODEIPS%s" % suffix] = " ".join(val)
+ print attrs
+
return attrs
Module: check_mk
Branch: master
Commit: 247e7b0fd2aafcec11c42b996ddd2b7589cc98f5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=247e7b0fd2aafc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed May 9 09:26:38 2018 +0200
6059 FIX "All Services with this description" view: Shows services of all sites now
Change-Id: I6f1ee4da126f544ddd5fa82f16b1d4c50100b916
---
.werks/6059 | 11 +++++++++++
web/htdocs/views.py | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/.werks/6059 b/.werks/6059
new file mode 100644
index 0000000..fe67780
--- /dev/null
+++ b/.werks/6059
@@ -0,0 +1,11 @@
+Title: "All Services with this description" view: Shows services of all sites now
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1525850760
+
+
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index d81970a..c57568e 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2852,6 +2852,11 @@ def url_to_view(row, view_name):
if filter_key in dict(url_vars):
add_site_hint = False
+ # Hack for servicedesc view which is meant to show all services with the given
+ # description: Don't add the site filter for this view.
+ if view_name == "servicedesc":
+ add_site_hint = False
+
if add_site_hint and row.get('site'):
url_vars.append(('site', row['site']))