MCPcopy Create free account
hub / github.com/Icinga/icinga2 / StatsFunc

Method StatsFunc

lib/checker/checkercomponent.cpp:26–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24REGISTER_STATSFUNCTION(CheckerComponent, &CheckerComponent::StatsFunc);
25
26void CheckerComponent::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
27{
28 DictionaryData nodes;
29
30 for (const CheckerComponent::Ptr& checker : ConfigType::GetObjectsByType<CheckerComponent>()) {
31 unsigned long idle = checker->GetIdleCheckables();
32 unsigned long pending = checker->GetPendingCheckables();
33
34 nodes.emplace_back(checker->GetName(), new Dictionary({
35 { "idle", idle },
36 { "pending", pending }
37 }));
38
39 String perfdata_prefix = "checkercomponent_" + checker->GetName() + "_";
40 perfdata->Add(new PerfdataValue(perfdata_prefix + "idle", Convert::ToDouble(idle)));
41 perfdata->Add(new PerfdataValue(perfdata_prefix + "pending", Convert::ToDouble(pending)));
42 }
43
44 status->Set("checkercomponent", new Dictionary(std::move(nodes)));
45}
46
47void CheckerComponent::OnConfigLoaded()
48{

Callers

nothing calls this directly

Calls 5

GetIdleCheckablesMethod · 0.80
GetPendingCheckablesMethod · 0.80
GetNameMethod · 0.45
AddMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected