From 1f8a0a3df522bd841d4625e2a799272f2390f22f Mon Sep 17 00:00:00 2001 From: Sergey Kipnis Date: Tue, 14 Jan 2025 17:03:18 +0100 Subject: [PATCH] 17300 Windows agent do not use timeout on fail for section CpuLoad and DotNetClr Previously, after a WMI error occurred during the generation of specific WMI sections, particularly the CpuLoad and DotNetClr sections, the agent would stop creating these sections for a period of one hour. This was done to reduce noise in the log file. However, this approach led to situations where a random WMI failure could prevent data collection for an hour. Since this release the delay for the CpuLoad and DotNetclr sections is eliminated thus making monitoring more smooth. Change-Id: I4fc70c6aa4d9b5a13442d4d6ea8eafc3e4248ed6 --- .werks/17300 | 19 +++++++++++++++++++ agents/wnx/src/engine/providers/internal.cpp | 11 ++++++----- agents/wnx/watest/test-section_wmi.cpp | 8 ++++++-- 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 .werks/17300 diff --git a/.werks/17300 b/.werks/17300 new file mode 100644 index 00000000000..cb94f370b60 --- /dev/null +++ b/.werks/17300 @@ -0,0 +1,19 @@ +Title: Windows agent do not use timeout on fail for section CpuLoad and DotNetClr +Class: feature +Compatible: compat +Component: checks +Date: 1736870131 +Edition: cre +Level: 1 +Version: 2.2.0p39 + + +Previously, after a WMI error occurred during the generation of +specific WMI sections, particularly the CpuLoad and DotNetClr sections, +the agent would stop creating these sections for a period of one +hour. This was done to reduce noise in the log file. However, +this approach led to situations where a random WMI failure could +prevent data collection for an hour. + +Since this release, the delay on fail or the CpuLoad and DotNetClr +sections is eliminated thus making monitoring more smooth. diff --git a/agents/wnx/src/engine/providers/internal.cpp b/agents/wnx/src/engine/providers/internal.cpp index 083fcaaa4a5..c5b71a1f56d 100644 --- a/agents/wnx/src/engine/providers/internal.cpp +++ b/agents/wnx/src/engine/providers/internal.cpp @@ -21,10 +21,10 @@ const std::unordered_map &GetDelaysOnFail() { const static std::unordered_map delays_on_fail = { - {kDotNetClrMemory, cfg::G_DefaultDelayOnFail}, // - {kWmiWebservices, cfg::G_DefaultDelayOnFail}, // - {kWmiCpuLoad, cfg::G_DefaultDelayOnFail}, // - {kMsExch, cfg::G_DefaultDelayOnFail}, // + {kDotNetClrMemory, 0s}, // + {kWmiWebservices, cfg::G_DefaultDelayOnFail}, // + {kWmiCpuLoad, 0s}, // + {kMsExch, cfg::G_DefaultDelayOnFail}, // {kOhm, cfg::G_DefaultDelayOnFail}, // end of the real sections @@ -129,7 +129,8 @@ void Basic::setupDelayOnFail() noexcept { const auto &delay_in_seconds = GetDelaysOnFail().at(uniq_name_); delay_on_fail_ = delay_in_seconds; } catch (const std::out_of_range &) { - // do nothing here + XLOG::l.crit("Unsupported section name {}", uniq_name_); + delay_on_fail_ = std::chrono::seconds(0); } } diff --git a/agents/wnx/watest/test-section_wmi.cpp b/agents/wnx/watest/test-section_wmi.cpp index c7de4701763..e3d91cd20e8 100644 --- a/agents/wnx/watest/test-section_wmi.cpp +++ b/agents/wnx/watest/test-section_wmi.cpp @@ -518,12 +518,16 @@ TEST(WmiProviderTest, BasicWmi) { } TEST(WmiProviderTest, DelayOnFailDefault) { - for (const auto name : - {kOhm, kWmiCpuLoad, kWmiWebservices, kDotNetClrMemory, kMsExch}) { + for (const auto name : {kOhm, kWmiWebservices, kMsExch}) { Wmi b(name, ','); EXPECT_EQ(b.delayOnFail(), 3600s) << "bad delay for section by default " << name; } + for (const auto name : {kWmiCpuLoad, kDotNetClrMemory}) { + Wmi b(name, ','); + EXPECT_EQ(b.delayOnFail(), 0s) + << "bad delay for section by default " << name; + } } TEST(WmiProviderTest, DelayOnFailShift) {