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

Method StatsFunc

lib/perfdata/graphitewriter.cpp:57–76  ·  view source on GitHub ↗

* Feature stats interface * * @param status Key value pairs for feature stats * @param perfdata Array of PerfdataValue objects */

Source from the content-addressed store, hash-verified

55 * @param perfdata Array of PerfdataValue objects
56 */
57void GraphiteWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
58{
59 DictionaryData nodes;
60
61 for (const GraphiteWriter::Ptr& graphitewriter : ConfigType::GetObjectsByType<GraphiteWriter>()) {
62 size_t workQueueItems = graphitewriter->m_WorkQueue.GetLength();
63 double workQueueItemRate = graphitewriter->m_WorkQueue.GetTaskCount(60) / 60.0;
64
65 nodes.emplace_back(graphitewriter->GetName(), new Dictionary({
66 { "work_queue_items", workQueueItems },
67 { "work_queue_item_rate", workQueueItemRate },
68 { "connected", graphitewriter->GetConnected() }
69 }));
70
71 perfdata->Add(new PerfdataValue("graphitewriter_" + graphitewriter->GetName() + "_work_queue_items", workQueueItems));
72 perfdata->Add(new PerfdataValue("graphitewriter_" + graphitewriter->GetName() + "_work_queue_item_rate", workQueueItemRate));
73 }
74
75 status->Set("graphitewriter", new Dictionary(std::move(nodes)));
76}
77
78/**
79 * Resume is equivalent to Start, but with HA capabilities to resume at runtime.

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