Module: check_mk
Branch: master
Commit: ace9fb27fe6dc5e988aafff76802f973f0706ee5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ace9fb27fe6dc5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 27 17:53:02 2018 +0200
6042 FIX Nagios: Fix processing of service output containing special characters
When using nagios service results of the "Check_MK *" services could end up
with output of "(null)" when the resulting text contained special characters.
Change-Id: Ie0e62ca4a288dde140d2e873dc8785ad9ed46fd0
---
.werks/6042 | 12 ++++++++++++
cmk_base/checking.py | 6 +++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/.werks/6042 b/.werks/6042
new file mode 100644
index 0000000..79f07b3
--- /dev/null
+++ b/.werks/6042
@@ -0,0 +1,12 @@
+Title: Nagios: Fix processing of service output containing special characters
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1524844305
+
+When using nagios service results of the "Check_MK *" services could end up
+with output of "(null)" when the resulting text contained special characters.
diff --git a/cmk_base/checking.py b/cmk_base/checking.py
index c338d1a..9982ee7 100644
--- a/cmk_base/checking.py
+++ b/cmk_base/checking.py
@@ -109,14 +109,14 @@ def handle_check_mk_check_result(check_plugin_name, description):
if perfdata:
output_txt += " | %s" % " ".join(perfdata)
if long_infotexts:
- output_txt += "\n" + "\n".join(long_infotexts)
+ output_txt = "%s\n%s" % (output_txt,
"\n".join(long_infotexts))
output_txt += "\n"
if _in_keepalive_mode():
keepalive.add_keepalive_active_check_result(hostname, output_txt)
- console.verbose(output_txt)
+ console.verbose(output_txt.encode("utf-8"))
else:
- console.output(output_txt)
+ console.output(output_txt.encode("utf-8"))
return status
return wrapped_check_func