| 24 | REGISTER_STATSFUNCTION(CheckerComponent, &CheckerComponent::StatsFunc); |
| 25 | |
| 26 | void 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 | |
| 47 | void CheckerComponent::OnConfigLoaded() |
| 48 | { |
nothing calls this directly
no test coverage detected