Skip to content

Commit 8d2c0da

Browse files
committed
Introduce Endpoint#seconds_{reading_messages,awaiting_semaphore,processing_messages} for the API
1 parent 41e425e commit 8d2c0da

File tree

5 files changed

+50
-1
lines changed

5 files changed

+50
-1
lines changed

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, true),
221+
new PerfdataValue("sum_seconds_awaiting_semaphore", secondsAwaitingSemaphore, true),
222+
new PerfdataValue("sum_seconds_processing_messages", secondsProcessingMessages, true)
214223
}));
215224

216225
checkable->ProcessCheckResult(cr, producer);

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, true));
158+
perfdata->Add(new PerfdataValue("sum_seconds_awaiting_semaphore", secondsAwaitingSemaphore, true));
159+
perfdata->Add(new PerfdataValue("sum_seconds_processing_messages", secondsProcessingMessages, true));
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
@@ -162,3 +162,18 @@ Dictionary::Ptr Endpoint::GetMessagesReceivedPerType() const
162162

163163
return new Dictionary(std::move(result));
164164
}
165+
166+
double Endpoint::GetSecondsReadingMessages() const
167+
{
168+
return m_InputReadTime;
169+
}
170+
171+
double Endpoint::GetSecondsAwaitingSemaphore() const
172+
{
173+
return m_InputSemaphoreTime;
174+
}
175+
176+
double Endpoint::GetSecondsProcessingMessages() const
177+
{
178+
return m_InputProcessTime;
179+
}

lib/remote/endpoint.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ class Endpoint final : public ObjectImpl<Endpoint>
6565

6666
Dictionary::Ptr GetMessagesReceivedPerType() const override;
6767

68+
double GetSecondsReadingMessages() const override;
69+
double GetSecondsAwaitingSemaphore() const override;
70+
double GetSecondsProcessingMessages() const override;
71+
6872
protected:
6973
void OnAllConfigLoaded() override;
7074

lib/remote/endpoint.ti

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ class Endpoint : ConfigObject
5858
[no_user_modify, no_storage] Dictionary::Ptr messages_received_per_type {
5959
get;
6060
};
61+
62+
[no_user_modify, no_storage] double seconds_reading_messages {
63+
get;
64+
};
65+
66+
[no_user_modify, no_storage] double seconds_awaiting_semaphore {
67+
get;
68+
};
69+
70+
[no_user_modify, no_storage] double seconds_processing_messages {
71+
get;
72+
};
6173
};
6274

6375
}

0 commit comments

Comments
 (0)