]> granicus.if.org Git - icinga2/commitdiff
Bugfix: use service identity rather than just their names.
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 22 Jun 2012 10:22:36 +0000 (12:22 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 22 Jun 2012 10:22:36 +0000 (12:22 +0200)
components/checker/checkercomponent.cpp
components/checker/checkercomponent.h
components/delegation/delegationcomponent.cpp

index 99a10c7f0c1910f3e36b0d6953bc354f793e472b..9c493430431ed0efeb5edbde80f9a5c4ace2c784 100644 (file)
@@ -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);
        }
 
index a567950b7cdb553637c061eafb613d5b55e7d35e..d8ed642daf307f1e7e04d3fda94824f34ba43d2e 100644 (file)
@@ -51,7 +51,7 @@ private:
        VirtualEndpoint::Ptr m_CheckerEndpoint;
 
        ServiceQueue m_Services;
-       set<string> m_PendingServices;
+       set<ConfigObject::Ptr> m_PendingServices;
 
        Timer::Ptr m_CheckTimer;
 
index 4697b456d2c0c627138db3cc2a4183efe18bdd68..bc37909b86fad82d1a9b07aa4c51e33d5da9c4f9 100644 (file)
@@ -235,6 +235,13 @@ void DelegationComponent::DelegationTimerHandler(void)
                assert(candidates.size() == 0 || !service.GetChecker().empty());
        }
 
+       map<Endpoint::Ptr, int>::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<Endpoint::Ptr, int>::iterator hit;
@@ -252,13 +259,6 @@ void DelegationComponent::DelegationTimerHandler(void)
 
                        AssignService(endpoint, *sit);
                }
-
-               map<Endpoint::Ptr, int>::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;