]> granicus.if.org Git - icinga2/commitdiff
Fixed task statistics.
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 3 Aug 2012 12:07:25 +0000 (14:07 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 3 Aug 2012 12:07:25 +0000 (14:07 +0200)
cib/Makefile.am
cib/checkresult.h [deleted file]
cib/i2-cib.h
cib/servicestatechangemessage.cpp [moved from cib/checkresultmessage.cpp with 92% similarity]
cib/servicestatechangemessage.h [moved from cib/checkresultmessage.h with 83% similarity]
components/checker/checkercomponent.cpp
components/cibsync/cibsynccomponent.cpp
components/cibsync/cibsynccomponent.h

index e2d5610fef7f5b5c99ca97fb3c9984c22ef4a8b4..98cfdf6bf23e900502eb667e0eda804e3df03889 100644 (file)
@@ -4,9 +4,6 @@ pkglib_LTLIBRARIES = \
        libcib.la
 
 libcib_la_SOURCES = \
-       checkresult.h \
-       checkresultmessage.cpp \
-       checkresultmessage.h \
        cib.cpp \
        cib.h \
        host.cpp \
@@ -23,7 +20,9 @@ libcib_la_SOURCES = \
        service.cpp \
        service.h \
        servicegroup.cpp \
-       servicegroup.h
+       servicegroup.h \
+       servicestatechangemessage.cpp \
+       servicestatechangemessage.h
 
 libcib_la_CPPFLAGS = \
        -DI2_CIB_BUILD \
diff --git a/cib/checkresult.h b/cib/checkresult.h
deleted file mode 100644 (file)
index 3c0698b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
- *                                                                            *
- * This program is free software; you can redistribute it and/or              *
- * modify it under the terms of the GNU General Public License                *
- * as published by the Free Software Foundation; either version 2             *
- * of the License, or (at your option) any later version.                     *
- *                                                                            *
- * This program is distributed in the hope that it will be useful,            *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
- * GNU General Public License for more details.                               *
- *                                                                            *
- * You should have received a copy of the GNU General Public License          *
- * along with this program; if not, write to the Free Software Foundation     *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
- ******************************************************************************/
-
-#ifndef CHECKRESULT_H
-#define CHECKRESULT_H
-
-namespace icinga
-{
-
-/*struct CheckResult
-{
-       static const char *ScheduleStart = "schedule_start";
-       static const char *ScheduleEnd = "schedule_end";
-       static const char *ExecutionStart = "execution_start";
-       static const char *ExecutionEnd = "execution_end";
-       static const char *State = "state";
-       static const char *Output = "output";
-       static const char *PerformanceDataRaw = "performance_data_raw";
-       static const char *PerformanceData = "performance_data";
-
-private:
-       CheckResult();
-};*/
-
-}
-
-#endif /* CHECKRESULT_H */
index 2964f10b055466ae9c2bcf2fd7108c5b9bf17973..9863164d48749d457a115e01b636ea876b05e765 100644 (file)
 #include "servicegroup.h"
 
 #include "macroprocessor.h"
-#include "checkresult.h"
 #include "nagioschecktask.h"
 #include "nullchecktask.h"
 
-#include "checkresultmessage.h"
+#include "servicestatechangemessage.h"
 
 #include "cib.h"
 
similarity index 92%
rename from cib/checkresultmessage.cpp
rename to cib/servicestatechangemessage.cpp
index 35078c30da38dc2cf248e798dc08f262673e4f47..030e893f863819f6f0b71657c7137bc0f12e1c03 100644 (file)
 
 using namespace icinga;
 
-bool CheckResultMessage::GetService(String *service) const
+bool ServiceStateChangeMessage::GetService(String *service) const
 {
        return Get("service", service);
 }
 
-void CheckResultMessage::SetService(const String& service)
+void ServiceStateChangeMessage::SetService(const String& service)
 {
        Set("service", service);
 }
similarity index 83%
rename from cib/checkresultmessage.h
rename to cib/servicestatechangemessage.h
index 5e37bf05b9c9a27bd74a50b9824f2038e01740bb..bee5082ccdab8f5261247c4263149962c3945657 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#ifndef CHECKRESULTMESSAGE_H
-#define CHECKRESULTMESSAGE_H
+#ifndef SERVICESTATECHANGEMESSAGE_H
+#define SERVICESTATECHANGEMESSAGE_H
 
 namespace icinga
 {
 
-class I2_CIB_API CheckResultMessage : public MessagePart
+class I2_CIB_API ServiceStateChangeMessage : public MessagePart
 {
 public:
-       CheckResultMessage(void) : MessagePart() { }
-       CheckResultMessage(const MessagePart& message) : MessagePart(message) { }
+       ServiceStateChangeMessage(void) : MessagePart() { }
+       ServiceStateChangeMessage(const MessagePart& message) : MessagePart(message) { }
 
        bool GetService(String *service) const;
        void SetService(const String& service);
@@ -35,4 +35,4 @@ public:
 
 }
 
-#endif /* CHECKRESULTMESSAGE_H */
+#endif /* SERVICESTATECHANGEMESSAGE_H */
index c67ea518e10e9e439032245cfbaba5924e64d803..992d84bf6e27e70db6361686734b9c207fdf1fd9 100644 (file)
@@ -28,7 +28,7 @@ void CheckerComponent::Start(void)
                boost::bind(&CheckerComponent::AssignServiceRequestHandler, this, _2, _3));
        m_Endpoint->RegisterTopicHandler("checker::ClearServices",
                boost::bind(&CheckerComponent::ClearServicesRequestHandler, this, _2, _3));
-       m_Endpoint->RegisterPublication("checker::CheckResult");
+       m_Endpoint->RegisterPublication("checker::ServiceStateChange");
        EndpointManager::GetInstance()->RegisterEndpoint(m_Endpoint);
 
        m_CheckTimer = boost::make_shared<Timer>();
@@ -106,7 +106,7 @@ void CheckerComponent::CheckCompletedHandler(const Service::Ptr& service, const
                        rm.SetMethod("checker::ServiceStateChange");
 
                        /* TODO: add _old_ state to message */
-                       CheckResultMessage params;
+                       ServiceStateChangeMessage params;
                        params.SetService(service->GetName());
 
                        rm.SetParams(params);
index 71de26a834f2b39098c2620b90554391ed9a6a3c..9b1264a3af1b99c512dce6947314b93a42e22e8f 100644 (file)
@@ -50,8 +50,8 @@ void CIBSyncComponent::Start(void)
            boost::bind(&CIBSyncComponent::RemoteObjectRemovedHandler, this, _3));
 
        /* service status */
-       m_Endpoint->RegisterTopicHandler("checker::CheckResult",
-           boost::bind(&CIBSyncComponent::CheckResultRequestHandler, _2, _3));
+       m_Endpoint->RegisterTopicHandler("checker::ServiceStateChange",
+           boost::bind(&CIBSyncComponent::ServiceStateChangeRequestHandler, _2, _3));
 
        EndpointManager::GetInstance()->RegisterEndpoint(m_Endpoint);
 }
