mirror of https://github.com/Icinga/icinga2.git
Icinga DB: make host problem change events update the state tables but not write state history
StateChangeHandler() is the function used when the actual hard/soft state changes and thus also writes state history. This is not desired in this case, instead, a runtime update should be generated, therefore call UpdateState() instead. refs #9063
This commit is contained in:
parent
855e342b63
commit
cf73c6136b
|
@ -119,7 +119,7 @@ void IcingaDB::ConfigStaticInitialize()
|
|||
});
|
||||
|
||||
Service::OnHostProblemChanged.connect([](const Service::Ptr& service, const CheckResult::Ptr&, const MessageOrigin::Ptr&) {
|
||||
IcingaDB::StateChangeHandler(service);
|
||||
IcingaDB::HostProblemChangedHandler(service);
|
||||
});
|
||||
|
||||
Notification::OnUsersRawChangedWithOldValue.connect([](const Notification::Ptr& notification, const Value& oldValues, const Value& newValues) {
|
||||
|
@ -2696,6 +2696,13 @@ void IcingaDB::NextCheckChangedHandler(const Checkable::Ptr& checkable)
|
|||
}
|
||||
}
|
||||
|
||||
void IcingaDB::HostProblemChangedHandler(const Service::Ptr& service) {
|
||||
for (auto& rw : ConfigType::GetObjectsByType<IcingaDB>()) {
|
||||
/* Host state changes affect is_handled and severity of services. */
|
||||
rw->UpdateState(service, StateUpdate::Full);
|
||||
}
|
||||
}
|
||||
|
||||
void IcingaDB::AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double changeTime, double expiry)
|
||||
{
|
||||
auto rws (ConfigType::GetObjectsByType<IcingaDB>());
|
||||
|
|
|
@ -152,6 +152,7 @@ private:
|
|||
static void FlappingChangeHandler(const Checkable::Ptr& checkable, double changeTime);
|
||||
static void NewCheckResultHandler(const Checkable::Ptr& checkable);
|
||||
static void NextCheckChangedHandler(const Checkable::Ptr& checkable);
|
||||
static void HostProblemChangedHandler(const Service::Ptr& service);
|
||||
static void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double changeTime, double expiry);
|
||||
static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, double changeTime);
|
||||
static void NotificationUsersChangedHandler(const Notification::Ptr& notification, const Array::Ptr& oldValues, const Array::Ptr& newValues);
|
||||
|
|
Loading…
Reference in New Issue