Module: check_mk
Branch: master
Commit: 4b14ff0babfc7cbaf4fde3f5be2590ee24853b04
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4b14ff0babfc7c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 11 14:41:58 2016 +0200
3898 FIX Unmonitored services: Fixed possible bug in case discovery service produces
unexpected output
---
.werks/3898 | 9 +++++++++
ChangeLog | 1 +
modules/discovery.py | 1 +
web/plugins/views/datasources.py | 8 +++++++-
web/plugins/views/painters.py | 6 +++---
5 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/.werks/3898 b/.werks/3898
new file mode 100644
index 0000000..3e00e99
--- /dev/null
+++ b/.werks/3898
@@ -0,0 +1,9 @@
+Title: Unmonitored services: Fixed possible bug in case discovery service produces
unexpected output
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.4.0i2
+Date: 1476189684
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 07f17fc..26bf1e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@
Multisite:
* 3897 FIX: Fixed possible exception in raw edition when rendering graphs
+ * 3898 FIX: Unmonitored services: Fixed possible bug in case discovery service
produces unexpected output
WATO:
* 3915 User access times: New icon when never logged in; New column "last
seen"
diff --git a/modules/discovery.py b/modules/discovery.py
index 1bc0881..5c38edb 100644
--- a/modules/discovery.py
+++ b/modules/discovery.py
@@ -342,6 +342,7 @@ def check_discovery(hostname, ipaddress=None):
if need_rediscovery:
infotexts.append("rediscovery scheduled")
+ long_infotexts.append("asd:asdasdasd: asd:")
output = ", ".join(infotexts)
if long_infotexts:
output += "\n" + "\n".join(long_infotexts)
diff --git a/web/plugins/views/datasources.py b/web/plugins/views/datasources.py
index a15fb2c..058358f 100644
--- a/web/plugins/views/datasources.py
+++ b/web/plugins/views/datasources.py
@@ -261,7 +261,13 @@ def query_service_discovery(columns, query, only_sites, limit,
all_active_filter
if not service_line:
continue
- state, check, service_description = map(lambda s: s.strip(),
service_line.split(":", 2))
+ parts = map(lambda s: s.strip(), service_line.split(":", 2))
+ if len(parts) != 3:
+ continue
+
+ state, check, service_description = parts
+ if state not in ["ignored", "vanished",
"unmonitored"]:
+ continue
this_row = row.copy()
this_row.update({
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index ed4cfb4..621e086 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -957,10 +957,10 @@ def paint_time_graph(row, cell):
def time_graph_params():
- if metrics.cmk_graphs_possible(row["site"]):
+ try:
return metrics.vs_graph_render_options()
- else:
- return None
+ except AttributeError:
+ return None # The method is only available in CEE
def paint_time_graph_cmk(row, cell, show_timeranges=False):