Module: check_mk
Branch: master
Commit: 8225e3daba7d8acbb1d66efd7e7725e40b195369
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8225e3daba7d8a…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Dec 17 09:19:34 2015 +0100
windows agent: a few bugfixes to realtime updating and added section ids for the now
individual winperf sections
---
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 885248 -> 886784 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 885248 -> 886784 bytes
agents/windows/check_mk_agent.cc | 22 +++++++---
agents/windows/check_mk_agent.exe | Bin 806400 -> 808448 bytes
agents/windows/check_mk_agent.msi | Bin 1950720 -> 1954304 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 806400 -> 808448 bytes
agents/windows/install_agent-64.exe | Bin 405382 -> 406153 bytes
agents/windows/install_agent.exe | Bin 396250 -> 396979 bytes
agents/windows/types.h | 50 +++++++++++++---------
10 files changed, 45 insertions(+), 29 deletions(-)
diff --git a/agents/windows/build_version b/agents/windows/build_version
index a6905f8..e3c00fd 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-999
+1042
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index ae7e1e9..d638b86 100755
Binary files a/agents/windows/check_mk_agent-64.exe and
b/agents/windows/check_mk_agent-64.exe differ
diff --git a/agents/windows/check_mk_agent-64.unversioned.exe
b/agents/windows/check_mk_agent-64.unversioned.exe
index aa111b2..f1783a4 100755
Binary files a/agents/windows/check_mk_agent-64.unversioned.exe and
b/agents/windows/check_mk_agent-64.unversioned.exe differ
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index 5fca2d5..0e81382 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -65,6 +65,7 @@
#include <vector>
#include <string>
#include <algorithm>
+#include <sys/time.h>
#include "stringutil.h"
#include "Environment.h"
#include "Configuration.h"
@@ -91,7 +92,7 @@
const char *check_mk_version = CHECK_MK_VERSION;
-static const char RT_PROTOCOL_VERSION[2] = { 0x00, 0x00 };
+static const char RT_PROTOCOL_VERSION[2] = { '0', '0' };
#define SERVICE_NAME "Check_MK_Agent"
#define KiloByte 1024
@@ -3145,15 +3146,21 @@ DWORD WINAPI realtime_check_func(void *data_in)
static const size_t TARGET_DATAGRAM_SIZE = 65507L - 1000L;
EncryptingBufferedSocketProxy out(INVALID_SOCKET, g_config->passphrase(),
TARGET_DATAGRAM_SIZE);
- time_t before = time(NULL);
+ timeval before;
+ gettimeofday(&before, 0);
while (!data->terminate) {
- // wait for 1 second minus the time the last iteration took
- // do we need a more precise time here?
- ::Sleep(1000 - (time(NULL) - before));
- before = time(NULL);
+ timeval now;
+ gettimeofday(&now, 0);
+ long duration = (now.tv_sec - before.tv_sec) * 1000
+ + (now.tv_usec - before.tv_usec) / 1000;
+ if (duration < 1000) {
+ ::Sleep(1000 - duration);
+ }
+ gettimeofday(&before, 0);
+
MutexLock guard(data->mutex);
// adhere to the configured timeout
- if (before < data->push_until) {
+ if (time(NULL) < data->push_until) {
// if a new request was made, reestablish the connection
if (data->new_request) {
data->new_request = false;
@@ -3270,6 +3277,7 @@ void do_adhoc(const Environment &env)
:
"inactive");
if (g_config->useRealtimeMonitoring() != 0) {
+ thread_data.terminate = false;
realtime_checker.start();
}
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 6ac44f2..c6776a6 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/agents/windows/check_mk_agent.msi b/agents/windows/check_mk_agent.msi
index bf36970..3845bca 100755
Binary files a/agents/windows/check_mk_agent.msi and b/agents/windows/check_mk_agent.msi
differ
diff --git a/agents/windows/check_mk_agent.unversioned.exe
b/agents/windows/check_mk_agent.unversioned.exe
index b2b9b19..d6fa563 100755
Binary files a/agents/windows/check_mk_agent.unversioned.exe and
b/agents/windows/check_mk_agent.unversioned.exe differ
diff --git a/agents/windows/install_agent-64.exe b/agents/windows/install_agent-64.exe
index d5252b6..31c305e 100755
Binary files a/agents/windows/install_agent-64.exe and
b/agents/windows/install_agent-64.exe differ
diff --git a/agents/windows/install_agent.exe b/agents/windows/install_agent.exe
index 9089dfe..bcfe2f4 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ
diff --git a/agents/windows/types.h b/agents/windows/types.h
index 300b8ce..af9e241 100644
--- a/agents/windows/types.h
+++ b/agents/windows/types.h
@@ -48,31 +48,39 @@
#endif
-static const unsigned int SECTION_CHECK_MK = 0x00000001;
-static const unsigned int SECTION_UPTIME = 0x00000002;
-static const unsigned int SECTION_DF = 0x00000004;
-static const unsigned int SECTION_PS = 0x00000008;
-static const unsigned int SECTION_MEM = 0x00000010;
-static const unsigned int SECTION_SERVICES = 0x00000020;
-static const unsigned int SECTION_WINPERF = 0x00000040;
-static const unsigned int SECTION_LOGWATCH = 0x00000080;
-static const unsigned int SECTION_SYSTEMTIME = 0x00000100;
-static const unsigned int SECTION_PLUGINS = 0x00000200;
-static const unsigned int SECTION_LOCAL = 0x00000400;
-static const unsigned int SECTION_SPOOL = 0x00000800;
-static const unsigned int SECTION_MRPE = 0x00001000;
-static const unsigned int SECTION_FILEINFO = 0x00002000;
-static const unsigned int SECTION_LOGFILES = 0x00004000;
-static const unsigned int SECTION_CRASHLOG = 0x00008000;
-static const unsigned int SECTION_CPU = 0x00010000;
-static const unsigned int SECTION_EXCHANGE = 0x00020000;
-static const unsigned int SECTION_WEBSERVICES = 0x00040000;
-static const unsigned int SECTION_DOTNET = 0x00080000;
+static const unsigned int SECTION_CHECK_MK = 0x00000001;
+static const unsigned int SECTION_UPTIME = 0x00000002;
+static const unsigned int SECTION_DF = 0x00000004;
+static const unsigned int SECTION_PS = 0x00000008;
+static const unsigned int SECTION_MEM = 0x00000010;
+static const unsigned int SECTION_SERVICES = 0x00000020;
+// 0x40 up for grabs
+static const unsigned int SECTION_LOGWATCH = 0x00000080;
+static const unsigned int SECTION_SYSTEMTIME = 0x00000100;
+static const unsigned int SECTION_PLUGINS = 0x00000200;
+static const unsigned int SECTION_LOCAL = 0x00000400;
+static const unsigned int SECTION_SPOOL = 0x00000800;
+static const unsigned int SECTION_MRPE = 0x00001000;
+static const unsigned int SECTION_FILEINFO = 0x00002000;
+static const unsigned int SECTION_LOGFILES = 0x00004000;
+static const unsigned int SECTION_CRASHLOG = 0x00008000;
+static const unsigned int SECTION_CPU = 0x00010000;
+static const unsigned int SECTION_EXCHANGE = 0x00020000;
+static const unsigned int SECTION_WEBSERVICES = 0x00040000;
+static const unsigned int SECTION_DOTNET = 0x00080000;
+static const unsigned int SECTION_WINPERF_IF = 0x00100000;
+static const unsigned int SECTION_WINPERF_CPU = 0x00200000;
+static const unsigned int SECTION_WINPERF_PHYDISK = 0x00400000;
+static const unsigned int SECTION_WINPERF_CONFIG = 0x00800000;
+static const unsigned int SECTION_WINPERF = SECTION_WINPERF_IF
+ | SECTION_WINPERF_CPU
+ | SECTION_WINPERF_PHYDISK
+ | SECTION_WINPERF_CONFIG;
static const unsigned int VALID_REALTIME_SECTIONS = SECTION_MEM
| SECTION_DF
- | SECTION_WINPERF;
+ | SECTION_WINPERF_CPU;
// Needed for only_from
struct ipspec {