Skip to content

Commit 531991f

Browse files
committed
Introduce Endpoint#seconds_{reading_messages,awaiting_semaphore,processing_messages} for the API
1 parent de3bd0d commit 531991f

5 files changed

Lines changed: 50 additions & 1 deletion

File tree

lib/methods/clusterzonechecktask.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
137137
double messagesReceivedPerSecond = 0;
138138
double bytesSentPerSecond = 0;
139139
double bytesReceivedPerSecond = 0;
140+
double secondsReadingMessages = 0;
141+
double secondsAwaitingSemaphore = 0;
142+
double secondsProcessingMessages = 0;
140143

141144
{
142145
auto endpoints (zone->GetEndpoints());
@@ -160,6 +163,9 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
160163
messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond();
161164
bytesSentPerSecond += endpoint->GetBytesSentPerSecond();
162165
bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond();
166+
secondsReadingMessages += endpoint->GetSecondsReadingMessages();
167+
secondsAwaitingSemaphore += endpoint->GetSecondsAwaitingSemaphore();
168+
secondsProcessingMessages += endpoint->GetSecondsProcessingMessages();
163169
}
164170

165171
if (!connected && endpoints.size() == 1u && *endpoints.begin() == Endpoint::GetLocalEndpoint()) {
@@ -210,7 +216,10 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
210216
new PerfdataValue("sum_messages_sent_per_second", messagesSentPerSecond),
211217
new PerfdataValue("sum_messages_received_per_second", messagesReceivedPerSecond),
212218
new PerfdataValue("sum_bytes_sent_per_second", bytesSentPerSecond),
213-
new PerfdataValue("sum_bytes_received_per_second", bytesReceivedPerSecond)
219+
new PerfdataValue("sum_bytes_received_per_second", bytesReceivedPerSecond),
220+
new PerfdataValue("sum_seconds_reading_messages", secondsReadingMessages),
221+
new PerfdataValue("sum_seconds_awaiting_semaphore", secondsAwaitingSemaphore),
222+
new PerfdataValue("sum_seconds_processing_messages", secondsProcessingMessages)
214223
}));
215224

216225
checkable->ProcessCheckResult(cr);

lib/methods/icingachecktask.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
127127
double messagesReceivedPerSecond = 0;
128128
double bytesSentPerSecond = 0;
129129
double bytesReceivedPerSecond = 0;
130+
double secondsReadingMessages = 0;
131+
double secondsAwaitingSemaphore = 0;
132+
double secondsProcessingMessages = 0;
130133

131134
for (const Endpoint::Ptr& endpoint : endpoints)
132135
{
@@ -140,6 +143,9 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
140143
messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond();
141144
bytesSentPerSecond += endpoint->GetBytesSentPerSecond();
142145
bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond();
146+
secondsReadingMessages += endpoint->GetSecondsReadingMessages();
147+
secondsAwaitingSemaphore += endpoint->GetSecondsAwaitingSemaphore();
148+
secondsProcessingMessages += endpoint->GetSecondsProcessingMessages();
143149
}
144150

145151
perfdata->Add(new PerfdataValue("last_messages_sent", lastMessageSent));
@@ -148,6 +154,9 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
148154
perfdata->Add(new PerfdataValue("sum_messages_received_per_second", messagesReceivedPerSecond));
149155
perfdata->Add(new PerfdataValue("sum_bytes_sent_per_second", bytesSentPerSecond));
150156
perfdata->Add(new PerfdataValue("sum_bytes_received_per_second", bytesReceivedPerSecond));
157+
perfdata->Add(new PerfdataValue("sum_seconds_reading_messages", secondsReadingMessages));
158+
perfdata->Add(new PerfdataValue("sum_seconds_awaiting_semaphore", secondsAwaitingSemaphore));
159+
perfdata->Add(new PerfdataValue("sum_seconds_processing_messages", secondsProcessingMessages));
151160

152161
cr->SetPerformanceData(perfdata);
153162
ServiceState state = ServiceOK;

lib/remote/endpoint.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,18 @@ double Endpoint::GetBytesReceivedPerSecond() const
136136
{
137137
return m_BytesReceived.CalculateRate(Utility::GetTime(), 60);
138138
}
139+
140+
double Endpoint::GetSecondsReadingMessages() const
141+
{
142+
return m_InputReadTime;
143+
}
144+
145+
double Endpoint::GetSecondsAwaitingSemaphore() const
146+
{
147+
return m_InputSemaphoreTime;
148+
}
149+
150+
double Endpoint::GetSecondsProcessingMessages() const
151+
{
152+
return m_InputProcessTime;
153+
}

lib/remote/endpoint.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ class Endpoint final : public ObjectImpl<Endpoint>
5757
double GetBytesSentPerSecond() const override;
5858
double GetBytesReceivedPerSecond() const override;
5959

60+
double GetSecondsReadingMessages() const override;
61+
double GetSecondsAwaitingSemaphore() const override;
62+
double GetSecondsProcessingMessages() const override;
63+
6064
protected:
6165
void OnAllConfigLoaded() override;
6266

lib/remote/endpoint.ti

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ class Endpoint : ConfigObject
5454
[no_user_modify, no_storage] double bytes_received_per_second {
5555
get;
5656
};
57+
58+
[no_user_modify, no_storage] double seconds_reading_messages {
59+
get;
60+
};
61+
62+
[no_user_modify, no_storage] double seconds_awaiting_semaphore {
63+
get;
64+
};
65+
66+
[no_user_modify, no_storage] double seconds_processing_messages {
67+
get;
68+
};
5769
};
5870

5971
}

0 commit comments

Comments
 (0)