]> granicus.if.org Git - icinga2/commitdiff
Move /status/Collection to /status
authorJean-Marcel Flach <jean-marcel.flach@netways.de>
Thu, 24 Sep 2015 13:26:57 +0000 (15:26 +0200)
committerJean-Marcel Flach <jean-marcel.flach@netways.de>
Thu, 24 Sep 2015 13:26:57 +0000 (15:26 +0200)
fixes #10210

lib/remote/statushandler.cpp
lib/remote/statushandler.hpp

index c6c9bf982788c4ecf68f333804b2499472ec8447..d3ac9fd08a21752a0f5d4755f5ac1527e763c6dc 100644 (file)
@@ -66,7 +66,14 @@ bool StatusHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& request
                typedef std::pair<String, StatsFunction::Ptr> kv_pair;
                BOOST_FOREACH(const kv_pair& kv, StatsFunctionRegistry::GetInstance()->GetItems()) {
                        resultInner = new Dictionary();
+                       Dictionary::Ptr funcStatus = new Dictionary();
+                       Array::Ptr funcPData = new Array();
+                       kv.second->Invoke(funcStatus, funcPData);
+
                        resultInner->Set("name", kv.first);
+                       resultInner->Set("status", funcPData);
+                       resultInner->Set("perfdata", funcPData);
+
                        results->Add(resultInner);
                }
        }
@@ -79,23 +86,3 @@ bool StatusHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& request
        return true;
 }
 
-REGISTER_STATSFUNCTION(Collection, &StatusHandler::StatsFunc);
-
-void StatusHandler::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
-{
-       typedef std::pair<String, StatsFunction::Ptr> kv_pair;
-       BOOST_FOREACH(const kv_pair& kv, StatsFunctionRegistry::GetInstance()->GetItems()) {
-               if (kv.first == "Collection") //TODO Find a better name
-                       continue;
-
-               Dictionary::Ptr funcStatus = new Dictionary();
-               Array::Ptr funcPData = new Array();
-               kv.second->Invoke(funcStatus, funcPData);
-
-               Dictionary::Ptr result = new Dictionary();
-               result->Set("status", funcStatus);
-               result->Set("perfdata", funcPData);
-               status->Set(kv.first, result);
-       }
-}
-
index 0e3192ae518b8881528d7bda5ba5fe1dbd3f3640..2048564e08923e5f18d26f862d31c939ab0e67a3 100644 (file)
@@ -31,7 +31,6 @@ public:
        DECLARE_PTR_TYPEDEFS(StatusHandler);
 
        virtual bool HandleRequest(const ApiUser::Ptr& user, HttpRequest& request, HttpResponse& response) override;
-       static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
 };
 
 }