Module: check_mk
Branch: master
Commit: 7d50c802cbbfc1bc2d5c9fbd3afb3990153528b1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7d50c802cbbfc1…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Wed Nov 14 07:47:23 2018 +0100
6904 FIX mk_jolokia: No longer crash with IndexError if MBean is missing
CMK-1209
Change-Id: I003f001c9f6be68a07ebc49c0876f2317ff7b214
---
.werks/6904 | 10 ++++++++++
agents/plugins/mk_jolokia | 25 ++++++++++++++-----------
2 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/.werks/6904 b/.werks/6904
new file mode 100644
index 0000000..65574a8
--- /dev/null
+++ b/.werks/6904
@@ -0,0 +1,10 @@
+Title: mk_jolokia: No longer crash with IndexError if MBean is missing
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1542177988
+Class: fix
+
+
diff --git a/agents/plugins/mk_jolokia b/agents/plugins/mk_jolokia
index bb980b5..babc6df 100755
--- a/agents/plugins/mk_jolokia
+++ b/agents/plugins/mk_jolokia
@@ -305,17 +305,20 @@ def _get_queries(do_search, inst, itemspec, title, path, mbean):
if not do_search:
return [(mbean + "/" + path, title, itemspec)]
- paths = fetch_var(
- inst["protocol"],
- inst["server"],
- inst["port"],
- mbean,
- inst["suburi"],
- "",
- None,
- None,
- None,
- function="search")[0][1]
+ try:
+ paths = fetch_var(
+ inst["protocol"],
+ inst["server"],
+ inst["port"],
+ mbean,
+ inst["suburi"],
+ "",
+ None,
+ None,
+ None,
+ function="search")[0][1]
+ except IndexError:
+ return []
return [("%s/%s" % (urllib2.quote(mbean_exp), path), path, itemspec,
mbean_exp)
for mbean_exp in paths]