From f1a942681ff1643e9739ea76b6b91f46fa7979cf Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 15 Feb 2022 10:30:09 +0100 Subject: [PATCH] IcingaDB#Send*(): don't enqueue any history once stopped --- lib/icingadb/icingadb-objects.cpp | 34 ++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index 70efe0630..bb28a2781 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -1621,6 +1621,10 @@ unsigned short GetPreviousState(const Checkable::Ptr& checkable, const Service:: void IcingaDB::SendStateChange(const ConfigObject::Ptr& object, const CheckResult::Ptr& cr, StateType type) { + if (!GetActive()) { + return; + } + Checkable::Ptr checkable = dynamic_pointer_cast(object); if (!checkable) return; @@ -1710,6 +1714,10 @@ void IcingaDB::SendSentNotification( NotificationType type, const CheckResult::Ptr& cr, const String& author, const String& text, double sendTime ) { + if (!GetActive()) { + return; + } + Host::Ptr host; Service::Ptr service; tie(host, service) = GetHostService(checkable); @@ -1776,6 +1784,10 @@ void IcingaDB::SendSentNotification( void IcingaDB::SendStartedDowntime(const Downtime::Ptr& downtime) { + if (!GetActive()) { + return; + } + SendConfigUpdate(downtime, true); auto checkable (downtime->GetCheckable()); @@ -1859,6 +1871,10 @@ void IcingaDB::SendStartedDowntime(const Downtime::Ptr& downtime) void IcingaDB::SendRemovedDowntime(const Downtime::Ptr& downtime) { + if (!GetActive()) { + return; + } + auto checkable (downtime->GetCheckable()); auto triggeredBy (Downtime::GetByName(downtime->GetTriggeredBy())); @@ -1946,7 +1962,7 @@ void IcingaDB::SendRemovedDowntime(const Downtime::Ptr& downtime) void IcingaDB::SendAddedComment(const Comment::Ptr& comment) { - if (comment->GetEntryType() != CommentUser) + if (comment->GetEntryType() != CommentUser || !GetActive()) return; auto checkable (comment->GetCheckable()); @@ -2002,6 +2018,10 @@ void IcingaDB::SendAddedComment(const Comment::Ptr& comment) void IcingaDB::SendRemovedComment(const Comment::Ptr& comment) { + if (!GetActive()) { + return; + } + auto checkable (comment->GetCheckable()); Host::Ptr host; @@ -2067,6 +2087,10 @@ void IcingaDB::SendRemovedComment(const Comment::Ptr& comment) void IcingaDB::SendFlappingChange(const Checkable::Ptr& checkable, double changeTime, double flappingLastChange) { + if (!GetActive()) { + return; + } + Host::Ptr host; Service::Ptr service; tie(host, service) = GetHostService(checkable); @@ -2155,6 +2179,10 @@ void IcingaDB::SendNextUpdate(const Checkable::Ptr& checkable) void IcingaDB::SendAcknowledgementSet(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double changeTime, double expiry) { + if (!GetActive()) { + return; + } + Host::Ptr host; Service::Ptr service; tie(host, service) = GetHostService(checkable); @@ -2209,6 +2237,10 @@ void IcingaDB::SendAcknowledgementSet(const Checkable::Ptr& checkable, const Str void IcingaDB::SendAcknowledgementCleared(const Checkable::Ptr& checkable, const String& removedBy, double changeTime, double ackLastChange) { + if (!GetActive()) { + return; + } + Host::Ptr host; Service::Ptr service; tie(host, service) = GetHostService(checkable);