if (!triggeredBy.IsEmpty()) {
Downtime::Ptr triggerDowntime = GetDowntimeByID(triggeredBy);
-
+
if (triggerDowntime)
downtime->SetTriggeredByLegacyId(triggerDowntime->GetLegacyId());
}
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")
<< "Added downtime with ID '" << downtime->GetLegacyId()
<< "' between '" << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", startTime)