DB IDO: Only update 'next_check' column when manually scheduling a check

Otherwise the changes from #7287 already take care of setting
the proper next check time from inside ProcessCheckResult().

There is no need to use the generic OnNextCheckChanged signal
but instead we're using a new one, locally just for DB IDO.

fixes #11019
This commit is contained in:
Michael Friedrich 2016-01-22 18:42:15 +01:00 committed by Gunnar Beutner
parent 9ca7245c18
commit 9dc37c58ea
6 changed files with 26 additions and 3 deletions

View File

@ -51,7 +51,7 @@ void DbEvents::StaticInitialize(void)
Checkable::OnAcknowledgementSet.connect(boost::bind(&DbEvents::AddAcknowledgement, _1, _4));
Checkable::OnAcknowledgementCleared.connect(boost::bind(&DbEvents::RemoveAcknowledgement, _1));
Checkable::OnNextCheckChanged.connect(boost::bind(&DbEvents::NextCheckChangedHandler, _1));
Checkable::OnNextCheckUpdated.connect(boost::bind(&DbEvents::NextCheckUpdatedHandler, _1));
Checkable::OnFlappingChanged.connect(boost::bind(&DbEvents::FlappingChangedHandler, _1));
Checkable::OnNotificationSentToAllUsers.connect(boost::bind(&DbEvents::LastNotificationChangedHandler, _1, _2));
@ -89,7 +89,7 @@ void DbEvents::StaticInitialize(void)
}
/* check events */
void DbEvents::NextCheckChangedHandler(const Checkable::Ptr& checkable)
void DbEvents::NextCheckUpdatedHandler(const Checkable::Ptr& checkable)
{
Host::Ptr host;
Service::Ptr service;

View File

@ -69,7 +69,7 @@ public:
static void AddLogHistory(const Checkable::Ptr& checkable, String buffer, LogEntryType type);
/* Status */
static void NextCheckChangedHandler(const Checkable::Ptr& checkable);
static void NextCheckUpdatedHandler(const Checkable::Ptr& checkable);
static void FlappingChangedHandler(const Checkable::Ptr& checkable);
static void LastNotificationChangedHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable);

View File

@ -128,6 +128,9 @@ Dictionary::Ptr ApiActions::RescheduleCheck(const ConfigObject::Ptr& object,
checkable->SetNextCheck(nextCheck);
/* trigger update event for DB IDO */
Checkable::OnNextCheckUpdated(checkable);
return ApiActions::CreateResult(200, "Successfully rescheduled check for object '" + checkable->GetName() + "'.");
}

View File

@ -39,6 +39,7 @@ boost::signals2::signal<void (const Checkable::Ptr&, const CheckResult::Ptr&, co
boost::signals2::signal<void (const Checkable::Ptr&, const CheckResult::Ptr&, StateType, const MessageOrigin::Ptr&)> Checkable::OnStateChange;
boost::signals2::signal<void (const Checkable::Ptr&, const CheckResult::Ptr&, std::set<Checkable::Ptr>, const MessageOrigin::Ptr&)> Checkable::OnReachabilityChanged;
boost::signals2::signal<void (const Checkable::Ptr&, NotificationType, const CheckResult::Ptr&, const String&, const String&)> Checkable::OnNotificationsRequested;
boost::signals2::signal<void (const Checkable::Ptr&)> Checkable::OnNextCheckUpdated;
CheckCommand::Ptr Checkable::GetCheckCommand(void) const
{

View File

@ -126,6 +126,7 @@ public:
static boost::signals2::signal<void (const Checkable::Ptr&, const String&, const String&, AcknowledgementType,
bool, double, const MessageOrigin::Ptr&)> OnAcknowledgementSet;
static boost::signals2::signal<void (const Checkable::Ptr&, const MessageOrigin::Ptr&)> OnAcknowledgementCleared;
static boost::signals2::signal<void (const Checkable::Ptr&)> OnNextCheckUpdated;
static boost::signals2::signal<void (const Checkable::Ptr&)> OnEventCommandExecuted;
/* Downtimes */

View File

@ -382,6 +382,9 @@ void ExternalCommandProcessor::ScheduleHostCheck(double, const std::vector<Strin
planned_check = Utility::GetTime();
host->SetNextCheck(planned_check);
/* trigger update event for DB IDO */
Checkable::OnNextCheckUpdated(host);
}
void ExternalCommandProcessor::ScheduleForcedHostCheck(double, const std::vector<String>& arguments)
@ -396,6 +399,9 @@ void ExternalCommandProcessor::ScheduleForcedHostCheck(double, const std::vector
host->SetForceNextCheck(true);
host->SetNextCheck(Convert::ToDouble(arguments[1]));
/* trigger update event for DB IDO */
Checkable::OnNextCheckUpdated(host);
}
void ExternalCommandProcessor::ScheduleSvcCheck(double, const std::vector<String>& arguments)
@ -421,6 +427,9 @@ void ExternalCommandProcessor::ScheduleSvcCheck(double, const std::vector<String
planned_check = Utility::GetTime();
service->SetNextCheck(planned_check);
/* trigger update event for DB IDO */
Checkable::OnNextCheckUpdated(service);
}
void ExternalCommandProcessor::ScheduleForcedSvcCheck(double, const std::vector<String>& arguments)
@ -435,6 +444,9 @@ void ExternalCommandProcessor::ScheduleForcedSvcCheck(double, const std::vector<
service->SetForceNextCheck(true);
service->SetNextCheck(Convert::ToDouble(arguments[2]));
/* trigger update event for DB IDO */
Checkable::OnNextCheckUpdated(service);
}
void ExternalCommandProcessor::EnableHostCheck(double, const std::vector<String>& arguments)
@ -516,6 +528,9 @@ void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double, const std::ve
service->SetNextCheck(planned_check);
service->SetForceNextCheck(true);
/* trigger update event for DB IDO */
Checkable::OnNextCheckUpdated(service);
}
}
@ -543,6 +558,9 @@ void ExternalCommandProcessor::ScheduleHostSvcChecks(double, const std::vector<S
<< "Rescheduling next check for service '" << service->GetName() << "'";
service->SetNextCheck(planned_check);
/* trigger update event for DB IDO */
Checkable::OnNextCheckUpdated(service);
}
}