]> granicus.if.org Git - icinga2/commitdiff
Fix host, service sort order in StatusDataWriter.
authorMichael Friedrich <Michael.Friedrich@netways.de>
Sun, 16 Mar 2014 13:59:19 +0000 (14:59 +0100)
committerMichael Friedrich <Michael.Friedrich@netways.de>
Sun, 16 Mar 2014 13:59:19 +0000 (14:59 +0100)
Fixes #5775

components/compat/statusdatawriter.cpp

index 631ae066c9e41593e262afe87c5a6f229c872aa2..da7aa6bc0bc08eeef2416cfb969cb5d8fd815d47 100644 (file)
@@ -553,6 +553,13 @@ void StatusDataWriter::UpdateObjectsCache(void)
                tempobjectfp << std::fixed;
                DumpHostObject(tempobjectfp, host);
                objectfp << tempobjectfp.str();
+
+               BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
+                       std::ostringstream tempobjectfp;
+                       tempobjectfp << std::fixed;
+                       DumpServiceObject(tempobjectfp, service);
+                       objectfp << tempobjectfp.str();
+               }
        }
 
        BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjects<HostGroup>()) {
@@ -572,13 +579,6 @@ void StatusDataWriter::UpdateObjectsCache(void)
                objectfp << tempobjectfp.str();
        }
 
-       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
-               std::ostringstream tempobjectfp;
-               tempobjectfp << std::fixed;
-               DumpServiceObject(tempobjectfp, service);
-               objectfp << tempobjectfp.str();
-       }
-
        BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjects<ServiceGroup>()) {
                std::ostringstream tempobjectfp;
                tempobjectfp << std::fixed;
@@ -742,13 +742,13 @@ void StatusDataWriter::StatusTimerHandler(void)
                tempstatusfp << std::fixed;
                DumpHostStatus(tempstatusfp, host);
                statusfp << tempstatusfp.str();
-       }
 
-       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
-               std::ostringstream tempstatusfp;
-               tempstatusfp << std::fixed;
-               DumpServiceStatus(tempstatusfp, service);
-               statusfp << tempstatusfp.str();
+               BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
+                       std::ostringstream tempstatusfp;
+                       tempstatusfp << std::fixed;
+                       DumpServiceStatus(tempstatusfp, service);
+                       statusfp << tempstatusfp.str();
+               }
        }
 
        statusfp.close();