Module: check_mk
Branch: master
Commit: d5ba773713077e696e92fc3ea77662ccd9fa2087
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d5ba773713077e…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Fri Jan 25 14:19:07 2019 +0100
mk_jolokia: prepare for more import errors
Change-Id: I62c6b527969d5336960ea9087ded4a3685580b1f
---
agents/plugins/mk_jolokia.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/agents/plugins/mk_jolokia.py b/agents/plugins/mk_jolokia.py
index 738fceb..d086965 100755
--- a/agents/plugins/mk_jolokia.py
+++ b/agents/plugins/mk_jolokia.py
@@ -34,14 +34,17 @@ import copy
from httplib import HTTPConnection, HTTPSConnection
try:
- from simplejson import json
-except ImportError:
try:
- import json
+ from simplejson import json
except ImportError:
- sys.stdout.write("<<<jolokia_info>>>\n")
- sys.stdout.write("Error: Missing JSON library for Agent Plugin
mk_jolokia\n")
- exit()
+ import json
+except ImportError as import_error:
+ sys.stdout.write(
+ "<<<jolokia_info>>>\n"
+ "Error: mk_jolokia requires either the json or simplejson library\n"
+ "Please either use a Python version that contains the json library or
install the"
+ " simplejson library on the monitored system.")
+ sys.exit(1)
VERBOSE = '--verbose' in sys.argv
DEBUG = '--debug' in sys.argv