From 4a7a8cb6f8560bb21354cd9beab58f829e354aa1 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 23 Oct 2019 10:54:56 +0200 Subject: [PATCH] RedisWriter: add icinga:history:stream:*#endpoint_id --- lib/redis/rediswriter-objects.cpp | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/lib/redis/rediswriter-objects.cpp b/lib/redis/rediswriter-objects.cpp index d6396b9e1..86d05de30 100644 --- a/lib/redis/rediswriter-objects.cpp +++ b/lib/redis/rediswriter-objects.cpp @@ -1205,6 +1205,13 @@ void RedisWriter::SendStatusUpdate(const ConfigObject::Ptr& object, const CheckR xAdd.emplace_back(GetObjectIdentifier(checkable)); } + auto endpoint (Endpoint::GetLocalEndpoint()); + + if (endpoint) { + xAdd.emplace_back("endpoint_id"); + xAdd.emplace_back(GetObjectIdentifier(endpoint)); + } + m_Rcon->FireAndForgetQuery(std::move(xAdd)); } @@ -1246,6 +1253,13 @@ void RedisWriter::SendSentNotification( xAdd.emplace_back(GetObjectIdentifier(checkable)); } + auto endpoint (Endpoint::GetLocalEndpoint()); + + if (endpoint) { + xAdd.emplace_back("endpoint_id"); + xAdd.emplace_back(GetObjectIdentifier(endpoint)); + } + m_Rcon->FireAndForgetQuery(std::move(xAdd)); } @@ -1306,6 +1320,13 @@ void RedisWriter::SendAddedDowntime(const Downtime::Ptr& downtime) xAdd.emplace_back(Convert::ToString(TimestampToMilliseconds(downtime->GetTriggerTime() + downtime->GetDuration()))); } + auto endpoint (Endpoint::GetLocalEndpoint()); + + if (endpoint) { + xAdd.emplace_back("endpoint_id"); + xAdd.emplace_back(GetObjectIdentifier(endpoint)); + } + m_Rcon->FireAndForgetQuery(std::move(xAdd)); } @@ -1368,6 +1389,13 @@ void RedisWriter::SendStartedDowntime(const Downtime::Ptr& downtime) xAdd.emplace_back(Convert::ToString(TimestampToMilliseconds(downtime->GetTriggerTime() + downtime->GetDuration()))); } + auto endpoint (Endpoint::GetLocalEndpoint()); + + if (endpoint) { + xAdd.emplace_back("endpoint_id"); + xAdd.emplace_back(GetObjectIdentifier(endpoint)); + } + m_Rcon->FireAndForgetQuery(std::move(xAdd)); } @@ -1429,6 +1457,13 @@ void RedisWriter::SendRemovedDowntime(const Downtime::Ptr& downtime) xAdd.emplace_back(Convert::ToString(TimestampToMilliseconds(downtime->GetTriggerTime() + downtime->GetDuration()))); } + auto endpoint (Endpoint::GetLocalEndpoint()); + + if (endpoint) { + xAdd.emplace_back("endpoint_id"); + xAdd.emplace_back(GetObjectIdentifier(endpoint)); + } + m_Rcon->FireAndForgetQuery(std::move(xAdd)); } @@ -1466,6 +1501,13 @@ void RedisWriter::SendAddedComment(const Comment::Ptr& comment) xAdd.emplace_back(GetObjectIdentifier(checkable)); } + auto endpoint (Endpoint::GetLocalEndpoint()); + + if (endpoint) { + xAdd.emplace_back("endpoint_id"); + xAdd.emplace_back(GetObjectIdentifier(endpoint)); + } + m_Rcon->FireAndForgetQuery(std::move(xAdd)); } @@ -1504,6 +1546,13 @@ void RedisWriter::SendRemovedComment(const Comment::Ptr& comment) xAdd.emplace_back(GetObjectIdentifier(checkable)); } + auto endpoint (Endpoint::GetLocalEndpoint()); + + if (endpoint) { + xAdd.emplace_back("endpoint_id"); + xAdd.emplace_back(GetObjectIdentifier(endpoint)); + } + m_Rcon->FireAndForgetQuery(std::move(xAdd)); } @@ -1539,6 +1588,13 @@ void RedisWriter::SendFlappingChanged(const Checkable::Ptr& checkable, const Val xAdd.emplace_back(GetObjectIdentifier(checkable)); } + auto endpoint (Endpoint::GetLocalEndpoint()); + + if (endpoint) { + xAdd.emplace_back("endpoint_id"); + xAdd.emplace_back(GetObjectIdentifier(endpoint)); + } + m_Rcon->FireAndForgetQuery(std::move(xAdd)); }