diff --git a/lib/base/benchmark.hpp b/lib/base/benchmark.hpp index 4c2c5f71595..01dd2fb5c0f 100644 --- a/lib/base/benchmark.hpp +++ b/lib/base/benchmark.hpp @@ -25,7 +25,7 @@ class Benchmark * @return The total accumulated time in seconds */ template - explicit operator T() const noexcept + operator T() const noexcept { return std::chrono::duration(Clock::duration(m_Sum.load(std::memory_order_relaxed))).count(); } diff --git a/lib/methods/clusterzonechecktask.cpp b/lib/methods/clusterzonechecktask.cpp index fd52534c308..2fe8985794e 100644 --- a/lib/methods/clusterzonechecktask.cpp +++ b/lib/methods/clusterzonechecktask.cpp @@ -137,6 +137,9 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che double messagesReceivedPerSecond = 0; double bytesSentPerSecond = 0; double bytesReceivedPerSecond = 0; + double secondsReadingMessages = 0; + double secondsAwaitingSemaphore = 0; + double secondsProcessingMessages = 0; { auto endpoints (zone->GetEndpoints()); @@ -160,6 +163,9 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond(); bytesSentPerSecond += endpoint->GetBytesSentPerSecond(); bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond(); + secondsReadingMessages += endpoint->GetSecondsReadingMessages(); + secondsAwaitingSemaphore += endpoint->GetSecondsAwaitingSemaphore(); + secondsProcessingMessages += endpoint->GetSecondsProcessingMessages(); } if (!connected && endpoints.size() == 1u && *endpoints.begin() == Endpoint::GetLocalEndpoint()) { @@ -210,7 +216,10 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che new PerfdataValue("sum_messages_sent_per_second", messagesSentPerSecond), new PerfdataValue("sum_messages_received_per_second", messagesReceivedPerSecond), new PerfdataValue("sum_bytes_sent_per_second", bytesSentPerSecond), - new PerfdataValue("sum_bytes_received_per_second", bytesReceivedPerSecond) + new PerfdataValue("sum_bytes_received_per_second", bytesReceivedPerSecond), + new PerfdataValue("sum_seconds_reading_messages", secondsReadingMessages), + new PerfdataValue("sum_seconds_awaiting_semaphore", secondsAwaitingSemaphore), + new PerfdataValue("sum_seconds_processing_messages", secondsProcessingMessages) })); checkable->ProcessCheckResult(cr); diff --git a/lib/methods/icingachecktask.cpp b/lib/methods/icingachecktask.cpp index d3eae1f33f2..7f2e028b6f3 100644 --- a/lib/methods/icingachecktask.cpp +++ b/lib/methods/icingachecktask.cpp @@ -127,6 +127,9 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes double messagesReceivedPerSecond = 0; double bytesSentPerSecond = 0; double bytesReceivedPerSecond = 0; + double secondsReadingMessages = 0; + double secondsAwaitingSemaphore = 0; + double secondsProcessingMessages = 0; for (const Endpoint::Ptr& endpoint : endpoints) { @@ -140,6 +143,9 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond(); bytesSentPerSecond += endpoint->GetBytesSentPerSecond(); bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond(); + secondsReadingMessages += endpoint->GetSecondsReadingMessages(); + secondsAwaitingSemaphore += endpoint->GetSecondsAwaitingSemaphore(); + secondsProcessingMessages += endpoint->GetSecondsProcessingMessages(); } perfdata->Add(new PerfdataValue("last_messages_sent", lastMessageSent)); @@ -148,6 +154,9 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes perfdata->Add(new PerfdataValue("sum_messages_received_per_second", messagesReceivedPerSecond)); perfdata->Add(new PerfdataValue("sum_bytes_sent_per_second", bytesSentPerSecond)); perfdata->Add(new PerfdataValue("sum_bytes_received_per_second", bytesReceivedPerSecond)); + perfdata->Add(new PerfdataValue("sum_seconds_reading_messages", secondsReadingMessages)); + perfdata->Add(new PerfdataValue("sum_seconds_awaiting_semaphore", secondsAwaitingSemaphore)); + perfdata->Add(new PerfdataValue("sum_seconds_processing_messages", secondsProcessingMessages)); cr->SetPerformanceData(perfdata); ServiceState state = ServiceOK; diff --git a/lib/remote/endpoint.cpp b/lib/remote/endpoint.cpp index e534fc17840..67d53bc484d 100644 --- a/lib/remote/endpoint.cpp +++ b/lib/remote/endpoint.cpp @@ -136,3 +136,18 @@ double Endpoint::GetBytesReceivedPerSecond() const { return m_BytesReceived.CalculateRate(Utility::GetTime(), 60); } + +double Endpoint::GetSecondsReadingMessages() const +{ + return m_InputReadTime; +} + +double Endpoint::GetSecondsAwaitingSemaphore() const +{ + return m_InputSemaphoreTime; +} + +double Endpoint::GetSecondsProcessingMessages() const +{ + return m_InputProcessTime; +} diff --git a/lib/remote/endpoint.hpp b/lib/remote/endpoint.hpp index 737a8d62609..a849840461a 100644 --- a/lib/remote/endpoint.hpp +++ b/lib/remote/endpoint.hpp @@ -58,6 +58,10 @@ class Endpoint final : public ObjectImpl double GetBytesSentPerSecond() const override; double GetBytesReceivedPerSecond() const override; + double GetSecondsReadingMessages() const override; + double GetSecondsAwaitingSemaphore() const override; + double GetSecondsProcessingMessages() const override; + protected: void OnAllConfigLoaded() override; diff --git a/lib/remote/endpoint.ti b/lib/remote/endpoint.ti index 78551ecf0dd..e10410cd34e 100644 --- a/lib/remote/endpoint.ti +++ b/lib/remote/endpoint.ti @@ -54,6 +54,18 @@ class Endpoint : ConfigObject [no_user_modify, no_storage] double bytes_received_per_second { get; }; + + [no_user_modify, no_storage] double seconds_reading_messages { + get; + }; + + [no_user_modify, no_storage] double seconds_awaiting_semaphore { + get; + }; + + [no_user_modify, no_storage] double seconds_processing_messages { + get; + }; }; }