Module: check_mk
Branch: master
Commit: 363fcec610db70d7c4f8338b29f82dc6de66fbb5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=363fcec610db70…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Mon Mar 4 08:14:27 2019 +0100
7204 mk_jolokia.py: Auto-detect product type
The plugin now detects the product type from the jolokia info section,
if the user did not provide it explicitly.
Change-Id: I819878034834837347a9b17f31a3339ebbcbade5
---
.werks/7204 | 12 ++++++++++++
agents/plugins/mk_jolokia.py | 7 +++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/.werks/7204 b/.werks/7204
new file mode 100644
index 0000000..eaab79b
--- /dev/null
+++ b/.werks/7204
@@ -0,0 +1,12 @@
+Title: mk_jolokia.py: Auto-detect product type if not configured
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1551683726
+Class: feature
+
+The plugin now detects the product type from the jolokia info section,
+if the user did not provide it explicitly.
+
diff --git a/agents/plugins/mk_jolokia.py b/agents/plugins/mk_jolokia.py
index 039a003..3bdb85f 100755
--- a/agents/plugins/mk_jolokia.py
+++ b/agents/plugins/mk_jolokia.py
@@ -154,7 +154,8 @@ DEFAULT_CONFIG_TUPLES = (
("service_url", None),
("service_user", None),
("service_password", None),
- ("product", None, "Product description. Available: %s" % \
+ ("product", None, "Product description. Available: %s. If not
provided," \
+ " we try to detect the product from the jolokia info
section." % \
", ".join(QUERY_SPECS_SPECIFIC.keys())),
("timeout", 1.0, "Connection/read timeout for requests."),
("custom_vars", []),
@@ -492,8 +493,10 @@ def generate_jolokia_info(inst):
info = data.get('info', {})
version = info.get('version', "unknown")
product = info.get('product', "unknown")
- if inst.product:
+ if inst.product is not None:
product = inst.product
+ else:
+ inst.product = product
agentversion = data.get('agent', "unknown")
yield inst.name, product, version, agentversion