IcingaDB#Send*(): don't enqueue any history once stopped

This commit is contained in:
Alexander A. Klimov 2022-02-15 10:30:09 +01:00
parent cac22fe38b
commit 3a8efcb4ea

View File

@ -1625,6 +1625,10 @@ unsigned short GetPreviousState(const Checkable::Ptr& checkable, const Service::
void IcingaDB::SendStateChange(const ConfigObject::Ptr& object, const CheckResult::Ptr& cr, StateType type) void IcingaDB::SendStateChange(const ConfigObject::Ptr& object, const CheckResult::Ptr& cr, StateType type)
{ {
if (!GetActive()) {
return;
}
Checkable::Ptr checkable = dynamic_pointer_cast<Checkable>(object); Checkable::Ptr checkable = dynamic_pointer_cast<Checkable>(object);
if (!checkable) if (!checkable)
return; return;
@ -1714,6 +1718,10 @@ void IcingaDB::SendSentNotification(
NotificationType type, const CheckResult::Ptr& cr, const String& author, const String& text, double sendTime NotificationType type, const CheckResult::Ptr& cr, const String& author, const String& text, double sendTime
) )
{ {
if (!GetActive()) {
return;
}
Host::Ptr host; Host::Ptr host;
Service::Ptr service; Service::Ptr service;
tie(host, service) = GetHostService(checkable); tie(host, service) = GetHostService(checkable);
@ -1780,6 +1788,10 @@ void IcingaDB::SendSentNotification(
void IcingaDB::SendStartedDowntime(const Downtime::Ptr& downtime) void IcingaDB::SendStartedDowntime(const Downtime::Ptr& downtime)
{ {
if (!GetActive()) {
return;
}
SendConfigUpdate(downtime, true); SendConfigUpdate(downtime, true);
auto checkable (downtime->GetCheckable()); auto checkable (downtime->GetCheckable());
@ -1863,6 +1875,10 @@ void IcingaDB::SendStartedDowntime(const Downtime::Ptr& downtime)
void IcingaDB::SendRemovedDowntime(const Downtime::Ptr& downtime) void IcingaDB::SendRemovedDowntime(const Downtime::Ptr& downtime)
{ {
if (!GetActive()) {
return;
}
auto checkable (downtime->GetCheckable()); auto checkable (downtime->GetCheckable());
auto triggeredBy (Downtime::GetByName(downtime->GetTriggeredBy())); auto triggeredBy (Downtime::GetByName(downtime->GetTriggeredBy()));
@ -1950,7 +1966,7 @@ void IcingaDB::SendRemovedDowntime(const Downtime::Ptr& downtime)
void IcingaDB::SendAddedComment(const Comment::Ptr& comment) void IcingaDB::SendAddedComment(const Comment::Ptr& comment)
{ {
if (comment->GetEntryType() != CommentUser) if (comment->GetEntryType() != CommentUser || !GetActive())
return; return;
auto checkable (comment->GetCheckable()); auto checkable (comment->GetCheckable());
@ -2006,6 +2022,10 @@ void IcingaDB::SendAddedComment(const Comment::Ptr& comment)
void IcingaDB::SendRemovedComment(const Comment::Ptr& comment) void IcingaDB::SendRemovedComment(const Comment::Ptr& comment)
{ {
if (!GetActive()) {
return;
}
auto checkable (comment->GetCheckable()); auto checkable (comment->GetCheckable());
Host::Ptr host; Host::Ptr host;
@ -2072,6 +2092,10 @@ void IcingaDB::SendRemovedComment(const Comment::Ptr& comment)
void IcingaDB::SendFlappingChange(const Checkable::Ptr& checkable, double changeTime, double flappingLastChange) void IcingaDB::SendFlappingChange(const Checkable::Ptr& checkable, double changeTime, double flappingLastChange)
{ {
if (!GetActive()) {
return;
}
Host::Ptr host; Host::Ptr host;
Service::Ptr service; Service::Ptr service;
tie(host, service) = GetHostService(checkable); tie(host, service) = GetHostService(checkable);
@ -2160,6 +2184,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) 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; Host::Ptr host;
Service::Ptr service; Service::Ptr service;
tie(host, service) = GetHostService(checkable); tie(host, service) = GetHostService(checkable);
@ -2214,6 +2242,10 @@ void IcingaDB::SendAcknowledgementSet(const Checkable::Ptr& checkable, const Str
void IcingaDB::SendAcknowledgementCleared(const Checkable::Ptr& checkable, const String& removedBy, double changeTime, double ackLastChange) void IcingaDB::SendAcknowledgementCleared(const Checkable::Ptr& checkable, const String& removedBy, double changeTime, double ackLastChange)
{ {
if (!GetActive()) {
return;
}
Host::Ptr host; Host::Ptr host;
Service::Ptr service; Service::Ptr service;
tie(host, service) = GetHostService(checkable); tie(host, service) = GetHostService(checkable);