mirror of https://github.com/Icinga/icinga2.git
Fixed task statistics.
This commit is contained in:
parent
d789cee443
commit
88776a4be8
|
@ -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 \
|
||||
|
|
|
@ -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 */
|
|
@ -42,11 +42,10 @@
|
|||
#include "servicegroup.h"
|
||||
|
||||
#include "macroprocessor.h"
|
||||
#include "checkresult.h"
|
||||
#include "nagioschecktask.h"
|
||||
#include "nullchecktask.h"
|
||||
|
||||
#include "checkresultmessage.h"
|
||||
#include "servicestatechangemessage.h"
|
||||
|
||||
#include "cib.h"
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
|
||||
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);
|
||||
}
|
|
@ -17,17 +17,17 @@
|
|||
* 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 */
|
|
@ -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);
|
||||
|
|
|
@ -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(¶ms))
|
||||
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))
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue