mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
Fixed task statistics.
This commit is contained in:
parent
d789cee443
commit
88776a4be8
@ -4,9 +4,6 @@ pkglib_LTLIBRARIES = \
|
|||||||
libcib.la
|
libcib.la
|
||||||
|
|
||||||
libcib_la_SOURCES = \
|
libcib_la_SOURCES = \
|
||||||
checkresult.h \
|
|
||||||
checkresultmessage.cpp \
|
|
||||||
checkresultmessage.h \
|
|
||||||
cib.cpp \
|
cib.cpp \
|
||||||
cib.h \
|
cib.h \
|
||||||
host.cpp \
|
host.cpp \
|
||||||
@ -23,7 +20,9 @@ libcib_la_SOURCES = \
|
|||||||
service.cpp \
|
service.cpp \
|
||||||
service.h \
|
service.h \
|
||||||
servicegroup.cpp \
|
servicegroup.cpp \
|
||||||
servicegroup.h
|
servicegroup.h \
|
||||||
|
servicestatechangemessage.cpp \
|
||||||
|
servicestatechangemessage.h
|
||||||
|
|
||||||
libcib_la_CPPFLAGS = \
|
libcib_la_CPPFLAGS = \
|
||||||
-DI2_CIB_BUILD \
|
-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 "servicegroup.h"
|
||||||
|
|
||||||
#include "macroprocessor.h"
|
#include "macroprocessor.h"
|
||||||
#include "checkresult.h"
|
|
||||||
#include "nagioschecktask.h"
|
#include "nagioschecktask.h"
|
||||||
#include "nullchecktask.h"
|
#include "nullchecktask.h"
|
||||||
|
|
||||||
#include "checkresultmessage.h"
|
#include "servicestatechangemessage.h"
|
||||||
|
|
||||||
#include "cib.h"
|
#include "cib.h"
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
bool CheckResultMessage::GetService(String *service) const
|
bool ServiceStateChangeMessage::GetService(String *service) const
|
||||||
{
|
{
|
||||||
return Get("service", service);
|
return Get("service", service);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckResultMessage::SetService(const String& service)
|
void ServiceStateChangeMessage::SetService(const String& service)
|
||||||
{
|
{
|
||||||
Set("service", service);
|
Set("service", service);
|
||||||
}
|
}
|
@ -17,17 +17,17 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef CHECKRESULTMESSAGE_H
|
#ifndef SERVICESTATECHANGEMESSAGE_H
|
||||||
#define CHECKRESULTMESSAGE_H
|
#define SERVICESTATECHANGEMESSAGE_H
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
class I2_CIB_API CheckResultMessage : public MessagePart
|
class I2_CIB_API ServiceStateChangeMessage : public MessagePart
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CheckResultMessage(void) : MessagePart() { }
|
ServiceStateChangeMessage(void) : MessagePart() { }
|
||||||
CheckResultMessage(const MessagePart& message) : MessagePart(message) { }
|
ServiceStateChangeMessage(const MessagePart& message) : MessagePart(message) { }
|
||||||
|
|
||||||
bool GetService(String *service) const;
|
bool GetService(String *service) const;
|
||||||
void SetService(const String& service);
|
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));
|
boost::bind(&CheckerComponent::AssignServiceRequestHandler, this, _2, _3));
|
||||||
m_Endpoint->RegisterTopicHandler("checker::ClearServices",
|
m_Endpoint->RegisterTopicHandler("checker::ClearServices",
|
||||||
boost::bind(&CheckerComponent::ClearServicesRequestHandler, this, _2, _3));
|
boost::bind(&CheckerComponent::ClearServicesRequestHandler, this, _2, _3));
|
||||||
m_Endpoint->RegisterPublication("checker::CheckResult");
|
m_Endpoint->RegisterPublication("checker::ServiceStateChange");
|
||||||
EndpointManager::GetInstance()->RegisterEndpoint(m_Endpoint);
|
EndpointManager::GetInstance()->RegisterEndpoint(m_Endpoint);
|
||||||
|
|
||||||
m_CheckTimer = boost::make_shared<Timer>();
|
m_CheckTimer = boost::make_shared<Timer>();
|
||||||
@ -106,7 +106,7 @@ void CheckerComponent::CheckCompletedHandler(const Service::Ptr& service, const
|
|||||||
rm.SetMethod("checker::ServiceStateChange");
|
rm.SetMethod("checker::ServiceStateChange");
|
||||||
|
|
||||||
/* TODO: add _old_ state to message */
|
/* TODO: add _old_ state to message */
|
||||||
CheckResultMessage params;
|
ServiceStateChangeMessage params;
|
||||||
params.SetService(service->GetName());
|
params.SetService(service->GetName());
|
||||||
|
|
||||||
rm.SetParams(params);
|
rm.SetParams(params);
|
||||||
|
@ -50,8 +50,8 @@ void CIBSyncComponent::Start(void)
|
|||||||
boost::bind(&CIBSyncComponent::RemoteObjectRemovedHandler, this, _3));
|
boost::bind(&CIBSyncComponent::RemoteObjectRemovedHandler, this, _3));
|
||||||
|
|
||||||
/* service status */
|
/* service status */
|
||||||
m_Endpoint->RegisterTopicHandler("checker::CheckResult",
|
m_Endpoint->RegisterTopicHandler("checker::ServiceStateChange",
|
||||||
boost::bind(&CIBSyncComponent::CheckResultRequestHandler, _2, _3));
|
boost::bind(&CIBSyncComponent::ServiceStateChangeRequestHandler, _2, _3));
|
||||||
|
|
||||||
EndpointManager::GetInstance()->RegisterEndpoint(m_Endpoint);
|
EndpointManager::GetInstance()->RegisterEndpoint(m_Endpoint);
|
||||||
}
|
}
|
||||||
@ -67,9 +67,9 @@ void CIBSyncComponent::Stop(void)
|
|||||||
endpointManager->UnregisterEndpoint(m_Endpoint);
|
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))
|
if (!request.GetParams(¶ms))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ void CIBSyncComponent::TransactionClosingHandler(const set<DynamicObject::Ptr>&
|
|||||||
|
|
||||||
stringstream msgbuf;
|
stringstream msgbuf;
|
||||||
msgbuf << "Sending " << modifiedObjects.size() << " replication updates.";
|
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) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, modifiedObjects) {
|
||||||
if (!ShouldReplicateObject(object))
|
if (!ShouldReplicateObject(object))
|
||||||
|
@ -36,7 +36,7 @@ private:
|
|||||||
VirtualEndpoint::Ptr m_Endpoint;
|
VirtualEndpoint::Ptr m_Endpoint;
|
||||||
bool m_SyncingConfig;
|
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 NewEndpointHandler(const Endpoint::Ptr& endpoint);
|
||||||
void SessionEstablishedHandler(const Endpoint::Ptr& endpoint);
|
void SessionEstablishedHandler(const Endpoint::Ptr& endpoint);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user