Module: check_mk
Branch: master
Commit: d7c8ed3764a20570df528f101b0ef325ce9adcc6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d7c8ed3764a205…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Mon Dec 19 18:56:17 2016 +0100
mk_jolokia: Use auxiliary loop to remove duplicate exception handling
Change-Id: I17cef0a2e8f383e0a63d07ba320a744916bd7fe8
---
agents/plugins/mk_jolokia | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/agents/plugins/mk_jolokia b/agents/plugins/mk_jolokia
index 8e25074..8338213 100755
--- a/agents/plugins/mk_jolokia
+++ b/agents/plugins/mk_jolokia
@@ -316,6 +316,7 @@ def query_instance(inst):
else:
mbean, path, title, itemspec, do_search = var
+ queries = []
if do_search:
if mbean in mbean_search_results:
paths = mbean_search_results[mbean]
@@ -325,21 +326,14 @@ def query_instance(inst):
mbean_search_results[mbean] = paths
for mbean_exp in paths:
- try:
- fetch_metric(inst, "%s/%s" % (urllib2.quote(mbean_exp),
path), path,
- itemspec, inst_add=mbean_exp)
- except IOError:
- return
- except socket.timeout:
- return
- except:
- if opt_debug:
- raise
- # Simply ignore exceptions. Need to be removed for debugging
- continue
+ queries.append( (inst, "%s/%s" % (urllib2.quote(mbean_exp),
path), path,
+ itemspec, inst_add=mbean_exp) )
else:
+ queries.append( (inst, mbean + "/" + path, title, itemspec) )
+
+ for inst, mbean_path, title, itemspec in queries:
try:
- fetch_metric(inst, mbean + "/" + path, title, itemspec)
+ fetch_metric(inst, mbean_path, title, itemspec)
except IOError:
return
except socket.timeout: