diff --git a/lib/methods/clusterzonechecktask.cpp b/lib/methods/clusterzonechecktask.cpp index fd52534c308..404f50dafe1 100644 --- a/lib/methods/clusterzonechecktask.cpp +++ b/lib/methods/clusterzonechecktask.cpp @@ -133,6 +133,7 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che double lastMessageSent = 0; double lastMessageReceived = 0; + uint_fast64_t pendingOutgoingMessages = 0; double messagesSentPerSecond = 0; double messagesReceivedPerSecond = 0; double bytesSentPerSecond = 0; @@ -156,6 +157,7 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che if (endpoint->GetLastMessageReceived() > lastMessageReceived) lastMessageReceived = endpoint->GetLastMessageReceived(); + pendingOutgoingMessages += endpoint->GetPendingOutgoingMessages(); messagesSentPerSecond += endpoint->GetMessagesSentPerSecond(); messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond(); bytesSentPerSecond += endpoint->GetBytesSentPerSecond(); @@ -207,6 +209,7 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che new PerfdataValue("slave_lag", zoneLag, false, "s", lagWarning, lagCritical), new PerfdataValue("last_messages_sent", lastMessageSent), new PerfdataValue("last_messages_received", lastMessageReceived), + new PerfdataValue("sum_pending_outgoing_messages", pendingOutgoingMessages), new PerfdataValue("sum_messages_sent_per_second", messagesSentPerSecond), new PerfdataValue("sum_messages_received_per_second", messagesReceivedPerSecond), new PerfdataValue("sum_bytes_sent_per_second", bytesSentPerSecond), diff --git a/lib/methods/icingachecktask.cpp b/lib/methods/icingachecktask.cpp index d3eae1f33f2..5e66fdd3107 100644 --- a/lib/methods/icingachecktask.cpp +++ b/lib/methods/icingachecktask.cpp @@ -123,6 +123,7 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes double lastMessageSent = 0; double lastMessageReceived = 0; + uint_fast64_t pendingOutgoingMessages = 0; double messagesSentPerSecond = 0; double messagesReceivedPerSecond = 0; double bytesSentPerSecond = 0; @@ -136,6 +137,7 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes if (endpoint->GetLastMessageReceived() > lastMessageReceived) lastMessageReceived = endpoint->GetLastMessageReceived(); + pendingOutgoingMessages += endpoint->GetPendingOutgoingMessages(); messagesSentPerSecond += endpoint->GetMessagesSentPerSecond(); messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond(); bytesSentPerSecond += endpoint->GetBytesSentPerSecond(); @@ -144,6 +146,7 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes perfdata->Add(new PerfdataValue("last_messages_sent", lastMessageSent)); perfdata->Add(new PerfdataValue("last_messages_received", lastMessageReceived)); + perfdata->Add(new PerfdataValue("sum_pending_outgoing_messages", pendingOutgoingMessages)); perfdata->Add(new PerfdataValue("sum_messages_sent_per_second", messagesSentPerSecond)); perfdata->Add(new PerfdataValue("sum_messages_received_per_second", messagesReceivedPerSecond)); perfdata->Add(new PerfdataValue("sum_bytes_sent_per_second", bytesSentPerSecond)); diff --git a/lib/remote/endpoint.cpp b/lib/remote/endpoint.cpp index e534fc17840..fe6e099577b 100644 --- a/lib/remote/endpoint.cpp +++ b/lib/remote/endpoint.cpp @@ -101,6 +101,18 @@ Endpoint::Ptr Endpoint::GetLocalEndpoint() return listener->GetLocalEndpoint(); } +uint_fast64_t Endpoint::GetPendingOutgoingMessages() const +{ + uint_fast64_t pending = 0; + std::unique_lock lock (m_ClientsLock); + + for (auto& client : m_Clients) { + pending += client->GetPendingOutgoingMessages(); + } + + return pending; +} + void Endpoint::AddMessageSent(int bytes) { double time = Utility::GetTime(); diff --git a/lib/remote/endpoint.hpp b/lib/remote/endpoint.hpp index d641c2c6b8f..942ea42898e 100644 --- a/lib/remote/endpoint.hpp +++ b/lib/remote/endpoint.hpp @@ -39,6 +39,7 @@ class Endpoint final : public ObjectImpl static Endpoint::Ptr GetLocalEndpoint(); void SetCachedZone(const intrusive_ptr& zone); + uint_fast64_t GetPendingOutgoingMessages() const override; void AddMessageSent(int bytes); void AddMessageReceived(int bytes); diff --git a/lib/remote/endpoint.ti b/lib/remote/endpoint.ti index 78551ecf0dd..1a7c19dee02 100644 --- a/lib/remote/endpoint.ti +++ b/lib/remote/endpoint.ti @@ -39,6 +39,10 @@ class Endpoint : ConfigObject Timestamp last_message_sent; Timestamp last_message_received; + [no_user_modify, no_storage] uint_fast64_t pending_outgoing_messages { + get; + }; + [no_user_modify, no_storage] double messages_sent_per_second { get; };