Module: check_mk
Branch: master
Commit: bca99adc250ce00d148a953187c2acee75451735
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bca99adc250ce0…
Author: Sergey Kipnis <sk(a)mathias-kettner.de>
Date: Fri May 3 13:04:03 2019 +0200
[CMK-2048] - winperf sections are identical to LWA's one
- added test for winperf section in yml file
- minor: comments for mrpe in the yml were updated
Change-Id: Idae184bc750294b516bd388ee3cbd7e8094c1244
---
agents/wnx/install/resources/check_mk.yml | 5 ++--
agents/wnx/watest/test-winperf.cpp | 50 ++++++++++++++++++++++++-------
2 files changed, 42 insertions(+), 13 deletions(-)
diff --git a/agents/wnx/install/resources/check_mk.yml
b/agents/wnx/install/resources/check_mk.yml
index aac3203..c577d33 100644
--- a/agents/wnx/install/resources/check_mk.yml
+++ b/agents/wnx/install/resources/check_mk.yml
@@ -137,8 +137,9 @@ winperf:
counters:
- 234: phydisk
- 510: if
- - 638: tcp_conn
- - Terminal Services: ts_sessions
+ - 238: processor
+ #- 638: tcp_conn
+ #- Terminal Services: ts_sessions
logfiles:
enabled: no
diff --git a/agents/wnx/watest/test-winperf.cpp b/agents/wnx/watest/test-winperf.cpp
index 402778a..31af786 100644
--- a/agents/wnx/watest/test-winperf.cpp
+++ b/agents/wnx/watest/test-winperf.cpp
@@ -3,22 +3,17 @@
//
#include "pch.h"
-#include "common/cfg_info.h"
-#include "common/mailslot_transport.h"
-#include "common/wtools.h"
-#include "tools/_misc.h"
-#include "tools/_process.h"
-
#include "carrier.h"
-#include "pch.h"
-#include "read_file.h"
-
#include "cfg.h"
#include "cfg_details.h"
-
+#include "common/cfg_info.h"
+#include "common/wtools.h"
#include "providers/p_perf_counters.h"
-
+#include "read_file.h"
#include "service_processor.h"
+#include "test_tools.h"
+#include "tools/_misc.h"
+#include "tools/_process.h"
namespace cma::cfg::details {
extern uint64_t RegisteredPerformanceFreq;
@@ -38,6 +33,39 @@ TEST(WinPerfTest, Pre) {
<< "Something wrong and value was not initialized";
}
+TEST(WinPerfTest, YmlCheck) {
+ using namespace cma::cfg;
+ using namespace cma::tools;
+ tst::YamlLoader w;
+ auto cfg = cma::cfg::GetLoadedConfig();
+
+ auto winperf_node = cfg[groups::kWinPerf];
+ ASSERT_TRUE(winperf_node.IsDefined());
+ ASSERT_TRUE(winperf_node.IsMap());
+
+ auto enabled = GetVal(groups::kWinPerf, vars::kEnabled, false);
+ EXPECT_TRUE(enabled);
+ auto counters = GetPairArray(groups::kWinPerf, vars::kWinPerfCounters);
+ ASSERT_EQ(counters.size(), 3);
+ const StringPairArray base_counters = {
+ {"238", "processor"},
+ {"234", "phydisk"},
+ {"510", "if"},
+ };
+
+ int found_count = 0;
+ for (const auto& counter : counters) {
+ std::pair<std::string, std::string> counter_low(counter.first,
+ counter.second);
+ StringLower(counter_low.first);
+ StringLower(counter_low.second);
+ auto found = Find(base_counters, counter_low);
+ if (found) found_count++;
+ }
+
+ EXPECT_EQ(found_count, 3) << "not correct counter list in the yml";
+}
+
TEST(WinPerfTest, RootCalls) {
// testing first line stamping
// 1548673688.07 510 2156253