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

Method StatsFunc

lib/perfdata/gelfwriter.cpp:54–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54void GelfWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
55{
56 DictionaryData nodes;
57
58 for (const GelfWriter::Ptr& gelfwriter : ConfigType::GetObjectsByType<GelfWriter>()) {
59 size_t workQueueItems = gelfwriter->m_WorkQueue.GetLength();
60 double workQueueItemRate = gelfwriter->m_WorkQueue.GetTaskCount(60) / 60.0;
61
62 nodes.emplace_back(gelfwriter->GetName(), new Dictionary({
63 { "work_queue_items", workQueueItems },
64 { "work_queue_item_rate", workQueueItemRate },
65 { "connected", gelfwriter->GetConnected() },
66 { "source", gelfwriter->GetSource() }
67 }));
68
69 perfdata->Add(new PerfdataValue("gelfwriter_" + gelfwriter->GetName() + "_work_queue_items", workQueueItems));
70 perfdata->Add(new PerfdataValue("gelfwriter_" + gelfwriter->GetName() + "_work_queue_item_rate", workQueueItemRate));
71 }
72
73 status->Set("gelfwriter", new Dictionary(std::move(nodes)));
74}
75
76void GelfWriter::Resume()
77{

Callers

nothing calls this directly

Calls 6

GetTaskCountMethod · 0.80
GetConnectedMethod · 0.80
GetLengthMethod · 0.45
GetNameMethod · 0.45
AddMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected