Module: check_mk
Branch: master
Commit: db8aa12977f7289aea41279a865bff16fa315654
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=db8aa12977f728…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 15 11:55:52 2016 +0100
#3061 FIX mk_jolokia: Fixed debugging of the agent plugin
---
.werks/3061 | 10 ++++++++++
ChangeLog | 1 +
agents/plugins/mk_jolokia | 11 +++++++----
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/.werks/3061 b/.werks/3061
new file mode 100644
index 0000000..ad022bc
--- /dev/null
+++ b/.werks/3061
@@ -0,0 +1,10 @@
+Title: mk_jolokia: Fixed debugging of the agent plugin
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1455533734
+
+
diff --git a/ChangeLog b/ChangeLog
index c2ca75d..2d024e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
Checks & Agents:
* 3183 aruba_wlc_aps: new check which monitors the provisioned accesspoints of an
Aruba Network WLAN Controller
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
+ * 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
Multisite:
* 3059 FIX: Fixed highlighting of availability timeline time slices
diff --git a/agents/plugins/mk_jolokia b/agents/plugins/mk_jolokia
index 5295801..d90a7f0 100755
--- a/agents/plugins/mk_jolokia
+++ b/agents/plugins/mk_jolokia
@@ -26,7 +26,8 @@
import urllib2, sys, os, socket, pprint, base64
-opt_debug = '--debug' in sys.argv
+opt_verbose = '--verbose' in sys.argv
+opt_debug = '--debug' in sys.argv
class PreemptiveBasicAuthHandler(urllib2.HTTPBasicAuthHandler):
"""
@@ -49,13 +50,15 @@ class PreemptiveBasicAuthHandler(urllib2.HTTPBasicAuthHandler):
def fetch_var(protocol, server, port, path, suburi, itemspec):
url = "%s://%s:%d/%s/%s" % (protocol, server, port, suburi, path)
- if opt_debug:
+ if opt_verbose:
sys.stderr.write("DEBUG: Fetching: %s\n" % url)
try:
json = urllib2.urlopen(url).read()
- if opt_debug:
+ if opt_verbose:
sys.stderr.write("DEBUG: Result: %s\n\n" % json)
except Exception, e:
+ if opt_debug:
+ raise
sys.stderr.write("ERROR: %s\n" % e)
return []
@@ -79,7 +82,7 @@ def fetch_var(protocol, server, port, path, suburi, itemspec):
# take the first items first value.
# {'Catalina:host=localhost,path=\\/test,type=Manager':
{'activeSessions': 0}}
if 'value' not in obj:
- if opt_debug:
+ if opt_verbose:
sys.stderr.write("ERROR: not found: %s\n" % path)
return []
val = obj.get('value', None)