Module: check_mk
Branch: master
Commit: 59fdcffeb7398adab5858a496f4ebae093f447c8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=59fdcffeb7398a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Jan 21 17:51:19 2014 +0100
FIX Fixed incorrect formatting of checks with long output
Long output in check_mk checks was not formatted accordingly.
Newlines within a checks output are now escaped correctly: \n -> \\n
The incorrect formatting in previous versions could lead to missing long output texts in
the monitoring core.
---
.werks/260 | 12 ++++++++++++
ChangeLog | 2 +-
modules/check_mk_base.py | 3 +++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/.werks/260 b/.werks/260
new file mode 100644
index 0000000..6e34f34
--- /dev/null
+++ b/.werks/260
@@ -0,0 +1,12 @@
+Title: Fixed incorrect formatting of checks with long output
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1390322620
+
+Long output in check_mk checks was not formatted accordingly.
+Newlines within a checks output are now escaped correctly: \n -> \\n
+
+The incorrect formatting in previous versions could lead to missing long output texts in
the monitoring core.
diff --git a/ChangeLog b/ChangeLog
index ff848c2..e0257f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -123,6 +123,7 @@
* 0432 FIX: stulz_humidity: Fixed syntax error...
* 0120 FIX: stulz_humidity, apc_humidity: Fixed bug while processing check params...
* 0460 FIX: endless waiting for printer queues fixed...
+ * 0260 FIX: Fixed incorrect formatting of checks with long output...
Multisite:
* 0371 Added log class filter to hostsvcevents view
@@ -171,7 +172,6 @@
* 0428 Changed user profiles (e.g. pw changes) are now replicated in distributed
setups...
* 0114 User Custom Attributes can now be exported to the core...
* 0448 New button in WATO service list for displaying check parameters...
- * 0353 New button in service list for refreshing all services...
* 0057 FIX: Fix exception in WATO host editor on custom tag without topic...
* 0241 FIX: Improved sorting of WATO folders in dropdown menu...
* 0019 FIX: Fixed wording in WATO rule for MSSQL check
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index ea3ea0f..72f7160 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -1287,6 +1287,7 @@ def submit_to_core(host, service, state, output):
# Replace \n to enable multiline ouput
output = output.replace('\n', '\\n')
if monitoring_core == "cmc":
+ output = output.replace("\n", "\x01",
1).replace("\n","\\n")
result = "\t%d\t%s\t%s\n" % (state, service,
output.replace("\0", "")) # remove binary 0, CMC does not like it
if opt_keepalive:
global total_check_output
@@ -1297,6 +1298,7 @@ def submit_to_core(host, service, state, output):
# Send to Nagios/Icinga command pipe
elif check_submission == "pipe":
+# output = output.replace("\n", "\\n")
open_command_pipe()
if nagios_command_pipe:
nagios_command_pipe.write("[%d]
PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n" %
@@ -1307,6 +1309,7 @@ def submit_to_core(host, service, state, output):
# Create check result files for Nagios/Icinga
elif check_submission == "file":
+# output = output.replace("\n", "\\n")
open_checkresult_file()
if checkresult_file_fd:
now = time.time()