Module: check_mk
Branch: master
Commit: 355299cfc8cac8b0b72d3b023d244a32385f31bf
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=355299cfc8cac8…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Mar 8 09:57:51 2017 +0100
4455 FIX windows agent: now longer crashes when no performancecounter for process
monitoring could be found
The agent now simply skips the ps section.
Change-Id: I46b2206de78344166be12d7f0576ff1cb5c7db28
---
.werks/4455 | 12 ++++++++++++
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 1338880 -> 1339392 bytes
agents/windows/check_mk_agent-64.unstripped.exe | Bin 15800314 -> 15810554 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 1338880 -> 1339392 bytes
agents/windows/check_mk_agent.exe | Bin 1316352 -> 1316864 bytes
agents/windows/check_mk_agent.msi | Bin 2925056 -> 2926080 bytes
agents/windows/check_mk_agent.unstripped.exe | Bin 13661730 -> 13671970 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 1316352 -> 1316864 bytes
agents/windows/install_agent-64.exe | Bin 591476 -> 591554 bytes
agents/windows/install_agent.exe | Bin 588705 -> 589009 bytes
agents/windows/sections/SectionPS.cc | 10 +++++++++-
12 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/.werks/4455 b/.werks/4455
new file mode 100644
index 0000000..ff44d05
--- /dev/null
+++ b/.werks/4455
@@ -0,0 +1,12 @@
+Title: windows agent: now longer crashes when no performancecounter for process
monitoring could be found
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1488963413
+Class: fix
+
+The agent now simply skips the ps section.
+
+
diff --git a/agents/windows/build_version b/agents/windows/build_version
index d2c2523..fe8591e 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-2635
+2639
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 40ef911..60b8d9a 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.unstripped.exe
b/agents/windows/check_mk_agent-64.unstripped.exe
index 3c081e0..490e6a4 100755
Binary files a/agents/windows/check_mk_agent-64.unstripped.exe and
b/agents/windows/check_mk_agent-64.unstripped.exe differ
diff --git a/agents/windows/check_mk_agent-64.unversioned.exe
b/agents/windows/check_mk_agent-64.unversioned.exe
index f6a3ff0..216c63c 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.exe b/agents/windows/check_mk_agent.exe
index 13b93e0..8c07b34 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 121aa24..3df16d9 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.unstripped.exe
b/agents/windows/check_mk_agent.unstripped.exe
index eaf04c2..9d28b6c 100755
Binary files a/agents/windows/check_mk_agent.unstripped.exe and
b/agents/windows/check_mk_agent.unstripped.exe differ
diff --git a/agents/windows/check_mk_agent.unversioned.exe
b/agents/windows/check_mk_agent.unversioned.exe
index 2d7483c..9156883 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 6f6e762..4eb40cc 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 633a805..3be3ba2 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ
diff --git a/agents/windows/sections/SectionPS.cc b/agents/windows/sections/SectionPS.cc
index 8d84e31..d4cfc00 100644
--- a/agents/windows/sections/SectionPS.cc
+++ b/agents/windows/sections/SectionPS.cc
@@ -246,7 +246,15 @@ bool SectionPS::outputWMI(std::ostream &out) {
bool SectionPS::outputNative(std::ostream &out) {
PROCESSENTRY32 pe32;
- process_entry_t process_perfdata = getProcessPerfdata();
+ process_entry_t process_perfdata;
+ try {
+ process_perfdata = getProcessPerfdata();
+ } catch (const std::runtime_error &e) {
+ // the most likely cause is that the wmi query fails, i.e. because the
+ // service is currently offline.
+ crash_log("Exception: Error while querying process perfdata: %s",
e.what());
+ return false;
+ }
WinHandle hProcessSnap(CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
if (hProcessSnap == INVALID_HANDLE_VALUE) {