mirror of https://github.com/Icinga/icinga2.git
Trigger downtimes for NOT-OK states after OnDowntimeAdded()
The fix in #8389 must happen *after* adding the downtime which signals an insert into the IDO DB. Once the downtimes have been added to the database, the additional trigger_time and is_in_effect can be updated accordingly, *if* the current object is already in a NOT-OK state. fixes #9016
This commit is contained in:
parent
876bccd745
commit
e659784a66
|
@ -104,14 +104,6 @@ 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)
|
||||||
|
@ -119,6 +111,17 @@ String Checkable::AddDowntime(const String& author, const String& comment,
|
||||||
|
|
||||||
OnDowntimeAdded(this, downtime, origin);
|
OnDowntimeAdded(this, downtime, origin);
|
||||||
|
|
||||||
|
/* if this object is already in a NOT-OK state trigger
|
||||||
|
* this downtime now *after* it has been added (important
|
||||||
|
* for DB IDO, etc.)
|
||||||
|
*/
|
||||||
|
if (GetStateRaw() != ServiceOK) {
|
||||||
|
Log(LogNotice, "Checkable")
|
||||||
|
<< "Checkable '" << GetName() << "' already in a NOT-OK state."
|
||||||
|
<< " Triggering downtime now.";
|
||||||
|
TriggerDowntime(uid);
|
||||||
|
}
|
||||||
|
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue