Module: check_mk
Branch: master
Commit: e73ad7e99fb4beb716c71daed68d38b245e24ce0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e73ad7e99fb4be…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Mar 10 09:21:02 2016 +0100
fixed compilation of pdh-based perfcounter implementation (not currently used)
---
agents/windows/PerfCounterPdh.cc | 1 -
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 910336 -> 910336 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 910336 -> 910336 bytes
agents/windows/check_mk_agent.cc | 4 +-
agents/windows/check_mk_agent.exe | Bin 836096 -> 836096 bytes
agents/windows/check_mk_agent.msi | Bin 2007040 -> 2007040 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 836096 -> 836096 bytes
agents/windows/install_agent-64.exe | Bin 418357 -> 418513 bytes
agents/windows/install_agent.exe | Bin 408775 -> 408949 bytes
agents/windows/plugins/rstcli.bat | 30 +++++++--------
agents/windows/stringutil.cc | 44 ++++++++++++++++++++++
agents/windows/stringutil.h | 1 +
13 files changed, 63 insertions(+), 19 deletions(-)
diff --git a/agents/windows/PerfCounterPdh.cc b/agents/windows/PerfCounterPdh.cc
index 30cf783..6f4b5a9 100644
--- a/agents/windows/PerfCounterPdh.cc
+++ b/agents/windows/PerfCounterPdh.cc
@@ -278,7 +278,6 @@ void PerfCounterQuery::execute() {
if (((DWORD)status != ERROR_SUCCESS) &&
((DWORD)status != PDH_NO_MORE_DATA)) {
- printf("query status: %x\n", (DWORD)status);
throw std::runtime_error(get_win_error_as_string(status));
}
}
diff --git a/agents/windows/build_version b/agents/windows/build_version
index e847bdc..0123fb2 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-1364
+1366
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 202327b..a4fe869 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 dcd99f0..c04890d 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 427b2b6..1494306 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -593,8 +593,8 @@ void dump_performance_counters(OutputProxy &out, unsigned
counter_base_number,
LARGE_INTEGER Frequency;
QueryPerformanceFrequency(&Frequency);
out.output("<<<winperf_%s>>>\n", countername);
- out.output("%.2f %u %" PRId64 "\n", current_time(),
counter_base_number,
- Frequency.QuadPart);
+ out.output("%.2f %u %" PRId64 "\n", current_time(),
+ counter_base_number, Frequency.QuadPart);
std::vector<PERF_INSTANCE_DEFINITION *> instances =
counterObject.instances();
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 920b73e..093426c 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 506e786..b765111 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 82df89c..6da8a1f 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 92c6baf..539bc5f 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 57f90ad..2b347b3 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ
diff --git a/agents/windows/plugins/rstcli.bat b/agents/windows/plugins/rstcli.bat
index a2c041f..12ea8e5 100644
--- a/agents/windows/plugins/rstcli.bat
+++ b/agents/windows/plugins/rstcli.bat
@@ -1,15 +1,15 @@
-@ECHO off & setlocal EnableDelayedExpansion
-
-REM customize rstcli to your needs
-SET "rstcli=!ProgramFiles!\rstcli\rstcli64.exe"
-SET "rstcli_x86=!ProgramFiles!\rstcli\rstcli.exe"
-
-ECHO ^<^<^<rstcli:sep(58)^>^>^>
-IF EXIST !rstcli! (
- !rstcli! --information --volume
-) ELSE IF EXIST !rstcli_x86! (
- !rstcli_x86! --information --volume
-) ELSE (
- ECHO rstcli not found
-)
-
+@ECHO off & setlocal EnableDelayedExpansion
+
+REM customize rstcli to your needs
+SET "rstcli=!ProgramFiles!\rstcli\rstcli64.exe"
+SET "rstcli_x86=!ProgramFiles!\rstcli\rstcli.exe"
+
+ECHO ^<^<^<rstcli:sep(58)^>^>^>
+IF EXIST !rstcli! (
+ !rstcli! --information --volume
+) ELSE IF EXIST !rstcli_x86! (
+ !rstcli_x86! --information --volume
+) ELSE (
+ ECHO rstcli not found
+)
+
diff --git a/agents/windows/stringutil.cc b/agents/windows/stringutil.cc
index c697f5d..0e45b14 100644
--- a/agents/windows/stringutil.cc
+++ b/agents/windows/stringutil.cc
@@ -203,6 +203,50 @@ bool globmatch(const char *pattern, const char *astring) {
return *p == 0;
}
+bool globmatch(const wchar_t *pattern, const wchar_t *astring) {
+ const wchar_t *p = pattern;
+ const wchar_t *s = astring;
+ while (*s) {
+ if (!*p) return false; // pattern too short
+
+ // normal character-wise match
+ if (towlower(*p) == towlower(*s) || *p == L'?') {
+ p++;
+ s++;
+ }
+
+ // non-matching charactetr
+ else if (*p != L'*')
+ return false;
+
+ else { // check *
+ // If there is more than one asterisk in the pattern,
+ // we need to try out several variants. We do this
+ // by backtracking (smart, eh?)
+ int maxlength = wcslen(s);
+ // replace * by a sequence of ?, at most the rest length of s
+ wchar_t *subpattern = (wchar_t *)malloc(
+ (wcslen(p) + maxlength + 1) * sizeof(wchar_t));
+ bool match = false;
+ for (int i = 0; i <= maxlength; i++) {
+ for (int x = 0; x < i; x++) subpattern[x] = L'?';
+ wcscpy(subpattern + i, p + 1); // omit leading '*'
+ if (globmatch(subpattern, s)) {
+ match = true;
+ break;
+ }
+ }
+ free(subpattern);
+ return match;
+ }
+ }
+
+ // string has ended, pattern not. Pattern must only
+ // contain * now if it wants to match
+ while (*p == L'*') p++;
+ return *p == 0;
+}
+
#ifdef _WIN32
std::string get_win_error_as_string(DWORD error_id) {
// Get the error message, if any.
diff --git a/agents/windows/stringutil.h b/agents/windows/stringutil.h
index 3126a04..9bff062 100644
--- a/agents/windows/stringutil.h
+++ b/agents/windows/stringutil.h
@@ -61,6 +61,7 @@ bool ci_equal(const std::string &lhs, const std::string &rhs);
// Do a simple pattern matching with the jokers * and ?.
// This is case insensitive (windows-like).
bool globmatch(const char *pattern, const char *astring);
+bool globmatch(const wchar_t *pattern, const wchar_t *astring);
template <typename T>
std::basic_string<T> join(const std::vector<std::basic_string<T>>
&input,