Module: check_mk
Branch: master
Commit: a3e385ec7638c5380db10faa85143e4cc7a32d89
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a3e385ec7638c5…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Jan 27 13:24:22 2017 +0100
4016 FIX Windows Agents: fixed broken custom windows performance counter monitoring
(winperf section)
Change-Id: I001dbabd902d9fcf8e26f34eca3a876949402cec
---
.werks/4016 | 9 ++++++++
ChangeLog | 1 +
agents/windows/SectionManager.cc | 27 +++++++++++++++--------
agents/windows/SectionManager.h | 2 +-
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 1439232 -> 1328640 bytes
agents/windows/check_mk_agent-64.unstripped.exe | Bin 17018273 -> 15652368 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 1439232 -> 1328640 bytes
agents/windows/check_mk_agent.cc | 1 +
agents/windows/check_mk_agent.exe | Bin 1304064 -> 1305088 bytes
agents/windows/check_mk_agent.msi | Bin 3014144 -> 2903552 bytes
agents/windows/check_mk_agent.unstripped.exe | Bin 13537258 -> 13543976 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 1304064 -> 1305088 bytes
agents/windows/crash.exe | Bin 101624 -> 101624 bytes
agents/windows/install_agent-64.exe | Bin 615184 -> 586639 bytes
agents/windows/install_agent.exe | Bin 583368 -> 583697 bytes
agents/windows/nowin.exe | Bin 103760 -> 103760 bytes
agents/windows/sections/SectionWMI.cc | 4 ++++
18 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/.werks/4016 b/.werks/4016
new file mode 100644
index 0000000..ac099f4
--- /dev/null
+++ b/.werks/4016
@@ -0,0 +1,9 @@
+Title: Windows Agents: fixed broken custom windows performance counter monitoring
(winperf section)
+Level: 2
+Component: checks
+Compatible: compat
+Version: 1.4.0i4
+Date: 1485519795
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 7daf617..473e0c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -75,6 +75,7 @@
* 4304 FIX: mk_inventory.linux: fixed missing redirection to null device in if
statement
* 4305 FIX: postgres_stat_database.size: fixed missing database size perfometer
* 4313 FIX: ps: Improved performance of ps check on systems with a large number of
processes
+ * 4016 FIX: Windows Agents: fixed broken custom windows performance counter
monitoring (winperf section)
Multisite:
* 4169 View action: Default values of sticky, notification and persistent options can
now be configured via global settings....
diff --git a/agents/windows/SectionManager.cc b/agents/windows/SectionManager.cc
index 57f8c31..2478b29 100644
--- a/agents/windows/SectionManager.cc
+++ b/agents/windows/SectionManager.cc
@@ -41,13 +41,19 @@ void SectionManager::addSection(Section *section) {
}
bool SectionManager::sectionEnabled(const std::string &name) const {
- // if no sections were set, assume they are all enabled
+ // If no sections were set, assume they are all enabled
+ std::string section_name = name;
+
+ // Special handling for winperf_* custom sections
+ if (name.substr(0, 8) == std::string("winperf_"))
+ section_name = std::string("winperf");
+
bool is_disabled =
- _disabled_sections->find(name) != _disabled_sections->end();
+ _disabled_sections->find(section_name) != _disabled_sections->end();
bool is_enabled =
!_enabled_sections.wasAssigned() ||
- (_enabled_sections->find(name) != _enabled_sections->end());
+ (_enabled_sections->find(section_name) != _enabled_sections->end());
return !is_disabled && is_enabled;
}
@@ -59,6 +65,15 @@ bool SectionManager::useRealtimeMonitoring() const {
return _realtime_sections->size();
}
+void SectionManager::loadDynamicSections() {
+ for (winperf_counter *counter : *_winperf_counters) {
+ if (counter->id != -1) {
+ addSection((new SectionWinperf(counter->name.c_str()))
+ ->withBase(counter->id));
+ }
+ }
+}
+
void SectionManager::loadStaticSections(Configuration &config,
const Environment &env) {
addSection(new SectionCrashDebug(config));
@@ -76,12 +91,6 @@ void SectionManager::loadStaticSections(Configuration &config,
->withBase(238)
->withRealtimeSupport());
- for (winperf_counter *counter : *_winperf_counters) {
- if (counter->id != -1) {
- addSection((new SectionWinperf(counter->name.c_str()))
- ->withBase(counter->id));
- }
- }
addSection(new SectionEventlog(config));
addSection(new SectionLogwatch(config, env));
diff --git a/agents/windows/SectionManager.h b/agents/windows/SectionManager.h
index d8cc3c0..0bdf38b 100644
--- a/agents/windows/SectionManager.h
+++ b/agents/windows/SectionManager.h
@@ -65,7 +65,7 @@ public:
~SectionManager() { _sections.clear(); }
void emitConfigLoaded(const Environment &env);
-
+ void loadDynamicSections();
const std::vector<std::unique_ptr<Section>> §ions() const {
return _sections;
}
diff --git a/agents/windows/build_version b/agents/windows/build_version
index 38e2443..324f7a3 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-2488
+2518
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 606a633..3dfb0ce 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 9a63b28..a2032f4 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 dc53938..0025556 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 40f5541..c745e59 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -938,6 +938,7 @@ void RunImmediate(const char *mode, int argc, char **argv) {
g_config->parser.readSettings();
postProcessOnlyFrom();
+ g_sections->loadDynamicSections();
g_sections->emitConfigLoaded(env);
if (!strcmp(mode, "test"))
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index d6d9939..d545f22 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 7c829e0..c04a63a 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 5ab29b6..805f0dd 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 55da4fa..42eff1c 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/crash.exe b/agents/windows/crash.exe
index 12b2a4f..70c7b87 100755
Binary files a/agents/windows/crash.exe and b/agents/windows/crash.exe differ
diff --git a/agents/windows/install_agent-64.exe b/agents/windows/install_agent-64.exe
index c8cdad9..1bc1758 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 2de2c64..f8b352f 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ
diff --git a/agents/windows/nowin.exe b/agents/windows/nowin.exe
index 7f9fecd..142db98 100755
Binary files a/agents/windows/nowin.exe and b/agents/windows/nowin.exe differ
diff --git a/agents/windows/sections/SectionWMI.cc
b/agents/windows/sections/SectionWMI.cc
index 86c2abc..e4564dd 100644
--- a/agents/windows/sections/SectionWMI.cc
+++ b/agents/windows/sections/SectionWMI.cc
@@ -27,6 +27,10 @@
#include "../wmiHelper.h"
#include <ctime>
+
+// How to fix broken performance counters
+//
http://johansenreidar.blogspot.de/2014/01/windows-server-rebuild-all-perfor…
+
SectionWMI::SectionWMI(const char *name) : Section(name) { withSeparator(','); }
SectionWMI *SectionWMI::withNamespace(const wchar_t *name) {