mirror of https://github.com/Icinga/icinga2.git
Moved calculation of next check timestamp into the cibsync component.
This commit is contained in:
parent
62bd14b9f2
commit
24494a78bc
|
@ -71,21 +71,6 @@ void ServiceStatusMessage::SetCurrentCheckAttempt(long attempt)
|
|||
Set("current_attempt", attempt);
|
||||
}
|
||||
|
||||
bool ServiceStatusMessage::GetNextCheck(time_t *ts) const
|
||||
{
|
||||
long value;
|
||||
if (Get("next_check", &value)) {
|
||||
*ts = value;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ServiceStatusMessage::SetNextCheck(time_t ts)
|
||||
{
|
||||
Set("next_check", static_cast<long>(ts));
|
||||
}
|
||||
|
||||
bool ServiceStatusMessage::GetCheckResult(CheckResult *cr) const
|
||||
{
|
||||
Dictionary::Ptr obj;
|
||||
|
|
|
@ -41,9 +41,6 @@ public:
|
|||
bool GetCurrentCheckAttempt(long *attempt) const;
|
||||
void SetCurrentCheckAttempt(long attempt);
|
||||
|
||||
bool GetNextCheck(time_t *ts) const;
|
||||
void SetNextCheck(time_t ts);
|
||||
|
||||
bool GetCheckResult(CheckResult *cr) const;
|
||||
void SetCheckResult(CheckResult cr);
|
||||
};
|
||||
|
|
|
@ -104,9 +104,6 @@ void CheckerComponent::CheckCompletedHandler(Service service, const ScriptTask::
|
|||
{
|
||||
service.RemoveTag("current_task");
|
||||
|
||||
/* figure out when the next check is for this service */
|
||||
service.UpdateNextCheck();
|
||||
|
||||
try {
|
||||
Variant vresult = task->GetResult();
|
||||
|
||||
|
@ -124,7 +121,6 @@ void CheckerComponent::CheckCompletedHandler(Service service, const ScriptTask::
|
|||
params.SetState(service.GetState());
|
||||
params.SetStateType(service.GetStateType());
|
||||
params.SetCurrentCheckAttempt(service.GetCurrentCheckAttempt());
|
||||
params.SetNextCheck(service.GetNextCheck());
|
||||
params.SetCheckResult(result);
|
||||
|
||||
rm.SetParams(params);
|
||||
|
@ -138,6 +134,11 @@ void CheckerComponent::CheckCompletedHandler(Service service, const ScriptTask::
|
|||
Logger::Write(LogWarning, "checker", msgbuf.str());
|
||||
}
|
||||
|
||||
/* figure out when the next check is for this service; the local
|
||||
* cibsync component should've already done this as part of processing
|
||||
* the CheckResult message, but lets do it again to be sure */
|
||||
service.UpdateNextCheck();
|
||||
|
||||
/* remove the service from the list of pending services; if it's not in the
|
||||
* list this was a manual (i.e. forced) check and we must not re-add the
|
||||
* service to the services list because it's already there. */
|
||||
|
|
|
@ -91,10 +91,6 @@ void CIBSyncComponent::ServiceStatusRequestHandler(const Endpoint::Ptr& sender,
|
|||
|
||||
Service service = Service::GetByName(svcname);
|
||||
|
||||
time_t nextCheck;
|
||||
if (params.GetNextCheck(&nextCheck))
|
||||
service.SetNextCheck(nextCheck);
|
||||
|
||||
ServiceState state;
|
||||
ServiceStateType stateType;
|
||||
if (params.GetState(&state) && params.GetStateType(&stateType)) {
|
||||
|
@ -123,6 +119,8 @@ void CIBSyncComponent::ServiceStatusRequestHandler(const Endpoint::Ptr& sender,
|
|||
if (params.GetCheckResult(&cr))
|
||||
service.SetLastCheckResult(cr);
|
||||
|
||||
service.UpdateNextCheck();
|
||||
|
||||
time_t now;
|
||||
time(&now);
|
||||
CIB::UpdateTaskStatistics(now, 1);
|
||||
|
|
Loading…
Reference in New Issue