mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 22:24:44 +02:00
Introduce Endpoint#seconds_{reading_messages,awaiting_semaphore,processing_messages} for the API
This commit is contained in:
parent
2b1e1a5a08
commit
cf9ca50d19
@ -137,6 +137,9 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
|
|||||||
double messagesReceivedPerSecond = 0;
|
double messagesReceivedPerSecond = 0;
|
||||||
double bytesSentPerSecond = 0;
|
double bytesSentPerSecond = 0;
|
||||||
double bytesReceivedPerSecond = 0;
|
double bytesReceivedPerSecond = 0;
|
||||||
|
double secondsReadingMessages = 0;
|
||||||
|
double secondsAwaitingSemaphore = 0;
|
||||||
|
double secondsProcessingMessages = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
auto endpoints (zone->GetEndpoints());
|
auto endpoints (zone->GetEndpoints());
|
||||||
@ -160,6 +163,9 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
|
|||||||
messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond();
|
messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond();
|
||||||
bytesSentPerSecond += endpoint->GetBytesSentPerSecond();
|
bytesSentPerSecond += endpoint->GetBytesSentPerSecond();
|
||||||
bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond();
|
bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond();
|
||||||
|
secondsReadingMessages += endpoint->GetSecondsReadingMessages();
|
||||||
|
secondsAwaitingSemaphore += endpoint->GetSecondsAwaitingSemaphore();
|
||||||
|
secondsProcessingMessages += endpoint->GetSecondsProcessingMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!connected && endpoints.size() == 1u && *endpoints.begin() == Endpoint::GetLocalEndpoint()) {
|
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_sent_per_second", messagesSentPerSecond),
|
||||||
new PerfdataValue("sum_messages_received_per_second", messagesReceivedPerSecond),
|
new PerfdataValue("sum_messages_received_per_second", messagesReceivedPerSecond),
|
||||||
new PerfdataValue("sum_bytes_sent_per_second", bytesSentPerSecond),
|
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, true),
|
||||||
|
new PerfdataValue("sum_seconds_awaiting_semaphore", secondsAwaitingSemaphore, true),
|
||||||
|
new PerfdataValue("sum_seconds_processing_messages", secondsProcessingMessages, true)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
checkable->ProcessCheckResult(cr);
|
checkable->ProcessCheckResult(cr);
|
||||||
|
@ -127,6 +127,9 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||||||
double messagesReceivedPerSecond = 0;
|
double messagesReceivedPerSecond = 0;
|
||||||
double bytesSentPerSecond = 0;
|
double bytesSentPerSecond = 0;
|
||||||
double bytesReceivedPerSecond = 0;
|
double bytesReceivedPerSecond = 0;
|
||||||
|
double secondsReadingMessages = 0;
|
||||||
|
double secondsAwaitingSemaphore = 0;
|
||||||
|
double secondsProcessingMessages = 0;
|
||||||
|
|
||||||
for (const Endpoint::Ptr& endpoint : endpoints)
|
for (const Endpoint::Ptr& endpoint : endpoints)
|
||||||
{
|
{
|
||||||
@ -140,6 +143,9 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||||||
messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond();
|
messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond();
|
||||||
bytesSentPerSecond += endpoint->GetBytesSentPerSecond();
|
bytesSentPerSecond += endpoint->GetBytesSentPerSecond();
|
||||||
bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond();
|
bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond();
|
||||||
|
secondsReadingMessages += endpoint->GetSecondsReadingMessages();
|
||||||
|
secondsAwaitingSemaphore += endpoint->GetSecondsAwaitingSemaphore();
|
||||||
|
secondsProcessingMessages += endpoint->GetSecondsProcessingMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
perfdata->Add(new PerfdataValue("last_messages_sent", lastMessageSent));
|
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_messages_received_per_second", messagesReceivedPerSecond));
|
||||||
perfdata->Add(new PerfdataValue("sum_bytes_sent_per_second", bytesSentPerSecond));
|
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_bytes_received_per_second", bytesReceivedPerSecond));
|
||||||
|
perfdata->Add(new PerfdataValue("sum_seconds_reading_messages", secondsReadingMessages, true));
|
||||||
|
perfdata->Add(new PerfdataValue("sum_seconds_awaiting_semaphore", secondsAwaitingSemaphore, true));
|
||||||
|
perfdata->Add(new PerfdataValue("sum_seconds_processing_messages", secondsProcessingMessages, true));
|
||||||
|
|
||||||
cr->SetPerformanceData(perfdata);
|
cr->SetPerformanceData(perfdata);
|
||||||
ServiceState state = ServiceOK;
|
ServiceState state = ServiceOK;
|
||||||
|
@ -136,3 +136,18 @@ double Endpoint::GetBytesReceivedPerSecond() const
|
|||||||
{
|
{
|
||||||
return m_BytesReceived.CalculateRate(Utility::GetTime(), 60);
|
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;
|
||||||
|
}
|
||||||
|
@ -57,6 +57,10 @@ public:
|
|||||||
double GetBytesSentPerSecond() const override;
|
double GetBytesSentPerSecond() const override;
|
||||||
double GetBytesReceivedPerSecond() const override;
|
double GetBytesReceivedPerSecond() const override;
|
||||||
|
|
||||||
|
double GetSecondsReadingMessages() const override;
|
||||||
|
double GetSecondsAwaitingSemaphore() const override;
|
||||||
|
double GetSecondsProcessingMessages() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnAllConfigLoaded() override;
|
void OnAllConfigLoaded() override;
|
||||||
|
|
||||||
|
@ -54,6 +54,18 @@ class Endpoint : ConfigObject
|
|||||||
[no_user_modify, no_storage] double bytes_received_per_second {
|
[no_user_modify, no_storage] double bytes_received_per_second {
|
||||||
get;
|
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;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user