[checkmk-commits] Check_MK Git: check_mk: #2075 FIX check_mk_agent: fixed formatting error for windows eventlog entries > 2048 characters

Andreas Boesl ab at mathias-kettner.de
Wed Apr 29 16:45:44 CEST 2015


Module: check_mk
Branch: master
Commit: 5e8afefa771407d82080394c9f9379e5381f595a
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5e8afefa771407d82080394c9f9379e5381f595a

Author: Andreas Boesl <ab at mathias-kettner.de>
Date:   Wed Apr 29 16:45:12 2015 +0200

#2075 FIX check_mk_agent: fixed formatting error for windows eventlog entries > 2048 characters

The windows agent was unable to display eventlog entries when the character count of such an entry exceeded 2048.
In this case the agent only reported a subset of the information, namely the strings which are filled into the placeholders of the larger message.

---

 .werks/2075                      |   11 +++++++++++
 ChangeLog                        |    1 +
 agents/windows/check_mk_agent.cc |    6 +++---
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/.werks/2075 b/.werks/2075
new file mode 100644
index 0000000..58835ba
--- /dev/null
+++ b/.werks/2075
@@ -0,0 +1,11 @@
+Title: check_mk_agent: fixed formatting error for windows eventlog entries > 2048 characters
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1430318451
+
+The windows agent was unable to display eventlog entries when the character count of such an entry exceeded 2048.
+In this case the agent only reported a subset of the information, namely the strings which are filled into the placeholders of the larger message.
diff --git a/ChangeLog b/ChangeLog
index 8e94594..3845898 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -349,6 +349,7 @@
     * 2247 FIX: ibm_svc_mdiskgrp: Made check working with different firmware versions outputs
     * 2071 FIX: windows agent: fileinfo check now correctly reports empty directories...
     * 2072 FIX: agent_netapp, netapp_api_volumes, netapp_api_disks: Improved check output...
+    * 2075 FIX: check_mk_agent: fixed formatting error for windows eventlog entries > 2048 characters...
 
     Multisite:
     * 1758 Improved exception hander: Shows details without additional debug request, added mailto link for error report...
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index 3f6305d..d63704a 100755
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -1052,7 +1052,7 @@ void grow_eventlog_buffer(int newsize)
 bool output_eventlog_entry(SOCKET &out, char *dllpath, EVENTLOGRECORD *event, char type_char,
         const char *logname, const char *source_name, WCHAR **strings)
 {
-    char msgbuffer[2048];
+    char msgbuffer[8192];
     char dll_realpath[128];
     HINSTANCE dll;
 
@@ -1082,7 +1082,7 @@ bool output_eventlog_entry(SOCKET &out, char *dllpath, EVENTLOGRECORD *event, ch
     else
         dll = NULL;
 
-    WCHAR wmsgbuffer[2048];
+    WCHAR wmsgbuffer[8192];
     DWORD dwFlags = FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_FROM_SYSTEM;
     if (dll)
         dwFlags |= FORMAT_MESSAGE_FROM_HMODULE;
@@ -1098,7 +1098,7 @@ bool output_eventlog_entry(SOCKET &out, char *dllpath, EVENTLOGRECORD *event, ch
         0, // accept any language
         wmsgbuffer,
         // msgbuffer,
-        2048,
+        8192,
         (char **)strings
     );
     crash_log("Formatting Message - DONE");



More information about the checkmk-commits mailing list