From: Gunnar Beutner Date: Fri, 22 Jun 2012 10:22:36 +0000 (+0200) Subject: Bugfix: use service identity rather than just their names. X-Git-Tag: v0.0.1~372 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=69d3e71b03958ff69c0f90f979780b54bc13ae2d;p=icinga2 Bugfix: use service identity rather than just their names. --- diff --git a/components/checker/checkercomponent.cpp b/components/checker/checkercomponent.cpp index 99a10c7f0..9c4934304 100644 --- a/components/checker/checkercomponent.cpp +++ b/components/checker/checkercomponent.cpp @@ -76,7 +76,7 @@ void CheckerComponent::CheckTimerHandler(void) Application::Log(LogDebug, "checker", "Executing service check for '" + service.GetName() + "'"); - m_PendingServices.insert(service.GetName()); + m_PendingServices.insert(service.GetConfigObject()); CheckTask::Ptr task = CheckTask::CreateTask(service); task->Enqueue(); @@ -111,7 +111,7 @@ void CheckerComponent::ResultTimerHandler(void) /* if the service isn't in the set of pending services * it was removed and we need to ignore this check result. */ - if (m_PendingServices.find(service.GetName()) == m_PendingServices.end()) + if (m_PendingServices.find(service.GetConfigObject()) == m_PendingServices.end()) continue; CheckResult result = task->GetResult(); @@ -132,7 +132,7 @@ void CheckerComponent::ResultTimerHandler(void) failed++; service.SetNextCheck(now + service.GetCheckInterval()); - m_PendingServices.erase(service.GetName()); + m_PendingServices.erase(service.GetConfigObject()); m_Services.push(service); } diff --git a/components/checker/checkercomponent.h b/components/checker/checkercomponent.h index a567950b7..d8ed642da 100644 --- a/components/checker/checkercomponent.h +++ b/components/checker/checkercomponent.h @@ -51,7 +51,7 @@ private: VirtualEndpoint::Ptr m_CheckerEndpoint; ServiceQueue m_Services; - set m_PendingServices; + set m_PendingServices; Timer::Ptr m_CheckTimer; diff --git a/components/delegation/delegationcomponent.cpp b/components/delegation/delegationcomponent.cpp index 4697b456d..bc37909b8 100644 --- a/components/delegation/delegationcomponent.cpp +++ b/components/delegation/delegationcomponent.cpp @@ -235,6 +235,13 @@ void DelegationComponent::DelegationTimerHandler(void) assert(candidates.size() == 0 || !service.GetChecker().empty()); } + map::iterator hit; + for (hit = histogram.begin(); hit != histogram.end(); hit++) { + stringstream msgbuf; + msgbuf << "histogram: " << hit->first->GetIdentity() << " - " << hit->second; + Application::Log(LogInformation, "delegation", msgbuf.str()); + } + if (delegated > 0) { if (need_clear) { map::iterator hit; @@ -252,13 +259,6 @@ void DelegationComponent::DelegationTimerHandler(void) AssignService(endpoint, *sit); } - - map::iterator hit; - for (hit = histogram.begin(); hit != histogram.end(); hit++) { - stringstream msgbuf; - msgbuf << "histogram: " << hit->first->GetIdentity() << " - " << hit->second; - Application::Log(LogInformation, "delegation", msgbuf.str()); - } } stringstream msgbuf;