Module: check_mk
Branch: master
Commit: e6ec3781ba6e34eaa8388ab8cdcd1359944107d3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e6ec3781ba6e34…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Feb 11 14:52:54 2016 +0100
windows agent: worked around bug in vmware esx that caused system uptime to produce bad
results
---
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 906240 -> 907776 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 906240 -> 907776 bytes
agents/windows/check_mk_agent.cc | 24 +++++++++++++++-------
agents/windows/check_mk_agent.exe | Bin 830464 -> 832000 bytes
agents/windows/check_mk_agent.msi | Bin 1997312 -> 2000384 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 830464 -> 832000 bytes
agents/windows/install_agent-64.exe | Bin 416143 -> 416904 bytes
agents/windows/install_agent.exe | Bin 406731 -> 407353 bytes
9 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/agents/windows/build_version b/agents/windows/build_version
index 53d108b..939b0cb 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-1231
+1233
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 12672f1..5ffab7b 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 aaaf191..4e864d9 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 19c901f..082538a 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -322,15 +322,25 @@ void section_systemtime(OutputProxy &out) {
void section_uptime(OutputProxy &out) {
crash_log("<<<uptime>>>");
- static LARGE_INTEGER Frequency, Ticks;
- QueryPerformanceFrequency(&Frequency);
- QueryPerformanceCounter(&Ticks);
- Ticks.QuadPart = Ticks.QuadPart - Frequency.QuadPart;
- unsigned int uptime = (double)Ticks.QuadPart / Frequency.QuadPart;
+
+ std::string uptime = "0";
+
+ typedef ULONGLONG WINAPI (*GetTickCount64_type)(void);
+ DYNAMIC_FUNC(GetTickCount64, L"kernel32.dll");
+ if (GetTickCount64_dyn != nullptr) {
+ // GetTickCount64 is only available on Vista/2008 and newer
+ uptime = std::to_string(GetTickCount64_dyn() / 1000);
+ } else {
+ // fallback if GetTickCount64 is not available
+ wmi::Result res = WMILookup::get().query(
+ L"SELECT SystemUpTime FROM
Win32_PerfFormattedData_PerfOS_System");
+ uptime = res.get<std::string>(L"SystemUpTime");
+ }
+
out.output(
"<<<uptime>>>\n"
- "%u\n",
- uptime);
+ "%s\n",
+ uptime.c_str());
}
// .----------------------------------------------------------------------.
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 9f0ff83..2b81fa5 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 d26f970..95d0461 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 2735b75..22c2986 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 6b31833..8b18ba5 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 ba645aa..9ad7b41 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