Module: check_mk
Branch: master
Commit: aa578ca7e48e1f33c3ede3fc2c1c3e0e1ba3f929
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=aa578ca7e48e1f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 24 16:15:17 2018 +0100
5655 FIX Discovery: Display parse function errors on console instead of suppressing
Change-Id: I2cfd05ea814d2f83c2fd36382aace43cdf96ea32
---
.werks/5655 | 10 ++++++++++
cmk_base/discovery.py | 15 ++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/.werks/5655 b/.werks/5655
new file mode 100644
index 0000000..3412040
--- /dev/null
+++ b/.werks/5655
@@ -0,0 +1,10 @@
+Title: Discovery: Display parse function errors on console instead of suppressing
+Level: 1
+Component: core
+Compatible: compat
+Edition: cre
+Version: 1.5.0i3
+Date: 1516806215
+Class: fix
+
+
diff --git a/cmk_base/discovery.py b/cmk_base/discovery.py
index 4b97d41..b29bcbd 100644
--- a/cmk_base/discovery.py
+++ b/cmk_base/discovery.py
@@ -941,7 +941,20 @@ def _execute_discovery(multi_host_sections, hostname, ipaddress,
check_plugin_na
except KeyError:
raise MKGeneralException("No such check type '%s'" %
check_plugin_name)
- section_content = multi_host_sections.get_section_content(hostname, ipaddress,
check_plugin_name, for_discovery=True)
+ try:
+ section_content = multi_host_sections.get_section_content(hostname, ipaddress,
+ check_plugin_name,
for_discovery=True)
+ except MKParseFunctionError, e:
+ if cmk.debug.enabled():
+ x = e.exc_info()
+ raise x[0], x[1], x[2] # re-raise the original exception to not destory the
trace
+
+ if on_error == "warn":
+ section_name = checks.section_name_of(check_plugin_name)
+ console.warning("Exception while parsing agent section '%s':
%s\n" % (section_name, e))
+ elif on_error == "raise":
+ raise
+ return []
if section_content is None: # No data for this check type
return []