mirror of https://github.com/Icinga/icinga2.git
Bugfixes.
This commit is contained in:
parent
146880c110
commit
ac7d8688a8
|
@ -36,9 +36,6 @@ void CheckerComponent::Start(void)
|
||||||
m_CheckerEndpoint->RegisterPublication("checker::CheckResult");
|
m_CheckerEndpoint->RegisterPublication("checker::CheckResult");
|
||||||
GetEndpointManager()->RegisterEndpoint(m_CheckerEndpoint);
|
GetEndpointManager()->RegisterEndpoint(m_CheckerEndpoint);
|
||||||
|
|
||||||
// TODO: get rid of this
|
|
||||||
ConfigObject::GetAllObjects()->OnObjectAdded.connect(bind(&CheckerComponent::NewServiceHandler, this, _1));
|
|
||||||
|
|
||||||
m_CheckTimer = make_shared<Timer>();
|
m_CheckTimer = make_shared<Timer>();
|
||||||
m_CheckTimer->SetInterval(10);
|
m_CheckTimer->SetInterval(10);
|
||||||
m_CheckTimer->OnTimerExpired.connect(bind(&CheckerComponent::CheckTimerHandler, this, _1));
|
m_CheckTimer->OnTimerExpired.connect(bind(&CheckerComponent::CheckTimerHandler, this, _1));
|
||||||
|
@ -63,14 +60,6 @@ void CheckerComponent::Stop(void)
|
||||||
mgr->UnregisterEndpoint(m_CheckerEndpoint);
|
mgr->UnregisterEndpoint(m_CheckerEndpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CheckerComponent::NewServiceHandler(const ObjectSetEventArgs<ConfigObject::Ptr>& ea)
|
|
||||||
{
|
|
||||||
if (ea.Target->GetType() == "service")
|
|
||||||
m_Services.push(ea.Target);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CheckerComponent::CheckTimerHandler(const TimerEventArgs& ea)
|
int CheckerComponent::CheckTimerHandler(const TimerEventArgs& ea)
|
||||||
{
|
{
|
||||||
time_t now;
|
time_t now;
|
||||||
|
@ -122,6 +111,9 @@ int CheckerComponent::AssignServiceRequestHandler(const NewRequestEventArgs& nre
|
||||||
|
|
||||||
Application::Log("Accepted service '" + service.GetName() + "'");
|
Application::Log("Accepted service '" + service.GetName() + "'");
|
||||||
|
|
||||||
|
/* force a service check */
|
||||||
|
m_CheckTimer->Reschedule(0);
|
||||||
|
|
||||||
ResponseMessage rm;
|
ResponseMessage rm;
|
||||||
rm.SetID(id);
|
rm.SetID(id);
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,6 @@ private:
|
||||||
Timer::Ptr m_CheckTimer;
|
Timer::Ptr m_CheckTimer;
|
||||||
VirtualEndpoint::Ptr m_CheckerEndpoint;
|
VirtualEndpoint::Ptr m_CheckerEndpoint;
|
||||||
|
|
||||||
int NewServiceHandler(const ObjectSetEventArgs<ConfigObject::Ptr>& ea);
|
|
||||||
|
|
||||||
int CheckTimerHandler(const TimerEventArgs& ea);
|
int CheckTimerHandler(const TimerEventArgs& ea);
|
||||||
|
|
||||||
int AssignServiceRequestHandler(const NewRequestEventArgs& nrea);
|
int AssignServiceRequestHandler(const NewRequestEventArgs& nrea);
|
||||||
|
|
|
@ -82,10 +82,12 @@ void DelegationComponent::AssignService(const ConfigObject::Ptr& service)
|
||||||
|
|
||||||
int DelegationComponent::AssignServiceResponseHandler(const ConfigObject::Ptr& service, const NewResponseEventArgs& nrea)
|
int DelegationComponent::AssignServiceResponseHandler(const ConfigObject::Ptr& service, const NewResponseEventArgs& nrea)
|
||||||
{
|
{
|
||||||
if (nrea.TimedOut)
|
if (nrea.TimedOut) {
|
||||||
Application::Log("Service delegation for service '" + service->GetName() + "' timed out.");
|
Application::Log("Service delegation for service '" + service->GetName() + "' timed out.");
|
||||||
else
|
} else {
|
||||||
|
service->SetTag("checker", nrea.Sender->GetIdentity());
|
||||||
Application::Log("Service delegation for service '" + service->GetName() + "'was successful.");
|
Application::Log("Service delegation for service '" + service->GetName() + "'was successful.");
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue