Module: check_mk
Branch: master
Commit: a6b6158d870df6b817ecf22edd2317827b718d3d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a6b6158d870df6…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Feb 27 16:31:28 2017 +0100
4449 FIX Quicksearch: fixed "name name" results with distributed monitoring
Change-Id: Ib8155921a88266b7249e696cb3308071d58070c9
---
.werks/4449 | 10 ++++++++++
web/htdocs/sidebar.py | 13 +++++++------
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/.werks/4449 b/.werks/4449
new file mode 100644
index 0000000..ac5106d
--- /dev/null
+++ b/.werks/4449
@@ -0,0 +1,10 @@
+Title: Quicksearch: fixed "name name" results with distributed monitoring
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1488209431
+Class: fix
+
+
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 383d371..a5b997d 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -807,6 +807,7 @@ class LivestatusQuicksearch(object):
self._determine_used_filters()
self._execute_livestatus_command()
+
# If no rows were found with the given (filterless) query, issue
# -> Hostaddress -> Hostalias -> Service description
if not self._rows and self._no_filters_set:
@@ -863,10 +864,9 @@ class LivestatusQuicksearch(object):
return
# TODO: fix bug in livestatus, livestatus does not report "site" in the
headers
- headers = results[0]
- headers[0] = "site"
+ headers = ["site"] + self._queried_livestatus_columns
- self._rows = map(lambda x: dict(zip(headers, x)), results[1:])
+ self._rows = map(lambda x: dict(zip(headers, x)), results)
limit = config.quicksearch_dropdown_limit
if len(self._rows) > limit:
@@ -900,13 +900,14 @@ class LivestatusQuicksearch(object):
if len(livestatus_filters) > 1:
livestatus_filters.append("And: %d" % len(livestatus_filters))
- self._livestatus_command = "GET %s\nColumns: %s\n%s\n" %
(self._livestatus_table,
- " ".join(set(columns_to_query)),
+ self._queried_livestatus_columns = list(columns_to_query)
+ self._livestatus_command = "GET %s\nColumns: %s\n%s\n" %
(self._livestatus_table,
+ "
".join(self._queried_livestatus_columns),
"\n".join(livestatus_filters))
# Limit number of results
limit = config.quicksearch_dropdown_limit
- self._livestatus_command += "Cache: reload\nLimit: %d\nColumnHeaders:
on" % (limit + 1)
+ self._livestatus_command += "Cache: reload\nLimit: %d\nColumnHeaders:
off" % (limit + 1)
# Returns the livestatus table fitting the given filters