Module: check_mk
Branch: master
Commit: f1988b32d63376722f12a9d46ad91b2ec8735f38
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f1988b32d63376…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Thu Aug 25 10:34:11 2016 +0200
Also remove eval(json_data) from the jolokia special agent
---
agents/special/agent_jolokia | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/agents/special/agent_jolokia b/agents/special/agent_jolokia
index 859eaf5..0753eff 100755
--- a/agents/special/agent_jolokia
+++ b/agents/special/agent_jolokia
@@ -34,7 +34,10 @@ except ImportError:
try:
import json
except ImportError:
- json = None
+ sys.stdout.write("<<<jolokia_info>>>\n")
+ sys.stdout.write("Error: Missing JSON library for Agent Plugin
mk_jolokia\n")
+ exit()
+
# assigned in parse_arguments
opt_verbose = False
@@ -155,21 +158,15 @@ def fetch_var(protocol, server, port, path, suburi, cert_path,
itemspec):
return []
try:
- true = True
- false = False
- null = None
- if json:
- obj = json.loads(data)
- else:
- obj = eval(data)
+ obj = json.loads(json_data)
except Exception, e:
sys.stderr.write('ERROR: Invalid json code (%s)\n' % e)
- sys.stderr.write(' Response %s\n' % data)
+ sys.stderr.write(' Response %s\n' % json_data)
return []
if obj.get('status', 200) != 200:
sys.stderr.write('ERROR: Invalid response when fetching url %s\n' % url)
- sys.stderr.write(' Response: %s\n' % data)
+ sys.stderr.write(' Response: %s\n' % json_data)
return []
# Only take the value of the object. If the value is an object