Module: check_mk
Branch: master
Commit: ffb6bcdc01f7cbce015363522a7054382b9a792c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ffb6bcdc01f7cb…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Mon Jan 28 09:42:38 2019 +0100
mk_jolokia: minor improvement of error handling
We now transport the error output to the check to deal with it,
instead of silently skipping the instance if the jolokia_info
section fails.
Change-Id: I419de0cec2697363c8ce09be5d4091d9543fd18c
---
agents/plugins/mk_jolokia.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/agents/plugins/mk_jolokia.py b/agents/plugins/mk_jolokia.py
index 648bdc9..fb8e86e 100755
--- a/agents/plugins/mk_jolokia.py
+++ b/agents/plugins/mk_jolokia.py
@@ -464,11 +464,11 @@ def query_instance(inst):
def generate_jolokia_info(inst):
# Determine type of server
- data = fetch_var(inst, "version", "")
-
- if not data:
- sys.stderr.write("%s ERROR: Empty server info\n" % inst.name)
- raise SkipInstance()
+ try:
+ data = fetch_var(inst, "version", "")
+ except (SkipInstance, SkipMBean) as exc:
+ yield inst.name, "ERROR", str(exc)
+ raise SkipInstance(exc)
info = data.get('info', {})
version = info.get('version', "unknown")