Trigger added downtimes immediately if checkable is Not-OK

fixes #8389
This commit is contained in:
Michael Friedrich 2015-02-08 00:08:12 +01:00
parent 21f86b9061
commit 34b5a4d9b4
1 changed files with 9 additions and 1 deletions

View File

@ -73,7 +73,7 @@ String Checkable::AddDowntime(const String& author, const String& comment,
if (!triggeredBy.IsEmpty()) { if (!triggeredBy.IsEmpty()) {
Downtime::Ptr triggerDowntime = GetDowntimeByID(triggeredBy); Downtime::Ptr triggerDowntime = GetDowntimeByID(triggeredBy);
if (triggerDowntime) if (triggerDowntime)
downtime->SetTriggeredByLegacyId(triggerDowntime->GetLegacyId()); downtime->SetTriggeredByLegacyId(triggerDowntime->GetLegacyId());
} }
@ -104,6 +104,14 @@ String Checkable::AddDowntime(const String& author, const String& comment,
l_DowntimesCache[uid] = this; l_DowntimesCache[uid] = this;
} }
/* if this object is already in a NOT-OK state trigger this downtime now */
if (GetStateRaw() != ServiceOK) {
Log(LogNotice, "Checkable")
<< "Checkable '" << GetName() << "' already in a NOT-OK state."
<< " Triggering downtime now.";
TriggerDowntime(uid);
}
Log(LogNotice, "Checkable") Log(LogNotice, "Checkable")
<< "Added downtime with ID '" << downtime->GetLegacyId() << "Added downtime with ID '" << downtime->GetLegacyId()
<< "' between '" << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", startTime) << "' between '" << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", startTime)