@@ -67,9 +67,9 @@ void CIBSyncComponent::Stop(void)
                endpointManager->UnregisterEndpoint(m_Endpoint);
 }
 
-void CIBSyncComponent::CheckResultRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request)
+void CIBSyncComponent::ServiceStateChangeRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request)
 {
-       CheckResultMessage params;
+       ServiceStateChangeMessage params;
        if (!request.GetParams(&params))
                return;
 
@@ -179,7 +179,7 @@ void CIBSyncComponent::TransactionClosingHandler(const set<DynamicObject::Ptr>&
 
        stringstream msgbuf;
        msgbuf << "Sending " << modifiedObjects.size() << " replication updates.";
-       Logger::Write(LogInformation, "cibsync", msgbuf.str());
+       Logger::Write(LogDebug, "cibsync", msgbuf.str());
 
        BOOST_FOREACH(const DynamicObject::Ptr& object, modifiedObjects) {
                if (!ShouldReplicateObject(object))
index f912e4de31605e181f32c6439d8d3a7f0dcdd741..7188fef12b59a84666f1606804c2ac825f6ed7b4 100644 (file)
@@ -36,7 +36,7 @@ private:
        VirtualEndpoint::Ptr m_Endpoint;
        bool m_SyncingConfig;
 
-       static void CheckResultRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request);
+       static void ServiceStateChangeRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request);
 
        void NewEndpointHandler(const Endpoint::Ptr& endpoint);
        void SessionEstablishedHandler(const Endpoint::Ptr& endpoint);