mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-31 01:24:19 +02:00
Rename DynamicObject/DynamicType to ConfigObject/ConfigType
fixes #9914
This commit is contained in:
parent
827de21907
commit
071d2f18fb
@ -16,7 +16,7 @@
|
|||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
mkclass_target(application.ti application.tcpp application.thpp)
|
mkclass_target(application.ti application.tcpp application.thpp)
|
||||||
mkclass_target(dynamicobject.ti dynamicobject.tcpp dynamicobject.thpp)
|
mkclass_target(configobject.ti configobject.tcpp configobject.thpp)
|
||||||
mkclass_target(filelogger.ti filelogger.tcpp filelogger.thpp)
|
mkclass_target(filelogger.ti filelogger.tcpp filelogger.thpp)
|
||||||
mkclass_target(logger.ti logger.tcpp logger.thpp)
|
mkclass_target(logger.ti logger.tcpp logger.thpp)
|
||||||
mkclass_target(streamlogger.ti streamlogger.tcpp streamlogger.thpp)
|
mkclass_target(streamlogger.ti streamlogger.tcpp streamlogger.thpp)
|
||||||
@ -26,7 +26,7 @@ set(base_SOURCES
|
|||||||
application.cpp application.thpp application-version.cpp array.cpp
|
application.cpp application.thpp application-version.cpp array.cpp
|
||||||
array-script.cpp boolean.cpp boolean-script.cpp console.cpp context.cpp
|
array-script.cpp boolean.cpp boolean-script.cpp console.cpp context.cpp
|
||||||
convert.cpp debuginfo.cpp dictionary.cpp dictionary-script.cpp
|
convert.cpp debuginfo.cpp dictionary.cpp dictionary-script.cpp
|
||||||
dynamicobject.cpp dynamicobject.thpp dynamicobject-script.cpp dynamictype.cpp
|
configobject.cpp configobject.thpp configobject-script.cpp configtype.cpp
|
||||||
exception.cpp fifo.cpp filelogger.cpp filelogger.thpp initialize.cpp json.cpp
|
exception.cpp fifo.cpp filelogger.cpp filelogger.thpp initialize.cpp json.cpp
|
||||||
json-script.cpp loader.cpp logger.cpp logger.thpp math-script.cpp
|
json-script.cpp loader.cpp logger.cpp logger.thpp math-script.cpp
|
||||||
netstring.cpp networkstream.cpp number.cpp number-script.cpp object.cpp
|
netstring.cpp networkstream.cpp number.cpp number-script.cpp object.cpp
|
||||||
|
@ -102,7 +102,7 @@ void Application::Stop(void)
|
|||||||
} else
|
} else
|
||||||
ClosePidFile(true);
|
ClosePidFile(true);
|
||||||
|
|
||||||
DynamicObject::Stop();
|
ConfigObject::Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application(void)
|
Application::~Application(void)
|
||||||
@ -318,7 +318,7 @@ mainloop:
|
|||||||
|
|
||||||
Log(LogInformation, "Application", "Shutting down...");
|
Log(LogInformation, "Application", "Shutting down...");
|
||||||
|
|
||||||
DynamicObject::StopObjects();
|
ConfigObject::StopObjects();
|
||||||
Application::GetInstance()->OnShutdown();
|
Application::GetInstance()->OnShutdown();
|
||||||
|
|
||||||
UninitializeBase();
|
UninitializeBase();
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
library base;
|
library base;
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
abstract class Application : DynamicObject
|
abstract class Application : ConfigObject
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/dictionary.hpp"
|
#include "base/dictionary.hpp"
|
||||||
#include "base/function.hpp"
|
#include "base/function.hpp"
|
||||||
#include "base/functionwrapper.hpp"
|
#include "base/functionwrapper.hpp"
|
||||||
@ -25,28 +25,28 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
static void DynamicObjectModifyAttribute(const String& attr, const Value& value)
|
static void ConfigObjectModifyAttribute(const String& attr, const Value& value)
|
||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
DynamicObject::Ptr self = vframe->Self;
|
ConfigObject::Ptr self = vframe->Self;
|
||||||
return self->ModifyAttribute(attr, value);
|
return self->ModifyAttribute(attr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DynamicObjectRestoreAttribute(const String& attr)
|
static void ConfigObjectRestoreAttribute(const String& attr)
|
||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
DynamicObject::Ptr self = vframe->Self;
|
ConfigObject::Ptr self = vframe->Self;
|
||||||
return self->RestoreAttribute(attr);
|
return self->RestoreAttribute(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object::Ptr DynamicObject::GetPrototype(void)
|
Object::Ptr ConfigObject::GetPrototype(void)
|
||||||
{
|
{
|
||||||
static Dictionary::Ptr prototype;
|
static Dictionary::Ptr prototype;
|
||||||
|
|
||||||
if (!prototype) {
|
if (!prototype) {
|
||||||
prototype = new Dictionary();
|
prototype = new Dictionary();
|
||||||
prototype->Set("modify_attribute", new Function(WrapFunction(DynamicObjectModifyAttribute), false));
|
prototype->Set("modify_attribute", new Function(WrapFunction(ConfigObjectModifyAttribute), false));
|
||||||
prototype->Set("restore_attribute", new Function(WrapFunction(DynamicObjectRestoreAttribute), false));
|
prototype->Set("restore_attribute", new Function(WrapFunction(ConfigObjectRestoreAttribute), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return prototype;
|
return prototype;
|
@ -17,9 +17,9 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/dynamicobject.tcpp"
|
#include "base/configobject.tcpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/serializer.hpp"
|
#include "base/serializer.hpp"
|
||||||
#include "base/netstring.hpp"
|
#include "base/netstring.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
@ -42,29 +42,29 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_TYPE_WITH_PROTOTYPE(DynamicObject, DynamicObject::GetPrototype());
|
REGISTER_TYPE_WITH_PROTOTYPE(ConfigObject, ConfigObject::GetPrototype());
|
||||||
|
|
||||||
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnStateChanged;
|
boost::signals2::signal<void (const ConfigObject::Ptr&)> ConfigObject::OnStateChanged;
|
||||||
|
|
||||||
DynamicObject::DynamicObject(void)
|
ConfigObject::ConfigObject(void)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
DynamicType::Ptr DynamicObject::GetType(void) const
|
ConfigType::Ptr ConfigObject::GetType(void) const
|
||||||
{
|
{
|
||||||
return DynamicType::GetByName(GetTypeNameV());
|
return ConfigType::GetByName(GetTypeNameV());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicObject::IsActive(void) const
|
bool ConfigObject::IsActive(void) const
|
||||||
{
|
{
|
||||||
return GetActive();
|
return GetActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicObject::IsPaused(void) const
|
bool ConfigObject::IsPaused(void) const
|
||||||
{
|
{
|
||||||
return GetPaused();
|
return GetPaused();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::SetExtension(const String& key, const Value& value)
|
void ConfigObject::SetExtension(const String& key, const Value& value)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr extensions = GetExtensions();
|
Dictionary::Ptr extensions = GetExtensions();
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ void DynamicObject::SetExtension(const String& key, const Value& value)
|
|||||||
extensions->Set(key, value);
|
extensions->Set(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value DynamicObject::GetExtension(const String& key)
|
Value ConfigObject::GetExtension(const String& key)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr extensions = GetExtensions();
|
Dictionary::Ptr extensions = GetExtensions();
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ Value DynamicObject::GetExtension(const String& key)
|
|||||||
return extensions->Get(key);
|
return extensions->Get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::ClearExtension(const String& key)
|
void ConfigObject::ClearExtension(const String& key)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr extensions = GetExtensions();
|
Dictionary::Ptr extensions = GetExtensions();
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ class ModAttrValidationUtils : public ValidationUtils
|
|||||||
public:
|
public:
|
||||||
virtual bool ValidateName(const String& type, const String& name) const override
|
virtual bool ValidateName(const String& type, const String& name) const override
|
||||||
{
|
{
|
||||||
DynamicType::Ptr dtype = DynamicType::GetByName(type);
|
ConfigType::Ptr dtype = ConfigType::GetByName(type);
|
||||||
|
|
||||||
if (!dtype)
|
if (!dtype)
|
||||||
return false;
|
return false;
|
||||||
@ -113,7 +113,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void DynamicObject::ModifyAttribute(const String& attr, const Value& value)
|
void ConfigObject::ModifyAttribute(const String& attr, const Value& value)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr original_attributes = GetOriginalAttributes();
|
Dictionary::Ptr original_attributes = GetOriginalAttributes();
|
||||||
bool updated_original_attributes = false;
|
bool updated_original_attributes = false;
|
||||||
@ -146,7 +146,7 @@ void DynamicObject::ModifyAttribute(const String& attr, const Value& value)
|
|||||||
NotifyOriginalAttributes();
|
NotifyOriginalAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::RestoreAttribute(const String& attr)
|
void ConfigObject::RestoreAttribute(const String& attr)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr original_attributes = GetOriginalAttributes();
|
Dictionary::Ptr original_attributes = GetOriginalAttributes();
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ void DynamicObject::RestoreAttribute(const String& attr)
|
|||||||
original_attributes->Remove(attr);
|
original_attributes->Remove(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicObject::IsAttributeModified(const String& attr) const
|
bool ConfigObject::IsAttributeModified(const String& attr) const
|
||||||
{
|
{
|
||||||
Dictionary::Ptr original_attributes = GetOriginalAttributes();
|
Dictionary::Ptr original_attributes = GetOriginalAttributes();
|
||||||
|
|
||||||
@ -169,23 +169,23 @@ bool DynamicObject::IsAttributeModified(const String& attr) const
|
|||||||
return original_attributes->Contains(attr);
|
return original_attributes->Contains(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::Register(void)
|
void ConfigObject::Register(void)
|
||||||
{
|
{
|
||||||
ASSERT(!OwnsLock());
|
ASSERT(!OwnsLock());
|
||||||
|
|
||||||
DynamicType::Ptr dtype = GetType();
|
ConfigType::Ptr dtype = GetType();
|
||||||
dtype->RegisterObject(this);
|
dtype->RegisterObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::Unregister(void)
|
void ConfigObject::Unregister(void)
|
||||||
{
|
{
|
||||||
ASSERT(!OwnsLock());
|
ASSERT(!OwnsLock());
|
||||||
|
|
||||||
DynamicType::Ptr dtype = GetType();
|
ConfigType::Ptr dtype = GetType();
|
||||||
dtype->UnregisterObject(this);
|
dtype->UnregisterObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::Start(void)
|
void ConfigObject::Start(void)
|
||||||
{
|
{
|
||||||
ASSERT(!OwnsLock());
|
ASSERT(!OwnsLock());
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
@ -193,7 +193,7 @@ void DynamicObject::Start(void)
|
|||||||
SetStartCalled(true);
|
SetStartCalled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::Activate(void)
|
void ConfigObject::Activate(void)
|
||||||
{
|
{
|
||||||
CONTEXT("Activating object '" + GetName() + "' of type '" + GetType()->GetName() + "'");
|
CONTEXT("Activating object '" + GetName() + "' of type '" + GetType()->GetName() + "'");
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ void DynamicObject::Activate(void)
|
|||||||
NotifyActive();
|
NotifyActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::Stop(void)
|
void ConfigObject::Stop(void)
|
||||||
{
|
{
|
||||||
ASSERT(!OwnsLock());
|
ASSERT(!OwnsLock());
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
@ -222,7 +222,7 @@ void DynamicObject::Stop(void)
|
|||||||
SetStopCalled(true);
|
SetStopCalled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::Deactivate(void)
|
void ConfigObject::Deactivate(void)
|
||||||
{
|
{
|
||||||
CONTEXT("Deactivating object '" + GetName() + "' of type '" + GetType()->GetName() + "'");
|
CONTEXT("Deactivating object '" + GetName() + "' of type '" + GetType()->GetName() + "'");
|
||||||
|
|
||||||
@ -246,37 +246,37 @@ void DynamicObject::Deactivate(void)
|
|||||||
NotifyActive();
|
NotifyActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::OnConfigLoaded(void)
|
void ConfigObject::OnConfigLoaded(void)
|
||||||
{
|
{
|
||||||
/* Nothing to do here. */
|
/* Nothing to do here. */
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::OnAllConfigLoaded(void)
|
void ConfigObject::OnAllConfigLoaded(void)
|
||||||
{
|
{
|
||||||
/* Nothing to do here. */
|
/* Nothing to do here. */
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::CreateChildObjects(const Type::Ptr& childType)
|
void ConfigObject::CreateChildObjects(const Type::Ptr& childType)
|
||||||
{
|
{
|
||||||
/* Nothing to do here. */
|
/* Nothing to do here. */
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::OnStateLoaded(void)
|
void ConfigObject::OnStateLoaded(void)
|
||||||
{
|
{
|
||||||
/* Nothing to do here. */
|
/* Nothing to do here. */
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::Pause(void)
|
void ConfigObject::Pause(void)
|
||||||
{
|
{
|
||||||
SetPauseCalled(true);
|
SetPauseCalled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::Resume(void)
|
void ConfigObject::Resume(void)
|
||||||
{
|
{
|
||||||
SetResumeCalled(true);
|
SetResumeCalled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::SetAuthority(bool authority)
|
void ConfigObject::SetAuthority(bool authority)
|
||||||
{
|
{
|
||||||
if (authority && GetPaused()) {
|
if (authority && GetPaused()) {
|
||||||
SetResumeCalled(false);
|
SetResumeCalled(false);
|
||||||
@ -291,9 +291,9 @@ void DynamicObject::SetAuthority(bool authority)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::DumpObjects(const String& filename, int attributeTypes)
|
void ConfigObject::DumpObjects(const String& filename, int attributeTypes)
|
||||||
{
|
{
|
||||||
Log(LogInformation, "DynamicObject")
|
Log(LogInformation, "ConfigObject")
|
||||||
<< "Dumping program state to file '" << filename << "'";
|
<< "Dumping program state to file '" << filename << "'";
|
||||||
|
|
||||||
String tempFilename = filename + ".tmp";
|
String tempFilename = filename + ".tmp";
|
||||||
@ -306,8 +306,8 @@ void DynamicObject::DumpObjects(const String& filename, int attributeTypes)
|
|||||||
|
|
||||||
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
||||||
|
|
||||||
BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
|
BOOST_FOREACH(const ConfigType::Ptr& type, ConfigType::GetTypes()) {
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) {
|
BOOST_FOREACH(const ConfigObject::Ptr& object, type->GetObjects()) {
|
||||||
Dictionary::Ptr persistentObject = new Dictionary();
|
Dictionary::Ptr persistentObject = new Dictionary();
|
||||||
|
|
||||||
persistentObject->Set("type", type->GetName());
|
persistentObject->Set("type", type->GetName());
|
||||||
@ -342,27 +342,27 @@ void DynamicObject::DumpObjects(const String& filename, int attributeTypes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::RestoreObject(const String& message, int attributeTypes)
|
void ConfigObject::RestoreObject(const String& message, int attributeTypes)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr persistentObject = JsonDecode(message);
|
Dictionary::Ptr persistentObject = JsonDecode(message);
|
||||||
|
|
||||||
String type = persistentObject->Get("type");
|
String type = persistentObject->Get("type");
|
||||||
|
|
||||||
DynamicType::Ptr dt = DynamicType::GetByName(type);
|
ConfigType::Ptr dt = ConfigType::GetByName(type);
|
||||||
|
|
||||||
if (!dt)
|
if (!dt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String name = persistentObject->Get("name");
|
String name = persistentObject->Get("name");
|
||||||
|
|
||||||
DynamicObject::Ptr object = dt->GetObject(name);
|
ConfigObject::Ptr object = dt->GetObject(name);
|
||||||
|
|
||||||
if (!object)
|
if (!object)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT(!object->IsActive());
|
ASSERT(!object->IsActive());
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_DEBUG
|
||||||
Log(LogDebug, "DynamicObject")
|
Log(LogDebug, "ConfigObject")
|
||||||
<< "Restoring object '" << name << "' of type '" << type << "'.";
|
<< "Restoring object '" << name << "' of type '" << type << "'.";
|
||||||
#endif /* I2_DEBUG */
|
#endif /* I2_DEBUG */
|
||||||
Dictionary::Ptr update = persistentObject->Get("update");
|
Dictionary::Ptr update = persistentObject->Get("update");
|
||||||
@ -371,12 +371,12 @@ void DynamicObject::RestoreObject(const String& message, int attributeTypes)
|
|||||||
object->SetStateLoaded(true);
|
object->SetStateLoaded(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
|
void ConfigObject::RestoreObjects(const String& filename, int attributeTypes)
|
||||||
{
|
{
|
||||||
if (!Utility::PathExists(filename))
|
if (!Utility::PathExists(filename))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Log(LogInformation, "DynamicObject")
|
Log(LogInformation, "ConfigObject")
|
||||||
<< "Restoring program state from file '" << filename << "'";
|
<< "Restoring program state from file '" << filename << "'";
|
||||||
|
|
||||||
std::fstream fp;
|
std::fstream fp;
|
||||||
@ -399,7 +399,7 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
|
|||||||
if (srs != StatusNewItem)
|
if (srs != StatusNewItem)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
upq.Enqueue(boost::bind(&DynamicObject::RestoreObject, message, attributeTypes));
|
upq.Enqueue(boost::bind(&ConfigObject::RestoreObject, message, attributeTypes));
|
||||||
restored++;
|
restored++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,8 +409,8 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
|
|||||||
|
|
||||||
unsigned long no_state = 0;
|
unsigned long no_state = 0;
|
||||||
|
|
||||||
BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
|
BOOST_FOREACH(const ConfigType::Ptr& type, ConfigType::GetTypes()) {
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) {
|
BOOST_FOREACH(const ConfigObject::Ptr& object, type->GetObjects()) {
|
||||||
if (!object->GetStateLoaded()) {
|
if (!object->GetStateLoaded()) {
|
||||||
object->OnStateLoaded();
|
object->OnStateLoaded();
|
||||||
object->SetStateLoaded(true);
|
object->SetStateLoaded(true);
|
||||||
@ -420,23 +420,23 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogInformation, "DynamicObject")
|
Log(LogInformation, "ConfigObject")
|
||||||
<< "Restored " << restored << " objects. Loaded " << no_state << " new objects without state.";
|
<< "Restored " << restored << " objects. Loaded " << no_state << " new objects without state.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::StopObjects(void)
|
void ConfigObject::StopObjects(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) {
|
BOOST_FOREACH(const ConfigType::Ptr& dt, ConfigType::GetTypes()) {
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) {
|
BOOST_FOREACH(const ConfigObject::Ptr& object, dt->GetObjects()) {
|
||||||
object->Deactivate();
|
object->Deactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::DumpModifiedAttributes(const boost::function<void(const DynamicObject::Ptr&, const String&, const Value&)>& callback)
|
void ConfigObject::DumpModifiedAttributes(const boost::function<void(const ConfigObject::Ptr&, const String&, const Value&)>& callback)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) {
|
BOOST_FOREACH(const ConfigType::Ptr& dt, ConfigType::GetTypes()) {
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) {
|
BOOST_FOREACH(const ConfigObject::Ptr& object, dt->GetObjects()) {
|
||||||
Dictionary::Ptr originalAttributes = object->GetOriginalAttributes();
|
Dictionary::Ptr originalAttributes = object->GetOriginalAttributes();
|
||||||
|
|
||||||
if (!originalAttributes)
|
if (!originalAttributes)
|
||||||
@ -454,8 +454,8 @@ void DynamicObject::DumpModifiedAttributes(const boost::function<void(const Dyna
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicObject::Ptr DynamicObject::GetObject(const String& type, const String& name)
|
ConfigObject::Ptr ConfigObject::GetObject(const String& type, const String& name)
|
||||||
{
|
{
|
||||||
DynamicType::Ptr dtype = DynamicType::GetByName(type);
|
ConfigType::Ptr dtype = ConfigType::GetByName(type);
|
||||||
return dtype->GetObject(name);
|
return dtype->GetObject(name);
|
||||||
}
|
}
|
@ -21,7 +21,7 @@
|
|||||||
#define DYNAMICOBJECT_H
|
#define DYNAMICOBJECT_H
|
||||||
|
|
||||||
#include "base/i2-base.hpp"
|
#include "base/i2-base.hpp"
|
||||||
#include "base/dynamicobject.thpp"
|
#include "base/configobject.thpp"
|
||||||
#include "base/object.hpp"
|
#include "base/object.hpp"
|
||||||
#include "base/type.hpp"
|
#include "base/type.hpp"
|
||||||
#include "base/dictionary.hpp"
|
#include "base/dictionary.hpp"
|
||||||
@ -30,21 +30,21 @@
|
|||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
class DynamicType;
|
class ConfigType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dynamic object that can be instantiated from the configuration file.
|
* A dynamic object that can be instantiated from the configuration file.
|
||||||
*
|
*
|
||||||
* @ingroup base
|
* @ingroup base
|
||||||
*/
|
*/
|
||||||
class I2_BASE_API DynamicObject : public ObjectImpl<DynamicObject>
|
class I2_BASE_API ConfigObject : public ObjectImpl<ConfigObject>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DECLARE_OBJECT(DynamicObject);
|
DECLARE_OBJECT(ConfigObject);
|
||||||
|
|
||||||
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStateChanged;
|
static boost::signals2::signal<void (const ConfigObject::Ptr&)> OnStateChanged;
|
||||||
|
|
||||||
intrusive_ptr<DynamicType> GetType(void) const;
|
intrusive_ptr<ConfigType> GetType(void) const;
|
||||||
|
|
||||||
bool IsActive(void) const;
|
bool IsActive(void) const;
|
||||||
bool IsPaused(void) const;
|
bool IsPaused(void) const;
|
||||||
@ -78,7 +78,7 @@ public:
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
static intrusive_ptr<T> GetObject(const String& name)
|
static intrusive_ptr<T> GetObject(const String& name)
|
||||||
{
|
{
|
||||||
DynamicObject::Ptr object = GetObject(T::GetTypeName(), name);
|
ConfigObject::Ptr object = GetObject(T::GetTypeName(), name);
|
||||||
|
|
||||||
return static_pointer_cast<T>(object);
|
return static_pointer_cast<T>(object);
|
||||||
}
|
}
|
||||||
@ -87,15 +87,15 @@ public:
|
|||||||
static void RestoreObjects(const String& filename, int attributeTypes = FAState);
|
static void RestoreObjects(const String& filename, int attributeTypes = FAState);
|
||||||
static void StopObjects(void);
|
static void StopObjects(void);
|
||||||
|
|
||||||
static void DumpModifiedAttributes(const boost::function<void(const DynamicObject::Ptr&, const String&, const Value&)>& callback);
|
static void DumpModifiedAttributes(const boost::function<void(const ConfigObject::Ptr&, const String&, const Value&)>& callback);
|
||||||
|
|
||||||
static Object::Ptr GetPrototype(void);
|
static Object::Ptr GetPrototype(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit DynamicObject(void);
|
explicit ConfigObject(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static DynamicObject::Ptr GetObject(const String& type, const String& name);
|
static ConfigObject::Ptr GetObject(const String& type, const String& name);
|
||||||
static void RestoreObject(const String& message, int attributeTypes);
|
static void RestoreObject(const String& message, int attributeTypes);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ private:
|
|||||||
\
|
\
|
||||||
inline static intrusive_ptr<klass> GetByName(const String& name) \
|
inline static intrusive_ptr<klass> GetByName(const String& name) \
|
||||||
{ \
|
{ \
|
||||||
return DynamicObject::GetObject<klass>(name); \
|
return ConfigObject::GetObject<klass>(name); \
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -38,11 +38,11 @@ public:
|
|||||||
};
|
};
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
abstract class DynamicObjectBase
|
abstract class ConfigObjectBase
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
code {{{
|
code {{{
|
||||||
class I2_BASE_API DynamicObjectBase : public ObjectImpl<DynamicObjectBase>
|
class I2_BASE_API ConfigObjectBase : public ObjectImpl<ConfigObjectBase>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline DebugInfo GetDebugInfo(void) const
|
inline DebugInfo GetDebugInfo(void) const
|
||||||
@ -60,7 +60,7 @@ private:
|
|||||||
};
|
};
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
abstract class DynamicObject : DynamicObjectBase
|
abstract class ConfigObject : ConfigObjectBase
|
||||||
{
|
{
|
||||||
[config, internal] String __name (Name);
|
[config, internal] String __name (Name);
|
||||||
[config] String "name" (ShortName) {
|
[config] String "name" (ShortName) {
|
@ -17,7 +17,7 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/serializer.hpp"
|
#include "base/serializer.hpp"
|
||||||
#include "base/debug.hpp"
|
#include "base/debug.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
@ -26,26 +26,26 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
DynamicType::DynamicType(const String& name)
|
ConfigType::ConfigType(const String& name)
|
||||||
: m_Name(name)
|
: m_Name(name)
|
||||||
{
|
{
|
||||||
InflateMutex();
|
InflateMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicType::Ptr DynamicType::GetByName(const String& name)
|
ConfigType::Ptr ConfigType::GetByName(const String& name)
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||||
|
|
||||||
DynamicType::TypeMap::const_iterator tt = InternalGetTypeMap().find(name);
|
ConfigType::TypeMap::const_iterator tt = InternalGetTypeMap().find(name);
|
||||||
|
|
||||||
if (tt == InternalGetTypeMap().end()) {
|
if (tt == InternalGetTypeMap().end()) {
|
||||||
Type::Ptr type = Type::GetByName(name);
|
Type::Ptr type = Type::GetByName(name);
|
||||||
|
|
||||||
if (!type || !DynamicObject::TypeInstance->IsAssignableFrom(type)
|
if (!type || !ConfigObject::TypeInstance->IsAssignableFrom(type)
|
||||||
|| type->IsAbstract())
|
|| type->IsAbstract())
|
||||||
return DynamicType::Ptr();
|
return ConfigType::Ptr();
|
||||||
|
|
||||||
DynamicType::Ptr dtype = new DynamicType(name);
|
ConfigType::Ptr dtype = new ConfigType(name);
|
||||||
|
|
||||||
InternalGetTypeMap()[type->GetName()] = dtype;
|
InternalGetTypeMap()[type->GetName()] = dtype;
|
||||||
InternalGetTypeVector().push_back(dtype);
|
InternalGetTypeVector().push_back(dtype);
|
||||||
@ -57,40 +57,40 @@ DynamicType::Ptr DynamicType::GetByName(const String& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: Caller must hold DynamicType::GetStaticMutex() while using the map.
|
* Note: Caller must hold ConfigType::GetStaticMutex() while using the map.
|
||||||
*/
|
*/
|
||||||
DynamicType::TypeMap& DynamicType::InternalGetTypeMap(void)
|
ConfigType::TypeMap& ConfigType::InternalGetTypeMap(void)
|
||||||
{
|
{
|
||||||
static DynamicType::TypeMap typemap;
|
static ConfigType::TypeMap typemap;
|
||||||
return typemap;
|
return typemap;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicType::TypeVector& DynamicType::InternalGetTypeVector(void)
|
ConfigType::TypeVector& ConfigType::InternalGetTypeVector(void)
|
||||||
{
|
{
|
||||||
static DynamicType::TypeVector typevector;
|
static ConfigType::TypeVector typevector;
|
||||||
return typevector;
|
return typevector;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicType::TypeVector DynamicType::GetTypes(void)
|
ConfigType::TypeVector ConfigType::GetTypes(void)
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||||
return InternalGetTypeVector(); /* Making a copy of the vector here. */
|
return InternalGetTypeVector(); /* Making a copy of the vector here. */
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<DynamicTypeIterator<DynamicObject>, DynamicTypeIterator<DynamicObject> > DynamicType::GetObjects(void)
|
std::pair<ConfigTypeIterator<ConfigObject>, ConfigTypeIterator<ConfigObject> > ConfigType::GetObjects(void)
|
||||||
{
|
{
|
||||||
return std::make_pair(
|
return std::make_pair(
|
||||||
DynamicTypeIterator<DynamicObject>(this, 0),
|
ConfigTypeIterator<ConfigObject>(this, 0),
|
||||||
DynamicTypeIterator<DynamicObject>(this, -1)
|
ConfigTypeIterator<ConfigObject>(this, -1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String DynamicType::GetName(void) const
|
String ConfigType::GetName(void) const
|
||||||
{
|
{
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicType::RegisterObject(const DynamicObject::Ptr& object)
|
void ConfigType::RegisterObject(const ConfigObject::Ptr& object)
|
||||||
{
|
{
|
||||||
String name = object->GetName();
|
String name = object->GetName();
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ void DynamicType::RegisterObject(const DynamicObject::Ptr& object)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicType::UnregisterObject(const DynamicObject::Ptr& object)
|
void ConfigType::UnregisterObject(const ConfigObject::Ptr& object)
|
||||||
{
|
{
|
||||||
String name = object->GetName();
|
String name = object->GetName();
|
||||||
|
|
||||||
@ -125,19 +125,19 @@ void DynamicType::UnregisterObject(const DynamicObject::Ptr& object)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicObject::Ptr DynamicType::GetObject(const String& name) const
|
ConfigObject::Ptr ConfigType::GetObject(const String& name) const
|
||||||
{
|
{
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
|
|
||||||
DynamicType::ObjectMap::const_iterator nt = m_ObjectMap.find(name);
|
ConfigType::ObjectMap::const_iterator nt = m_ObjectMap.find(name);
|
||||||
|
|
||||||
if (nt == m_ObjectMap.end())
|
if (nt == m_ObjectMap.end())
|
||||||
return DynamicObject::Ptr();
|
return ConfigObject::Ptr();
|
||||||
|
|
||||||
return nt->second;
|
return nt->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::mutex& DynamicType::GetStaticMutex(void)
|
boost::mutex& ConfigType::GetStaticMutex(void)
|
||||||
{
|
{
|
||||||
static boost::mutex mutex;
|
static boost::mutex mutex;
|
||||||
return mutex;
|
return mutex;
|
@ -21,7 +21,7 @@
|
|||||||
#define DYNAMICTYPE_H
|
#define DYNAMICTYPE_H
|
||||||
|
|
||||||
#include "base/i2-base.hpp"
|
#include "base/i2-base.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include <map>
|
#include <map>
|
||||||
# include <boost/iterator/iterator_facade.hpp>
|
# include <boost/iterator/iterator_facade.hpp>
|
||||||
@ -30,50 +30,50 @@ namespace icinga
|
|||||||
{
|
{
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class DynamicTypeIterator;
|
class ConfigTypeIterator;
|
||||||
|
|
||||||
class I2_BASE_API DynamicType : public Object
|
class I2_BASE_API ConfigType : public Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DECLARE_PTR_TYPEDEFS(DynamicType);
|
DECLARE_PTR_TYPEDEFS(ConfigType);
|
||||||
|
|
||||||
DynamicType(const String& name);
|
ConfigType(const String& name);
|
||||||
|
|
||||||
String GetName(void) const;
|
String GetName(void) const;
|
||||||
|
|
||||||
static DynamicType::Ptr GetByName(const String& name);
|
static ConfigType::Ptr GetByName(const String& name);
|
||||||
|
|
||||||
DynamicObject::Ptr GetObject(const String& name) const;
|
ConfigObject::Ptr GetObject(const String& name) const;
|
||||||
|
|
||||||
void RegisterObject(const DynamicObject::Ptr& object);
|
void RegisterObject(const ConfigObject::Ptr& object);
|
||||||
void UnregisterObject(const DynamicObject::Ptr& object);
|
void UnregisterObject(const ConfigObject::Ptr& object);
|
||||||
|
|
||||||
static std::vector<DynamicType::Ptr> GetTypes(void);
|
static std::vector<ConfigType::Ptr> GetTypes(void);
|
||||||
std::pair<DynamicTypeIterator<DynamicObject>, DynamicTypeIterator<DynamicObject> > GetObjects(void);
|
std::pair<ConfigTypeIterator<ConfigObject>, ConfigTypeIterator<ConfigObject> > GetObjects(void);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static std::pair<DynamicTypeIterator<T>, DynamicTypeIterator<T> > GetObjectsByType(void)
|
static std::pair<ConfigTypeIterator<T>, ConfigTypeIterator<T> > GetObjectsByType(void)
|
||||||
{
|
{
|
||||||
DynamicType::Ptr type = GetByName(T::GetTypeName());
|
ConfigType::Ptr type = GetByName(T::GetTypeName());
|
||||||
return std::make_pair(
|
return std::make_pair(
|
||||||
DynamicTypeIterator<T>(type, 0),
|
ConfigTypeIterator<T>(type, 0),
|
||||||
DynamicTypeIterator<T>(type, UINT_MAX)
|
ConfigTypeIterator<T>(type, UINT_MAX)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename T> friend class DynamicTypeIterator;
|
template<typename T> friend class ConfigTypeIterator;
|
||||||
|
|
||||||
String m_Name;
|
String m_Name;
|
||||||
|
|
||||||
typedef std::map<String, DynamicObject::Ptr> ObjectMap;
|
typedef std::map<String, ConfigObject::Ptr> ObjectMap;
|
||||||
typedef std::vector<DynamicObject::Ptr> ObjectVector;
|
typedef std::vector<ConfigObject::Ptr> ObjectVector;
|
||||||
|
|
||||||
ObjectMap m_ObjectMap;
|
ObjectMap m_ObjectMap;
|
||||||
ObjectVector m_ObjectVector;
|
ObjectVector m_ObjectVector;
|
||||||
|
|
||||||
typedef std::map<String, DynamicType::Ptr> TypeMap;
|
typedef std::map<String, ConfigType::Ptr> TypeMap;
|
||||||
typedef std::vector<DynamicType::Ptr> TypeVector;
|
typedef std::vector<ConfigType::Ptr> TypeVector;
|
||||||
|
|
||||||
static TypeMap& InternalGetTypeMap(void);
|
static TypeMap& InternalGetTypeMap(void);
|
||||||
static TypeVector& InternalGetTypeVector(void);
|
static TypeVector& InternalGetTypeVector(void);
|
||||||
@ -81,18 +81,18 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class DynamicTypeIterator : public boost::iterator_facade<DynamicTypeIterator<T>, const intrusive_ptr<T>, boost::forward_traversal_tag>
|
class ConfigTypeIterator : public boost::iterator_facade<ConfigTypeIterator<T>, const intrusive_ptr<T>, boost::forward_traversal_tag>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DynamicTypeIterator(const DynamicType::Ptr& type, int index)
|
ConfigTypeIterator(const ConfigType::Ptr& type, int index)
|
||||||
: m_Type(type), m_Index(index)
|
: m_Type(type), m_Index(index)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class boost::iterator_core_access;
|
friend class boost::iterator_core_access;
|
||||||
|
|
||||||
DynamicType::Ptr m_Type;
|
ConfigType::Ptr m_Type;
|
||||||
DynamicType::ObjectVector::size_type m_Index;
|
ConfigType::ObjectVector::size_type m_Index;
|
||||||
mutable intrusive_ptr<T> m_Current;
|
mutable intrusive_ptr<T> m_Current;
|
||||||
|
|
||||||
void increment(void)
|
void increment(void)
|
||||||
@ -110,7 +110,7 @@ private:
|
|||||||
m_Index += n;
|
m_Index += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool equal(const DynamicTypeIterator<T>& other) const
|
bool equal(const ConfigTypeIterator<T>& other) const
|
||||||
{
|
{
|
||||||
ASSERT(other.m_Type == m_Type);
|
ASSERT(other.m_Type == m_Type);
|
||||||
|
|
@ -154,7 +154,7 @@ String icinga::DiagnosticInformation(const std::exception& ex, bool verbose, Sta
|
|||||||
if (vex) {
|
if (vex) {
|
||||||
DebugInfo di;
|
DebugInfo di;
|
||||||
|
|
||||||
DynamicObject::Ptr dobj = vex->GetObject();
|
ConfigObject::Ptr dobj = vex->GetObject();
|
||||||
if (dobj)
|
if (dobj)
|
||||||
di = dobj->GetDebugInfo();
|
di = dobj->GetDebugInfo();
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ const char *posix_error::what(void) const throw()
|
|||||||
return m_Message;
|
return m_Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidationError::ValidationError(const DynamicObject::Ptr& object, const std::vector<String>& attributePath, const String& message)
|
ValidationError::ValidationError(const ConfigObject::Ptr& object, const std::vector<String>& attributePath, const String& message)
|
||||||
: m_Object(object), m_AttributePath(attributePath), m_Message(message)
|
: m_Object(object), m_AttributePath(attributePath), m_Message(message)
|
||||||
{
|
{
|
||||||
String path;
|
String path;
|
||||||
@ -344,7 +344,7 @@ const char *ValidationError::what(void) const throw()
|
|||||||
return m_What.CStr();
|
return m_What.CStr();
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicObject::Ptr ValidationError::GetObject(void) const
|
ConfigObject::Ptr ValidationError::GetObject(void) const
|
||||||
{
|
{
|
||||||
return m_Object;
|
return m_Object;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/debuginfo.hpp"
|
#include "base/debuginfo.hpp"
|
||||||
#include "base/dictionary.hpp"
|
#include "base/dictionary.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <boost/exception/errinfo_api_function.hpp>
|
#include <boost/exception/errinfo_api_function.hpp>
|
||||||
#include <boost/exception/errinfo_errno.hpp>
|
#include <boost/exception/errinfo_errno.hpp>
|
||||||
@ -72,12 +72,12 @@ private:
|
|||||||
class I2_BASE_API ValidationError : virtual public user_error
|
class I2_BASE_API ValidationError : virtual public user_error
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ValidationError(const DynamicObject::Ptr& object, const std::vector<String>& attributePath, const String& message);
|
ValidationError(const ConfigObject::Ptr& object, const std::vector<String>& attributePath, const String& message);
|
||||||
~ValidationError(void) throw();
|
~ValidationError(void) throw();
|
||||||
|
|
||||||
virtual const char *what(void) const throw();
|
virtual const char *what(void) const throw();
|
||||||
|
|
||||||
DynamicObject::Ptr GetObject(void) const;
|
ConfigObject::Ptr GetObject(void) const;
|
||||||
std::vector<String> GetAttributePath(void) const;
|
std::vector<String> GetAttributePath(void) const;
|
||||||
String GetMessage(void) const;
|
String GetMessage(void) const;
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public:
|
|||||||
Dictionary::Ptr GetDebugHint(void) const;
|
Dictionary::Ptr GetDebugHint(void) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DynamicObject::Ptr m_Object;
|
ConfigObject::Ptr m_Object;
|
||||||
std::vector<String> m_AttributePath;
|
std::vector<String> m_AttributePath;
|
||||||
String m_Message;
|
String m_Message;
|
||||||
String m_What;
|
String m_What;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "base/filelogger.hpp"
|
#include "base/filelogger.hpp"
|
||||||
#include "base/filelogger.tcpp"
|
#include "base/filelogger.tcpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -34,7 +34,7 @@ void FileLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const FileLogger::Ptr& filelogger, DynamicType::GetObjectsByType<FileLogger>()) {
|
BOOST_FOREACH(const FileLogger::Ptr& filelogger, ConfigType::GetObjectsByType<FileLogger>()) {
|
||||||
nodes->Set(filelogger->GetName(), 1); //add more stats
|
nodes->Set(filelogger->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "base/logger.tcpp"
|
#include "base/logger.tcpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/streamlogger.hpp"
|
#include "base/streamlogger.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
@ -54,7 +54,7 @@ void Logger::StaticInitialize(void)
|
|||||||
*/
|
*/
|
||||||
void Logger::Start(void)
|
void Logger::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
m_Loggers.insert(this);
|
m_Loggers.insert(this);
|
||||||
@ -67,7 +67,7 @@ void Logger::Stop(void)
|
|||||||
m_Loggers.erase(this);
|
m_Loggers.erase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicObject::Stop();
|
ConfigObject::Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<Logger::Ptr> Logger::GetLoggers(void)
|
std::set<Logger::Ptr> Logger::GetLoggers(void)
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
library base;
|
library base;
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
abstract class Logger : DynamicObject
|
abstract class Logger : ConfigObject
|
||||||
{
|
{
|
||||||
[config] String severity;
|
[config] String severity;
|
||||||
};
|
};
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
@ -251,7 +251,7 @@ Array::Ptr ScriptUtils::Keys(const Dictionary::Ptr& dict)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name)
|
ConfigObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name)
|
||||||
{
|
{
|
||||||
String typeName;
|
String typeName;
|
||||||
|
|
||||||
@ -260,24 +260,24 @@ DynamicObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name
|
|||||||
else
|
else
|
||||||
typeName = vtype;
|
typeName = vtype;
|
||||||
|
|
||||||
DynamicType::Ptr dtype = DynamicType::GetByName(typeName);
|
ConfigType::Ptr dtype = ConfigType::GetByName(typeName);
|
||||||
|
|
||||||
if (!dtype)
|
if (!dtype)
|
||||||
return DynamicObject::Ptr();
|
return ConfigObject::Ptr();
|
||||||
|
|
||||||
return dtype->GetObject(name);
|
return dtype->GetObject(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Array::Ptr ScriptUtils::GetObjects(const Type::Ptr& type)
|
Array::Ptr ScriptUtils::GetObjects(const Type::Ptr& type)
|
||||||
{
|
{
|
||||||
DynamicType::Ptr dtype = DynamicType::GetByName(type->GetName());
|
ConfigType::Ptr dtype = ConfigType::GetByName(type->GetName());
|
||||||
|
|
||||||
if (!dtype)
|
if (!dtype)
|
||||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type name"));
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type name"));
|
||||||
|
|
||||||
Array::Ptr result = new Array();
|
Array::Ptr result = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, dtype->GetObjects())
|
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects())
|
||||||
result->Add(object);
|
result->Add(object);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "base/array.hpp"
|
#include "base/array.hpp"
|
||||||
#include "base/dictionary.hpp"
|
#include "base/dictionary.hpp"
|
||||||
#include "base/type.hpp"
|
#include "base/type.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
static Array::Ptr Range(const std::vector<Value>& arguments);
|
static Array::Ptr Range(const std::vector<Value>& arguments);
|
||||||
static Type::Ptr TypeOf(const Value& value);
|
static Type::Ptr TypeOf(const Value& value);
|
||||||
static Array::Ptr Keys(const Dictionary::Ptr& dict);
|
static Array::Ptr Keys(const Dictionary::Ptr& dict);
|
||||||
static DynamicObject::Ptr GetObject(const Value& type, const String& name);
|
static ConfigObject::Ptr GetObject(const Value& type, const String& name);
|
||||||
static Array::Ptr GetObjects(const Type::Ptr& type);
|
static Array::Ptr GetObjects(const Type::Ptr& type);
|
||||||
static void Assert(const Value& arg);
|
static void Assert(const Value& arg);
|
||||||
static String MsiGetComponentPathShim(const String& component);
|
static String MsiGetComponentPathShim(const String& component);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/sysloglogger.hpp"
|
#include "base/sysloglogger.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -34,7 +34,7 @@ void SyslogLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, DynamicType::GetObjectsByType<SyslogLogger>()) {
|
BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, ConfigType::GetObjectsByType<SyslogLogger>()) {
|
||||||
nodes->Set(sysloglogger->GetName(), 1); //add more stats
|
nodes->Set(sysloglogger->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "icinga/cib.hpp"
|
#include "icinga/cib.hpp"
|
||||||
#include "icinga/perfdatavalue.hpp"
|
#include "icinga/perfdatavalue.hpp"
|
||||||
#include "remote/apilistener.hpp"
|
#include "remote/apilistener.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
@ -42,7 +42,7 @@ void CheckerComponent::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const CheckerComponent::Ptr& checker, DynamicType::GetObjectsByType<CheckerComponent>()) {
|
BOOST_FOREACH(const CheckerComponent::Ptr& checker, ConfigType::GetObjectsByType<CheckerComponent>()) {
|
||||||
unsigned long idle = checker->GetIdleCheckables();
|
unsigned long idle = checker->GetIdleCheckables();
|
||||||
unsigned long pending = checker->GetPendingCheckables();
|
unsigned long pending = checker->GetPendingCheckables();
|
||||||
|
|
||||||
@ -66,15 +66,15 @@ CheckerComponent::CheckerComponent(void)
|
|||||||
|
|
||||||
void CheckerComponent::OnConfigLoaded(void)
|
void CheckerComponent::OnConfigLoaded(void)
|
||||||
{
|
{
|
||||||
DynamicObject::OnActiveChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1));
|
ConfigObject::OnActiveChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1));
|
||||||
DynamicObject::OnPausedChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1));
|
ConfigObject::OnPausedChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1));
|
||||||
|
|
||||||
Checkable::OnNextCheckChanged.connect(bind(&CheckerComponent::NextCheckChangedHandler, this, _1));
|
Checkable::OnNextCheckChanged.connect(bind(&CheckerComponent::NextCheckChangedHandler, this, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckerComponent::Start(void)
|
void CheckerComponent::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
m_Thread = boost::thread(boost::bind(&CheckerComponent::CheckThreadProc, this));
|
m_Thread = boost::thread(boost::bind(&CheckerComponent::CheckThreadProc, this));
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ void CheckerComponent::Stop(void)
|
|||||||
m_ResultTimer->Stop();
|
m_ResultTimer->Stop();
|
||||||
m_Thread.join();
|
m_Thread.join();
|
||||||
|
|
||||||
DynamicObject::Stop();
|
ConfigObject::Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckerComponent::CheckThreadProc(void)
|
void CheckerComponent::CheckThreadProc(void)
|
||||||
@ -252,7 +252,7 @@ void CheckerComponent::ResultTimerHandler(void)
|
|||||||
Log(LogNotice, "CheckerComponent", msgbuf.str());
|
Log(LogNotice, "CheckerComponent", msgbuf.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckerComponent::ObjectHandler(const DynamicObject::Ptr& object)
|
void CheckerComponent::ObjectHandler(const ConfigObject::Ptr& object)
|
||||||
{
|
{
|
||||||
Checkable::Ptr checkable = dynamic_pointer_cast<Checkable>(object);
|
Checkable::Ptr checkable = dynamic_pointer_cast<Checkable>(object);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "checker/checkercomponent.thpp"
|
#include "checker/checkercomponent.thpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/timer.hpp"
|
#include "base/timer.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include <boost/thread/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
@ -96,7 +96,7 @@ private:
|
|||||||
|
|
||||||
void AdjustCheckTimer(void);
|
void AdjustCheckTimer(void);
|
||||||
|
|
||||||
void ObjectHandler(const DynamicObject::Ptr& object);
|
void ObjectHandler(const ConfigObject::Ptr& object);
|
||||||
void NextCheckChangedHandler(const Checkable::Ptr& checkable);
|
void NextCheckChangedHandler(const Checkable::Ptr& checkable);
|
||||||
|
|
||||||
void RescheduleCheckTimer(void);
|
void RescheduleCheckTimer(void);
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
library checker;
|
library checker;
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
class CheckerComponent : DynamicObject
|
class CheckerComponent : ConfigObject
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include "base/netstring.hpp"
|
#include "base/netstring.hpp"
|
||||||
#include "base/stdiostream.hpp"
|
#include "base/stdiostream.hpp"
|
||||||
|
@ -236,7 +236,7 @@ bool RepositoryUtility::AddObject(const std::vector<String>& object_paths, const
|
|||||||
Deserialize(object, attrs, false, FAConfig);
|
Deserialize(object, attrs, false, FAConfig);
|
||||||
|
|
||||||
RepositoryValidationUtils utils;
|
RepositoryValidationUtils utils;
|
||||||
static_pointer_cast<DynamicObject>(object)->Validate(FAConfig, utils);
|
static_pointer_cast<ConfigObject>(object)->Validate(FAConfig, utils);
|
||||||
} catch (const ScriptError& ex) {
|
} catch (const ScriptError& ex) {
|
||||||
Log(LogCritical, "config", DiagnosticInformation(ex));
|
Log(LogCritical, "config", DiagnosticInformation(ex));
|
||||||
return false;
|
return false;
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include "base/netstring.hpp"
|
#include "base/netstring.hpp"
|
||||||
#include "base/stdiostream.hpp"
|
#include "base/stdiostream.hpp"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/debug.hpp"
|
#include "base/debug.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/console.hpp"
|
#include "base/console.hpp"
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "icinga/pluginutility.hpp"
|
#include "icinga/pluginutility.hpp"
|
||||||
#include "icinga/icingaapplication.hpp"
|
#include "icinga/icingaapplication.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
@ -44,7 +44,7 @@ void CheckResultReader::StatsFunc(const Dictionary::Ptr& status, const Array::Pt
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, DynamicType::GetObjectsByType<CheckResultReader>()) {
|
BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, ConfigType::GetObjectsByType<CheckResultReader>()) {
|
||||||
nodes->Set(checkresultreader->GetName(), 1); //add more stats
|
nodes->Set(checkresultreader->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
|
|
||||||
library compat;
|
library compat;
|
||||||
@ -25,7 +25,7 @@ library compat;
|
|||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
class CheckResultReader : DynamicObject
|
class CheckResultReader : ConfigObject
|
||||||
{
|
{
|
||||||
[config] String spool_dir {
|
[config] String spool_dir {
|
||||||
default {{{ return Application::GetLocalStateDir() + "/lib/icinga2/spool/checkresults/"; }}}
|
default {{{ return Application::GetLocalStateDir() + "/lib/icinga2/spool/checkresults/"; }}}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "icinga/macroprocessor.hpp"
|
#include "icinga/macroprocessor.hpp"
|
||||||
#include "icinga/externalcommandprocessor.hpp"
|
#include "icinga/externalcommandprocessor.hpp"
|
||||||
#include "icinga/compatutility.hpp"
|
#include "icinga/compatutility.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
@ -47,7 +47,7 @@ void CompatLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, DynamicType::GetObjectsByType<CompatLogger>()) {
|
BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, ConfigType::GetObjectsByType<CompatLogger>()) {
|
||||||
nodes->Set(compat_logger->GetName(), 1); //add more stats
|
nodes->Set(compat_logger->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ void CompatLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
|||||||
*/
|
*/
|
||||||
void CompatLogger::Start(void)
|
void CompatLogger::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
Checkable::OnNewCheckResult.connect(bind(&CompatLogger::CheckResultHandler, this, _1, _2));
|
Checkable::OnNewCheckResult.connect(bind(&CompatLogger::CheckResultHandler, this, _1, _2));
|
||||||
Checkable::OnNotificationSentToUser.connect(bind(&CompatLogger::NotificationSentHandler, this, _1, _2, _3, _4, _5, _6, _7, _8));
|
Checkable::OnNotificationSentToUser.connect(bind(&CompatLogger::NotificationSentHandler, this, _1, _2, _3, _4, _5, _6, _7, _8));
|
||||||
@ -479,7 +479,7 @@ void CompatLogger::ReopenFile(bool rotate)
|
|||||||
WriteLine("LOG ROTATION: " + GetRotationMethod());
|
WriteLine("LOG ROTATION: " + GetRotationMethod());
|
||||||
WriteLine("LOG VERSION: 2.0");
|
WriteLine("LOG VERSION: 2.0");
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
String output;
|
String output;
|
||||||
CheckResult::Ptr cr = host->GetLastCheckResult();
|
CheckResult::Ptr cr = host->GetLastCheckResult();
|
||||||
|
|
||||||
@ -497,7 +497,7 @@ void CompatLogger::ReopenFile(bool rotate)
|
|||||||
WriteLine(msgbuf.str());
|
WriteLine(msgbuf.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
|
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
||||||
Host::Ptr host = service->GetHost();
|
Host::Ptr host = service->GetHost();
|
||||||
|
|
||||||
String output;
|
String output;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
|
|
||||||
library compat;
|
library compat;
|
||||||
@ -25,7 +25,7 @@ library compat;
|
|||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
class CompatLogger : DynamicObject
|
class CompatLogger : ConfigObject
|
||||||
{
|
{
|
||||||
[config] String log_dir {
|
[config] String log_dir {
|
||||||
default {{{ return Application::GetLocalStateDir() + "/log/icinga2/compat"; }}}
|
default {{{ return Application::GetLocalStateDir() + "/log/icinga2/compat"; }}}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "compat/externalcommandlistener.hpp"
|
#include "compat/externalcommandlistener.hpp"
|
||||||
#include "compat/externalcommandlistener.tcpp"
|
#include "compat/externalcommandlistener.tcpp"
|
||||||
#include "icinga/externalcommandprocessor.hpp"
|
#include "icinga/externalcommandprocessor.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
@ -36,7 +36,7 @@ void ExternalCommandListener::StatsFunc(const Dictionary::Ptr& status, const Arr
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, DynamicType::GetObjectsByType<ExternalCommandListener>()) {
|
BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, ConfigType::GetObjectsByType<ExternalCommandListener>()) {
|
||||||
nodes->Set(externalcommandlistener->GetName(), 1); //add more stats
|
nodes->Set(externalcommandlistener->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ void ExternalCommandListener::StatsFunc(const Dictionary::Ptr& status, const Arr
|
|||||||
*/
|
*/
|
||||||
void ExternalCommandListener::Start(void)
|
void ExternalCommandListener::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
m_CommandThread = boost::thread(boost::bind(&ExternalCommandListener::CommandPipeThread, this, GetCommandPath()));
|
m_CommandThread = boost::thread(boost::bind(&ExternalCommandListener::CommandPipeThread, this, GetCommandPath()));
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
|
|
||||||
library compat;
|
library compat;
|
||||||
@ -25,7 +25,7 @@ library compat;
|
|||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
class ExternalCommandListener : DynamicObject
|
class ExternalCommandListener : ConfigObject
|
||||||
{
|
{
|
||||||
[config] String command_path {
|
[config] String command_path {
|
||||||
default {{{ return Application::GetRunDir() + "/icinga2/cmd/icinga2.cmd"; }}}
|
default {{{ return Application::GetRunDir() + "/icinga2/cmd/icinga2.cmd"; }}}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "icinga/notificationcommand.hpp"
|
#include "icinga/notificationcommand.hpp"
|
||||||
#include "icinga/compatutility.hpp"
|
#include "icinga/compatutility.hpp"
|
||||||
#include "icinga/dependency.hpp"
|
#include "icinga/dependency.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
@ -54,7 +54,7 @@ void StatusDataWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, DynamicType::GetObjectsByType<StatusDataWriter>()) {
|
BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, ConfigType::GetObjectsByType<StatusDataWriter>()) {
|
||||||
nodes->Set(statusdatawriter->GetName(), 1); //add more stats
|
nodes->Set(statusdatawriter->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ void StatusDataWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr
|
|||||||
*/
|
*/
|
||||||
void StatusDataWriter::Start(void)
|
void StatusDataWriter::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
m_StatusTimer = new Timer();
|
m_StatusTimer = new Timer();
|
||||||
m_StatusTimer->SetInterval(GetUpdateInterval());
|
m_StatusTimer->SetInterval(GetUpdateInterval());
|
||||||
@ -556,7 +556,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
"# This file is auto-generated. Do not modify this file." "\n"
|
"# This file is auto-generated. Do not modify this file." "\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
DumpHostObject(tempobjectfp, host);
|
DumpHostObject(tempobjectfp, host);
|
||||||
@ -570,7 +570,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType<HostGroup>()) {
|
BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType<HostGroup>()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
objectfp << tempobjectfp.str();
|
objectfp << tempobjectfp.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType<ServiceGroup>()) {
|
BOOST_FOREACH(const ServiceGroup::Ptr& sg, ConfigType::GetObjectsByType<ServiceGroup>()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
|
|
||||||
@ -642,7 +642,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
objectfp << tempobjectfp.str();
|
objectfp << tempobjectfp.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType<User>()) {
|
BOOST_FOREACH(const User::Ptr& user, ConfigType::GetObjectsByType<User>()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
|
|
||||||
@ -670,7 +670,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
objectfp << tempobjectfp.str();
|
objectfp << tempobjectfp.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType<UserGroup>()) {
|
BOOST_FOREACH(const UserGroup::Ptr& ug, ConfigType::GetObjectsByType<UserGroup>()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
|
|
||||||
@ -686,23 +686,23 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
objectfp << tempobjectfp.str();
|
objectfp << tempobjectfp.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<CheckCommand>()) {
|
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<CheckCommand>()) {
|
||||||
DumpCommand(objectfp, command);
|
DumpCommand(objectfp, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<NotificationCommand>()) {
|
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<NotificationCommand>()) {
|
||||||
DumpCommand(objectfp, command);
|
DumpCommand(objectfp, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<EventCommand>()) {
|
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<EventCommand>()) {
|
||||||
DumpCommand(objectfp, command);
|
DumpCommand(objectfp, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType<TimePeriod>()) {
|
BOOST_FOREACH(const TimePeriod::Ptr& tp, ConfigType::GetObjectsByType<TimePeriod>()) {
|
||||||
DumpTimePeriod(objectfp, tp);
|
DumpTimePeriod(objectfp, tp);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjectsByType<Dependency>()) {
|
BOOST_FOREACH(const Dependency::Ptr& dep, ConfigType::GetObjectsByType<Dependency>()) {
|
||||||
Checkable::Ptr parent = dep->GetParent();
|
Checkable::Ptr parent = dep->GetParent();
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
@ -829,7 +829,7 @@ void StatusDataWriter::StatusTimerHandler(void)
|
|||||||
statusfp << "\t" "}" "\n"
|
statusfp << "\t" "}" "\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
std::ostringstream tempstatusfp;
|
std::ostringstream tempstatusfp;
|
||||||
tempstatusfp << std::fixed;
|
tempstatusfp << std::fixed;
|
||||||
DumpHostStatus(tempstatusfp, host);
|
DumpHostStatus(tempstatusfp, host);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
|
|
||||||
library compat;
|
library compat;
|
||||||
@ -25,7 +25,7 @@ library compat;
|
|||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
class StatusDataWriter : DynamicObject
|
class StatusDataWriter : ConfigObject
|
||||||
{
|
{
|
||||||
[config] String status_path {
|
[config] String status_path {
|
||||||
default {{{ return Application::GetLocalStateDir() + "/cache/icinga2/status.dat"; }}}
|
default {{{ return Application::GetLocalStateDir() + "/cache/icinga2/status.dat"; }}}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "base/value.hpp"
|
#include "base/value.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "config/applyrule.hpp"
|
#include "config/applyrule.hpp"
|
||||||
#include "config/objectrule.hpp"
|
#include "config/objectrule.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
@ -144,12 +144,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commits the configuration item by creating a DynamicObject
|
* Commits the configuration item by creating a ConfigObject
|
||||||
* object.
|
* object.
|
||||||
*
|
*
|
||||||
* @returns The DynamicObject that was created/updated.
|
* @returns The ConfigObject that was created/updated.
|
||||||
*/
|
*/
|
||||||
DynamicObject::Ptr ConfigItem::Commit(bool discard)
|
ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
||||||
{
|
{
|
||||||
ASSERT(!OwnsLock());
|
ASSERT(!OwnsLock());
|
||||||
|
|
||||||
@ -160,12 +160,12 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard)
|
|||||||
|
|
||||||
/* Make sure the type is valid. */
|
/* Make sure the type is valid. */
|
||||||
Type::Ptr type = Type::GetByName(GetType());
|
Type::Ptr type = Type::GetByName(GetType());
|
||||||
ASSERT(type && DynamicObject::TypeInstance->IsAssignableFrom(type));
|
ASSERT(type && ConfigObject::TypeInstance->IsAssignableFrom(type));
|
||||||
|
|
||||||
if (IsAbstract())
|
if (IsAbstract())
|
||||||
return DynamicObject::Ptr();
|
return ConfigObject::Ptr();
|
||||||
|
|
||||||
DynamicObject::Ptr dobj = static_pointer_cast<DynamicObject>(type->Instantiate());
|
ConfigObject::Ptr dobj = static_pointer_cast<ConfigObject>(type->Instantiate());
|
||||||
|
|
||||||
dobj->SetDebugInfo(m_DebugInfo);
|
dobj->SetDebugInfo(m_DebugInfo);
|
||||||
dobj->SetTypeNameV(m_Type);
|
dobj->SetTypeNameV(m_Type);
|
||||||
@ -374,7 +374,7 @@ bool ConfigItem::CommitNewItems(WorkQueue& upq, std::vector<ConfigItem::Ptr>& ne
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Type::Ptr& type, all_types) {
|
BOOST_FOREACH(const Type::Ptr& type, all_types) {
|
||||||
if (DynamicObject::TypeInstance->IsAssignableFrom(type))
|
if (ConfigObject::TypeInstance->IsAssignableFrom(type))
|
||||||
types.insert(type->GetName());
|
types.insert(type->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ bool ConfigItem::CommitNewItems(WorkQueue& upq, std::vector<ConfigItem::Ptr>& ne
|
|||||||
|
|
||||||
BOOST_FOREACH(const ConfigItem::Ptr& item, new_items) {
|
BOOST_FOREACH(const ConfigItem::Ptr& item, new_items) {
|
||||||
if (item->m_Type == type)
|
if (item->m_Type == type)
|
||||||
upq.Enqueue(boost::bind(&DynamicObject::OnAllConfigLoaded, item->m_Object));
|
upq.Enqueue(boost::bind(&ConfigObject::OnAllConfigLoaded, item->m_Object));
|
||||||
}
|
}
|
||||||
|
|
||||||
completed_types.insert(type);
|
completed_types.insert(type);
|
||||||
@ -414,7 +414,7 @@ bool ConfigItem::CommitNewItems(WorkQueue& upq, std::vector<ConfigItem::Ptr>& ne
|
|||||||
BOOST_FOREACH(const String& loadDep, ptype->GetLoadDependencies()) {
|
BOOST_FOREACH(const String& loadDep, ptype->GetLoadDependencies()) {
|
||||||
BOOST_FOREACH(const ConfigItem::Ptr& item, new_items) {
|
BOOST_FOREACH(const ConfigItem::Ptr& item, new_items) {
|
||||||
if (item->m_Type == loadDep)
|
if (item->m_Type == loadDep)
|
||||||
upq.Enqueue(boost::bind(&DynamicObject::CreateChildObjects, item->m_Object, ptype));
|
upq.Enqueue(boost::bind(&ConfigObject::CreateChildObjects, item->m_Object, ptype));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, bool restoreState)
|
|||||||
if (restoreState) {
|
if (restoreState) {
|
||||||
/* restore the previous program state */
|
/* restore the previous program state */
|
||||||
try {
|
try {
|
||||||
DynamicObject::RestoreObjects(Application::GetStatePath());
|
ConfigObject::RestoreObjects(Application::GetStatePath());
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
Log(LogCritical, "ConfigItem")
|
Log(LogCritical, "ConfigItem")
|
||||||
<< "Failed to restore state file: " << DiagnosticInformation(ex);
|
<< "Failed to restore state file: " << DiagnosticInformation(ex);
|
||||||
@ -478,8 +478,8 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, bool restoreState)
|
|||||||
|
|
||||||
Log(LogInformation, "ConfigItem", "Triggering Start signal for config items");
|
Log(LogInformation, "ConfigItem", "Triggering Start signal for config items");
|
||||||
|
|
||||||
BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
|
BOOST_FOREACH(const ConfigType::Ptr& type, ConfigType::GetTypes()) {
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) {
|
BOOST_FOREACH(const ConfigObject::Ptr& object, type->GetObjects()) {
|
||||||
if (object->IsActive())
|
if (object->IsActive())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, bool restoreState)
|
|||||||
Log(LogDebug, "ConfigItem")
|
Log(LogDebug, "ConfigItem")
|
||||||
<< "Activating object '" << object->GetName() << "' of type '" << object->GetType()->GetName() << "'";
|
<< "Activating object '" << object->GetName() << "' of type '" << object->GetType()->GetName() << "'";
|
||||||
#endif /* I2_DEBUG */
|
#endif /* I2_DEBUG */
|
||||||
upq.Enqueue(boost::bind(&DynamicObject::Activate, object));
|
upq.Enqueue(boost::bind(&ConfigObject::Activate, object));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,8 +499,8 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, bool restoreState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_DEBUG
|
||||||
BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
|
BOOST_FOREACH(const ConfigType::Ptr& type, ConfigType::GetTypes()) {
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) {
|
BOOST_FOREACH(const ConfigObject::Ptr& object, type->GetObjects()) {
|
||||||
ASSERT(object->IsActive());
|
ASSERT(object->IsActive());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "config/i2-config.hpp"
|
#include "config/i2-config.hpp"
|
||||||
#include "config/expression.hpp"
|
#include "config/expression.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/workqueue.hpp"
|
#include "base/workqueue.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
@ -53,7 +53,7 @@ public:
|
|||||||
boost::shared_ptr<Expression> GetExpression(void) const;
|
boost::shared_ptr<Expression> GetExpression(void) const;
|
||||||
boost::shared_ptr<Expression> GetFilter(void) const;
|
boost::shared_ptr<Expression> GetFilter(void) const;
|
||||||
|
|
||||||
DynamicObject::Ptr Commit(bool discard = true);
|
ConfigObject::Ptr Commit(bool discard = true);
|
||||||
void Register(void);
|
void Register(void);
|
||||||
void Unregister(void);
|
void Unregister(void);
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ private:
|
|||||||
Dictionary::Ptr m_Scope; /**< variable scope. */
|
Dictionary::Ptr m_Scope; /**< variable scope. */
|
||||||
String m_Zone; /**< The zone. */
|
String m_Zone; /**< The zone. */
|
||||||
|
|
||||||
DynamicObject::Ptr m_Object;
|
ConfigObject::Ptr m_Object;
|
||||||
|
|
||||||
static boost::mutex m_Mutex;
|
static boost::mutex m_Mutex;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "config/configitembuilder.hpp"
|
#include "config/configitembuilder.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/smart_ptr/make_shared.hpp>
|
#include <boost/smart_ptr/make_shared.hpp>
|
||||||
@ -83,7 +83,7 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void)
|
|||||||
BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), m_DebugInfo));
|
BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), m_DebugInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DynamicType::GetByName(m_Type)) {
|
if (!ConfigType::GetByName(m_Type)) {
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
msgbuf << "The type '" + m_Type + "' is unknown";
|
msgbuf << "The type '" + m_Type + "' is unknown";
|
||||||
BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), m_DebugInfo));
|
BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), m_DebugInfo));
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define COMMANDDBOBJECT_H
|
#define COMMANDDBOBJECT_H
|
||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "icinga/icingaapplication.hpp"
|
#include "icinga/icingaapplication.hpp"
|
||||||
#include "icinga/host.hpp"
|
#include "icinga/host.hpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
@ -44,7 +44,7 @@ DbConnection::DbConnection(void)
|
|||||||
|
|
||||||
void DbConnection::OnConfigLoaded(void)
|
void DbConnection::OnConfigLoaded(void)
|
||||||
{
|
{
|
||||||
DynamicObject::OnConfigLoaded();
|
ConfigObject::OnConfigLoaded();
|
||||||
|
|
||||||
if (!GetEnableHa()) {
|
if (!GetEnableHa()) {
|
||||||
Log(LogDebug, "DbConnection")
|
Log(LogDebug, "DbConnection")
|
||||||
@ -58,15 +58,15 @@ void DbConnection::OnConfigLoaded(void)
|
|||||||
|
|
||||||
void DbConnection::Start(void)
|
void DbConnection::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
DbObject::OnQuery.connect(boost::bind(&DbConnection::ExecuteQuery, this, _1));
|
DbObject::OnQuery.connect(boost::bind(&DbConnection::ExecuteQuery, this, _1));
|
||||||
DynamicObject::OnActiveChanged.connect(boost::bind(&DbConnection::UpdateObject, this, _1));
|
ConfigObject::OnActiveChanged.connect(boost::bind(&DbConnection::UpdateObject, this, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbConnection::Resume(void)
|
void DbConnection::Resume(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Resume();
|
ConfigObject::Resume();
|
||||||
|
|
||||||
Log(LogInformation, "DbConnection")
|
Log(LogInformation, "DbConnection")
|
||||||
<< "Resuming IDO connection: " << GetName();
|
<< "Resuming IDO connection: " << GetName();
|
||||||
@ -79,7 +79,7 @@ void DbConnection::Resume(void)
|
|||||||
|
|
||||||
void DbConnection::Pause(void)
|
void DbConnection::Pause(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Pause();
|
ConfigObject::Pause();
|
||||||
|
|
||||||
Log(LogInformation, "DbConnection")
|
Log(LogInformation, "DbConnection")
|
||||||
<< "Pausing IDO connection: " << GetName();
|
<< "Pausing IDO connection: " << GetName();
|
||||||
@ -167,10 +167,10 @@ void DbConnection::ProgramStatusHandler(void)
|
|||||||
query3.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
query3.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||||
DbObject::OnQuery(query3);
|
DbObject::OnQuery(query3);
|
||||||
|
|
||||||
InsertRuntimeVariable("total_services", std::distance(DynamicType::GetObjectsByType<Service>().first, DynamicType::GetObjectsByType<Service>().second));
|
InsertRuntimeVariable("total_services", std::distance(ConfigType::GetObjectsByType<Service>().first, ConfigType::GetObjectsByType<Service>().second));
|
||||||
InsertRuntimeVariable("total_scheduled_services", std::distance(DynamicType::GetObjectsByType<Service>().first, DynamicType::GetObjectsByType<Service>().second));
|
InsertRuntimeVariable("total_scheduled_services", std::distance(ConfigType::GetObjectsByType<Service>().first, ConfigType::GetObjectsByType<Service>().second));
|
||||||
InsertRuntimeVariable("total_hosts", std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second));
|
InsertRuntimeVariable("total_hosts", std::distance(ConfigType::GetObjectsByType<Host>().first, ConfigType::GetObjectsByType<Host>().second));
|
||||||
InsertRuntimeVariable("total_scheduled_hosts", std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second));
|
InsertRuntimeVariable("total_scheduled_hosts", std::distance(ConfigType::GetObjectsByType<Host>().first, ConfigType::GetObjectsByType<Host>().second));
|
||||||
|
|
||||||
Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars();
|
Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars();
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ void DbConnection::ExecuteQuery(const DbQuery&)
|
|||||||
/* Default handler does nothing. */
|
/* Default handler does nothing. */
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbConnection::UpdateObject(const DynamicObject::Ptr& object)
|
void DbConnection::UpdateObject(const ConfigObject::Ptr& object)
|
||||||
{
|
{
|
||||||
if (!GetConnected())
|
if (!GetConnected())
|
||||||
return;
|
return;
|
||||||
@ -400,9 +400,9 @@ void DbConnection::UpdateObject(const DynamicObject::Ptr& object)
|
|||||||
|
|
||||||
void DbConnection::UpdateAllObjects(void)
|
void DbConnection::UpdateAllObjects(void)
|
||||||
{
|
{
|
||||||
DynamicType::Ptr type;
|
ConfigType::Ptr type;
|
||||||
BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) {
|
BOOST_FOREACH(const ConfigType::Ptr& dt, ConfigType::GetTypes()) {
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) {
|
BOOST_FOREACH(const ConfigObject::Ptr& object, dt->GetObjects()) {
|
||||||
UpdateObject(object);
|
UpdateObject(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ protected:
|
|||||||
virtual void FillIDCache(const DbType::Ptr& type) = 0;
|
virtual void FillIDCache(const DbType::Ptr& type) = 0;
|
||||||
virtual void NewTransaction(void) = 0;
|
virtual void NewTransaction(void) = 0;
|
||||||
|
|
||||||
void UpdateObject(const DynamicObject::Ptr& object);
|
void UpdateObject(const ConfigObject::Ptr& object);
|
||||||
void UpdateAllObjects(void);
|
void UpdateAllObjects(void);
|
||||||
|
|
||||||
void PrepareDatabase(void);
|
void PrepareDatabase(void);
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "db_ido/dbquery.hpp"
|
#include "db_ido/dbquery.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
library db_ido;
|
library db_ido;
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
abstract class DbConnection : DynamicObject
|
abstract class DbConnection : ConfigObject
|
||||||
{
|
{
|
||||||
[config] String table_prefix {
|
[config] String table_prefix {
|
||||||
default {{{ return "icinga_"; }}}
|
default {{{ return "icinga_"; }}}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "remote/endpoint.hpp"
|
#include "remote/endpoint.hpp"
|
||||||
@ -340,7 +340,7 @@ void DbEvents::AddCommentInternal(const Checkable::Ptr& checkable, const Comment
|
|||||||
AddCommentByType(checkable, comment, historical);
|
AddCommentByType(checkable, comment, historical);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbEvents::AddCommentByType(const DynamicObject::Ptr& object, const Comment::Ptr& comment, bool historical)
|
void DbEvents::AddCommentByType(const ConfigObject::Ptr& object, const Comment::Ptr& comment, bool historical)
|
||||||
{
|
{
|
||||||
unsigned long entry_time = static_cast<long>(comment->GetEntryTime());
|
unsigned long entry_time = static_cast<long>(comment->GetEntryTime());
|
||||||
unsigned long entry_time_usec = (comment->GetEntryTime() - entry_time) * 1000 * 1000;
|
unsigned long entry_time_usec = (comment->GetEntryTime() - entry_time) * 1000 * 1000;
|
||||||
@ -351,11 +351,11 @@ void DbEvents::AddCommentByType(const DynamicObject::Ptr& object, const Comment:
|
|||||||
fields1->Set("entry_type", comment->GetEntryType());
|
fields1->Set("entry_type", comment->GetEntryType());
|
||||||
fields1->Set("object_id", object);
|
fields1->Set("object_id", object);
|
||||||
|
|
||||||
if (object->GetType() == DynamicType::GetByName("Host")) {
|
if (object->GetType() == ConfigType::GetByName("Host")) {
|
||||||
fields1->Set("comment_type", 2);
|
fields1->Set("comment_type", 2);
|
||||||
/* requires idoutils 1.10 schema fix */
|
/* requires idoutils 1.10 schema fix */
|
||||||
fields1->Set("internal_comment_id", comment->GetLegacyId());
|
fields1->Set("internal_comment_id", comment->GetLegacyId());
|
||||||
} else if (object->GetType() == DynamicType::GetByName("Service")) {
|
} else if (object->GetType() == ConfigType::GetByName("Service")) {
|
||||||
fields1->Set("comment_type", 1);
|
fields1->Set("comment_type", 1);
|
||||||
fields1->Set("internal_comment_id", comment->GetLegacyId());
|
fields1->Set("internal_comment_id", comment->GetLegacyId());
|
||||||
} else {
|
} else {
|
||||||
@ -500,11 +500,11 @@ void DbEvents::AddDowntimeByType(const Checkable::Ptr& checkable, const Downtime
|
|||||||
fields1->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime()));
|
fields1->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime()));
|
||||||
fields1->Set("object_id", checkable);
|
fields1->Set("object_id", checkable);
|
||||||
|
|
||||||
if (checkable->GetType() == DynamicType::GetByName("Host")) {
|
if (checkable->GetType() == ConfigType::GetByName("Host")) {
|
||||||
fields1->Set("downtime_type", 2);
|
fields1->Set("downtime_type", 2);
|
||||||
/* requires idoutils 1.10 schema fix */
|
/* requires idoutils 1.10 schema fix */
|
||||||
fields1->Set("internal_downtime_id", downtime->GetLegacyId());
|
fields1->Set("internal_downtime_id", downtime->GetLegacyId());
|
||||||
} else if (checkable->GetType() == DynamicType::GetByName("Service")) {
|
} else if (checkable->GetType() == ConfigType::GetByName("Service")) {
|
||||||
fields1->Set("downtime_type", 1);
|
fields1->Set("downtime_type", 1);
|
||||||
fields1->Set("internal_downtime_id", downtime->GetLegacyId());
|
fields1->Set("internal_downtime_id", downtime->GetLegacyId());
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define DBEVENTS_H
|
#define DBEVENTS_H
|
||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
@ -61,7 +61,7 @@ class DbEvents
|
|||||||
public:
|
public:
|
||||||
static void StaticInitialize(void);
|
static void StaticInitialize(void);
|
||||||
|
|
||||||
static void AddCommentByType(const DynamicObject::Ptr& object, const Comment::Ptr& comment, bool historical);
|
static void AddCommentByType(const ConfigObject::Ptr& object, const Comment::Ptr& comment, bool historical);
|
||||||
static void AddComments(const Checkable::Ptr& checkable);
|
static void AddComments(const Checkable::Ptr& checkable);
|
||||||
static void RemoveComments(const Checkable::Ptr& checkable);
|
static void RemoveComments(const Checkable::Ptr& checkable);
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "icinga/compatutility.hpp"
|
#include "icinga/compatutility.hpp"
|
||||||
#include "remote/endpoint.hpp"
|
#include "remote/endpoint.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
@ -47,16 +47,16 @@ DbObject::DbObject(const intrusive_ptr<DbType>& type, const String& name1, const
|
|||||||
void DbObject::StaticInitialize(void)
|
void DbObject::StaticInitialize(void)
|
||||||
{
|
{
|
||||||
/* triggered in ProcessCheckResult(), requires UpdateNextCheck() to be called before */
|
/* triggered in ProcessCheckResult(), requires UpdateNextCheck() to be called before */
|
||||||
DynamicObject::OnStateChanged.connect(boost::bind(&DbObject::StateChangedHandler, _1));
|
ConfigObject::OnStateChanged.connect(boost::bind(&DbObject::StateChangedHandler, _1));
|
||||||
CustomVarObject::OnVarsChanged.connect(boost::bind(&DbObject::VarsChangedHandler, _1));
|
CustomVarObject::OnVarsChanged.connect(boost::bind(&DbObject::VarsChangedHandler, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbObject::SetObject(const DynamicObject::Ptr& object)
|
void DbObject::SetObject(const ConfigObject::Ptr& object)
|
||||||
{
|
{
|
||||||
m_Object = object;
|
m_Object = object;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicObject::Ptr DbObject::GetObject(void) const
|
ConfigObject::Ptr DbObject::GetObject(void) const
|
||||||
{
|
{
|
||||||
return m_Object;
|
return m_Object;
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ void DbObject::SendStatusUpdate(void)
|
|||||||
|
|
||||||
void DbObject::SendVarsConfigUpdate(void)
|
void DbObject::SendVarsConfigUpdate(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Ptr obj = GetObject();
|
ConfigObject::Ptr obj = GetObject();
|
||||||
|
|
||||||
CustomVarObject::Ptr custom_var_object = dynamic_pointer_cast<CustomVarObject>(obj);
|
CustomVarObject::Ptr custom_var_object = dynamic_pointer_cast<CustomVarObject>(obj);
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ void DbObject::SendVarsConfigUpdate(void)
|
|||||||
|
|
||||||
void DbObject::SendVarsStatusUpdate(void)
|
void DbObject::SendVarsStatusUpdate(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Ptr obj = GetObject();
|
ConfigObject::Ptr obj = GetObject();
|
||||||
|
|
||||||
CustomVarObject::Ptr custom_var_object = dynamic_pointer_cast<CustomVarObject>(obj);
|
CustomVarObject::Ptr custom_var_object = dynamic_pointer_cast<CustomVarObject>(obj);
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ void DbObject::OnStatusUpdate(void)
|
|||||||
/* Default handler does nothing. */
|
/* Default handler does nothing. */
|
||||||
}
|
}
|
||||||
|
|
||||||
DbObject::Ptr DbObject::GetOrCreateByObject(const DynamicObject::Ptr& object)
|
DbObject::Ptr DbObject::GetOrCreateByObject(const ConfigObject::Ptr& object)
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||||
|
|
||||||
@ -314,9 +314,9 @@ DbObject::Ptr DbObject::GetOrCreateByObject(const DynamicObject::Ptr& object)
|
|||||||
name1 = service->GetHost()->GetName();
|
name1 = service->GetHost()->GetName();
|
||||||
name2 = service->GetShortName();
|
name2 = service->GetShortName();
|
||||||
} else {
|
} else {
|
||||||
if (object->GetType() == DynamicType::GetByName("CheckCommand") ||
|
if (object->GetType() == ConfigType::GetByName("CheckCommand") ||
|
||||||
object->GetType() == DynamicType::GetByName("EventCommand") ||
|
object->GetType() == ConfigType::GetByName("EventCommand") ||
|
||||||
object->GetType() == DynamicType::GetByName("NotificationCommand")) {
|
object->GetType() == ConfigType::GetByName("NotificationCommand")) {
|
||||||
Command::Ptr command = dynamic_pointer_cast<Command>(object);
|
Command::Ptr command = dynamic_pointer_cast<Command>(object);
|
||||||
name1 = CompatUtility::GetCommandName(command);
|
name1 = CompatUtility::GetCommandName(command);
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ DbObject::Ptr DbObject::GetOrCreateByObject(const DynamicObject::Ptr& object)
|
|||||||
return dbobj;
|
return dbobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbObject::StateChangedHandler(const DynamicObject::Ptr& object)
|
void DbObject::StateChangedHandler(const ConfigObject::Ptr& object)
|
||||||
{
|
{
|
||||||
DbObject::Ptr dbobj = GetOrCreateByObject(object);
|
DbObject::Ptr dbobj = GetOrCreateByObject(object);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "db_ido/dbquery.hpp"
|
#include "db_ido/dbquery.hpp"
|
||||||
#include "db_ido/dbtype.hpp"
|
#include "db_ido/dbtype.hpp"
|
||||||
#include "icinga/customvarobject.hpp"
|
#include "icinga/customvarobject.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
@ -66,8 +66,8 @@ public:
|
|||||||
|
|
||||||
static void StaticInitialize(void);
|
static void StaticInitialize(void);
|
||||||
|
|
||||||
void SetObject(const DynamicObject::Ptr& object);
|
void SetObject(const ConfigObject::Ptr& object);
|
||||||
DynamicObject::Ptr GetObject(void) const;
|
ConfigObject::Ptr GetObject(void) const;
|
||||||
|
|
||||||
String GetName1(void) const;
|
String GetName1(void) const;
|
||||||
String GetName2(void) const;
|
String GetName2(void) const;
|
||||||
@ -76,7 +76,7 @@ public:
|
|||||||
virtual Dictionary::Ptr GetConfigFields(void) const = 0;
|
virtual Dictionary::Ptr GetConfigFields(void) const = 0;
|
||||||
virtual Dictionary::Ptr GetStatusFields(void) const = 0;
|
virtual Dictionary::Ptr GetStatusFields(void) const = 0;
|
||||||
|
|
||||||
static DbObject::Ptr GetOrCreateByObject(const DynamicObject::Ptr& object);
|
static DbObject::Ptr GetOrCreateByObject(const ConfigObject::Ptr& object);
|
||||||
|
|
||||||
static boost::signals2::signal<void (const DbQuery&)> OnQuery;
|
static boost::signals2::signal<void (const DbQuery&)> OnQuery;
|
||||||
|
|
||||||
@ -100,11 +100,11 @@ private:
|
|||||||
String m_Name1;
|
String m_Name1;
|
||||||
String m_Name2;
|
String m_Name2;
|
||||||
intrusive_ptr<DbType> m_Type;
|
intrusive_ptr<DbType> m_Type;
|
||||||
DynamicObject::Ptr m_Object;
|
ConfigObject::Ptr m_Object;
|
||||||
double m_LastConfigUpdate;
|
double m_LastConfigUpdate;
|
||||||
double m_LastStatusUpdate;
|
double m_LastStatusUpdate;
|
||||||
|
|
||||||
static void StateChangedHandler(const DynamicObject::Ptr& object);
|
static void StateChangedHandler(const ConfigObject::Ptr& object);
|
||||||
static void VarsChangedHandler(const CustomVarObject::Ptr& object);
|
static void VarsChangedHandler(const CustomVarObject::Ptr& object);
|
||||||
static boost::mutex& GetStaticMutex(void);
|
static boost::mutex& GetStaticMutex(void);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "db_ido/i2-db_ido.hpp"
|
#include "db_ido/i2-db_ido.hpp"
|
||||||
#include "icinga/customvarobject.hpp"
|
#include "icinga/customvarobject.hpp"
|
||||||
#include "base/dictionary.hpp"
|
#include "base/dictionary.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "icinga/icingaapplication.hpp"
|
#include "icinga/icingaapplication.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define ENDPOINTDBOBJECT_H
|
#define ENDPOINTDBOBJECT_H
|
||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "remote/endpoint.hpp"
|
#include "remote/endpoint.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define HOSTDBOBJECT_H
|
#define HOSTDBOBJECT_H
|
||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "db_ido/dbvalue.hpp"
|
#include "db_ido/dbvalue.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "icinga/hostgroup.hpp"
|
#include "icinga/hostgroup.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "remote/zone.hpp"
|
#include "remote/zone.hpp"
|
||||||
#include "base/function.hpp"
|
#include "base/function.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicType::Ptr dtype = DynamicType::GetByName(idoType);
|
ConfigType::Ptr dtype = ConfigType::GetByName(idoType);
|
||||||
VERIFY(dtype);
|
VERIFY(dtype);
|
||||||
|
|
||||||
DbConnection::Ptr conn = static_pointer_cast<DbConnection>(dtype->GetObject(idoName));
|
DbConnection::Ptr conn = static_pointer_cast<DbConnection>(dtype->GetObject(idoName));
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define SERVICEDBOBJECT_H
|
#define SERVICEDBOBJECT_H
|
||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "icinga/servicegroup.hpp"
|
#include "icinga/servicegroup.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define TIMEPERIODDBOBJECT_H
|
#define TIMEPERIODDBOBJECT_H
|
||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define USERDBOBJECT_H
|
#define USERDBOBJECT_H
|
||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "db_ido/dbvalue.hpp"
|
#include "db_ido/dbvalue.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "icinga/usergroup.hpp"
|
#include "icinga/usergroup.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define ZONEDBOBJECT_H
|
#define ZONEDBOBJECT_H
|
||||||
|
|
||||||
#include "db_ido/dbobject.hpp"
|
#include "db_ido/dbobject.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "remote/zone.hpp"
|
#include "remote/zone.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
@ -47,7 +47,7 @@ void IdoMysqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::P
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, DynamicType::GetObjectsByType<IdoMysqlConnection>()) {
|
BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, ConfigType::GetObjectsByType<IdoMysqlConnection>()) {
|
||||||
size_t items = idomysqlconnection->m_QueryQueue.GetLength();
|
size_t items = idomysqlconnection->m_QueryQueue.GetLength();
|
||||||
|
|
||||||
Dictionary::Ptr stats = new Dictionary();
|
Dictionary::Ptr stats = new Dictionary();
|
||||||
@ -672,7 +672,7 @@ bool IdoMysqlConnection::FieldToEscapedString(const String& key, const Value& va
|
|||||||
|
|
||||||
Value rawvalue = DbValue::ExtractValue(value);
|
Value rawvalue = DbValue::ExtractValue(value);
|
||||||
|
|
||||||
if (rawvalue.IsObjectType<DynamicObject>()) {
|
if (rawvalue.IsObjectType<ConfigObject>()) {
|
||||||
DbObject::Ptr dbobjcol = DbObject::GetOrCreateByObject(rawvalue);
|
DbObject::Ptr dbobjcol = DbObject::GetOrCreateByObject(rawvalue);
|
||||||
|
|
||||||
if (!dbobjcol) {
|
if (!dbobjcol) {
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
@ -48,7 +48,7 @@ void IdoPgsqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::P
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, DynamicType::GetObjectsByType<IdoPgsqlConnection>()) {
|
BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, ConfigType::GetObjectsByType<IdoPgsqlConnection>()) {
|
||||||
size_t items = idopgsqlconnection->m_QueryQueue.GetLength();
|
size_t items = idopgsqlconnection->m_QueryQueue.GetLength();
|
||||||
|
|
||||||
Dictionary::Ptr stats = new Dictionary();
|
Dictionary::Ptr stats = new Dictionary();
|
||||||
@ -545,7 +545,7 @@ bool IdoPgsqlConnection::FieldToEscapedString(const String& key, const Value& va
|
|||||||
|
|
||||||
Value rawvalue = DbValue::ExtractValue(value);
|
Value rawvalue = DbValue::ExtractValue(value);
|
||||||
|
|
||||||
if (rawvalue.IsObjectType<DynamicObject>()) {
|
if (rawvalue.IsObjectType<ConfigObject>()) {
|
||||||
DbObject::Ptr dbobjcol = DbObject::GetOrCreateByObject(rawvalue);
|
DbObject::Ptr dbobjcol = DbObject::GetOrCreateByObject(rawvalue);
|
||||||
|
|
||||||
if (!dbobjcol) {
|
if (!dbobjcol) {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "demo/demo.tcpp"
|
#include "demo/demo.tcpp"
|
||||||
#include "remote/apilistener.hpp"
|
#include "remote/apilistener.hpp"
|
||||||
#include "remote/apifunction.hpp"
|
#include "remote/apifunction.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -35,7 +35,7 @@ REGISTER_APIFUNCTION(HelloWorld, demo, &Demo::DemoMessageHandler);
|
|||||||
*/
|
*/
|
||||||
void Demo::Start(void)
|
void Demo::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
m_DemoTimer = new Timer();
|
m_DemoTimer = new Timer();
|
||||||
m_DemoTimer->SetInterval(5);
|
m_DemoTimer->SetInterval(5);
|
||||||
@ -54,7 +54,7 @@ void Demo::DemoTimerHandler(void)
|
|||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
if (listener) {
|
if (listener) {
|
||||||
MessageOrigin::Ptr origin = new MessageOrigin();
|
MessageOrigin::Ptr origin = new MessageOrigin();
|
||||||
listener->RelayMessage(origin, DynamicObject::Ptr(), message, true);
|
listener->RelayMessage(origin, ConfigObject::Ptr(), message, true);
|
||||||
Log(LogInformation, "Demo", "Sent demo::HelloWorld message");
|
Log(LogInformation, "Demo", "Sent demo::HelloWorld message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
library demo;
|
library demo;
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
class Demo : DynamicObject
|
class Demo : ConfigObject
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ Dictionary::Ptr ApiActions::CreateResult(const int code, const String& status) {
|
|||||||
REGISTER_APIACTION(reschedule_check, "Service;Host", &ApiActions::RescheduleCheck);
|
REGISTER_APIACTION(reschedule_check, "Service;Host", &ApiActions::RescheduleCheck);
|
||||||
REGISTER_APIACTION(process_check_result, "Service;Host", &ApiActions::ProcessCheckResult);
|
REGISTER_APIACTION(process_check_result, "Service;Host", &ApiActions::ProcessCheckResult);
|
||||||
|
|
||||||
Dictionary::Ptr ApiActions::RescheduleCheck(const DynamicObject::Ptr& object, const Dictionary::Ptr& params)
|
Dictionary::Ptr ApiActions::RescheduleCheck(const ConfigObject::Ptr& object, const Dictionary::Ptr& params)
|
||||||
{
|
{
|
||||||
Checkable::Ptr checkable = static_pointer_cast<Checkable>(object);
|
Checkable::Ptr checkable = static_pointer_cast<Checkable>(object);
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ Dictionary::Ptr ApiActions::RescheduleCheck(const DynamicObject::Ptr& object, co
|
|||||||
return ApiActions::CreateResult(200, "Successfully rescheduled check for " + checkable->GetName());
|
return ApiActions::CreateResult(200, "Successfully rescheduled check for " + checkable->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary::Ptr ApiActions::ProcessCheckResult(const DynamicObject::Ptr& object, const Dictionary::Ptr& params)
|
Dictionary::Ptr ApiActions::ProcessCheckResult(const ConfigObject::Ptr& object, const Dictionary::Ptr& params)
|
||||||
{
|
{
|
||||||
Checkable::Ptr checkable = static_pointer_cast<Checkable>(object);
|
Checkable::Ptr checkable = static_pointer_cast<Checkable>(object);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define APIACTIONS_H
|
#define APIACTIONS_H
|
||||||
|
|
||||||
#include "icinga/i2-icinga.hpp"
|
#include "icinga/i2-icinga.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/dictionary.hpp"
|
#include "base/dictionary.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
@ -33,8 +33,8 @@ namespace icinga
|
|||||||
class I2_ICINGA_API ApiActions
|
class I2_ICINGA_API ApiActions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Dictionary::Ptr RescheduleCheck(const DynamicObject::Ptr& object, const Dictionary::Ptr& params);
|
static Dictionary::Ptr RescheduleCheck(const ConfigObject::Ptr& object, const Dictionary::Ptr& params);
|
||||||
static Dictionary::Ptr ProcessCheckResult(const DynamicObject::Ptr& object, const Dictionary::Ptr& params);
|
static Dictionary::Ptr ProcessCheckResult(const ConfigObject::Ptr& object, const Dictionary::Ptr& params);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Dictionary::Ptr CreateResult(const int code, const String& status);
|
static Dictionary::Ptr CreateResult(const int code, const String& status);
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "remote/zone.hpp"
|
#include "remote/zone.hpp"
|
||||||
#include "remote/apifunction.hpp"
|
#include "remote/apifunction.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
@ -1241,7 +1241,7 @@ void ApiEvents::VarsChangedHandler(const CustomVarObject::Ptr& object, const Mes
|
|||||||
Dictionary::Ptr params = new Dictionary();
|
Dictionary::Ptr params = new Dictionary();
|
||||||
params->Set("object", object->GetName());
|
params->Set("object", object->GetName());
|
||||||
|
|
||||||
DynamicType::Ptr dtype = object->GetType();
|
ConfigType::Ptr dtype = object->GetType();
|
||||||
ASSERT(dtype);
|
ASSERT(dtype);
|
||||||
|
|
||||||
params->Set("object_type", dtype->GetName());
|
params->Set("object_type", dtype->GetName());
|
||||||
@ -1295,7 +1295,7 @@ Value ApiEvents::VarsChangedAPIHandler(const MessageOrigin::Ptr& origin, const D
|
|||||||
if (!object)
|
if (!object)
|
||||||
object = NotificationCommand::GetByName(objectName);
|
object = NotificationCommand::GetByName(objectName);
|
||||||
} else {
|
} else {
|
||||||
DynamicType::Ptr dtype = DynamicType::GetByName(objectType);
|
ConfigType::Ptr dtype = ConfigType::GetByName(objectType);
|
||||||
|
|
||||||
if (!dtype)
|
if (!dtype)
|
||||||
return Empty;
|
return Empty;
|
||||||
@ -1847,7 +1847,7 @@ void ApiEvents::RepositoryTimerHandler(void)
|
|||||||
|
|
||||||
Dictionary::Ptr repository = new Dictionary();
|
Dictionary::Ptr repository = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
Array::Ptr services = new Array();
|
Array::Ptr services = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
|
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/timer.hpp"
|
#include "base/timer.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
@ -234,11 +234,11 @@ void Checkable::RemoveExpiredComments(void)
|
|||||||
|
|
||||||
void Checkable::CommentsExpireTimerHandler(void)
|
void Checkable::CommentsExpireTimerHandler(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
host->RemoveExpiredComments();
|
host->RemoveExpiredComments();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
|
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
||||||
service->RemoveExpiredComments();
|
service->RemoveExpiredComments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/timer.hpp"
|
#include "base/timer.hpp"
|
||||||
@ -321,11 +321,11 @@ void Checkable::RemoveExpiredDowntimes(void)
|
|||||||
|
|
||||||
void Checkable::DowntimesExpireTimerHandler(void)
|
void Checkable::DowntimesExpireTimerHandler(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
host->RemoveExpiredDowntimes();
|
host->RemoveExpiredDowntimes();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
|
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
||||||
service->RemoveExpiredDowntimes();
|
service->RemoveExpiredDowntimes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ void Checkable::Start(void)
|
|||||||
if (GetNextCheck() < now + 300)
|
if (GetNextCheck() < now + 300)
|
||||||
UpdateNextCheck();
|
UpdateNextCheck();
|
||||||
|
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checkable::OnStateLoaded(void)
|
void Checkable::OnStateLoaded(void)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "icinga/checkcommand.hpp"
|
#include "icinga/checkcommand.hpp"
|
||||||
#include "icinga/checkcommand.tcpp"
|
#include "icinga/checkcommand.tcpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ CheckableCheckStatistics CIB::CalculateHostCheckStats(void)
|
|||||||
double min_execution_time = -1, max_execution_time = 0, sum_execution_time = 0;
|
double min_execution_time = -1, max_execution_time = 0, sum_execution_time = 0;
|
||||||
int count_execution_time = 0;
|
int count_execution_time = 0;
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
ObjectLock olock(host);
|
ObjectLock olock(host);
|
||||||
|
|
||||||
CheckResult::Ptr cr = host->GetLastCheckResult();
|
CheckResult::Ptr cr = host->GetLastCheckResult();
|
||||||
@ -129,7 +129,7 @@ CheckableCheckStatistics CIB::CalculateServiceCheckStats(void)
|
|||||||
double min_execution_time = -1, max_execution_time = 0, sum_execution_time = 0;
|
double min_execution_time = -1, max_execution_time = 0, sum_execution_time = 0;
|
||||||
int count_execution_time = 0;
|
int count_execution_time = 0;
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
|
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
||||||
ObjectLock olock(service);
|
ObjectLock olock(service);
|
||||||
|
|
||||||
CheckResult::Ptr cr = service->GetLastCheckResult();
|
CheckResult::Ptr cr = service->GetLastCheckResult();
|
||||||
@ -175,7 +175,7 @@ ServiceStatistics CIB::CalculateServiceStats(void)
|
|||||||
{
|
{
|
||||||
ServiceStatistics ss = {0};
|
ServiceStatistics ss = {0};
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
|
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
||||||
ObjectLock olock(service);
|
ObjectLock olock(service);
|
||||||
|
|
||||||
CheckResult::Ptr cr = service->GetLastCheckResult();
|
CheckResult::Ptr cr = service->GetLastCheckResult();
|
||||||
@ -209,7 +209,7 @@ HostStatistics CIB::CalculateHostStats(void)
|
|||||||
{
|
{
|
||||||
HostStatistics hs = {0};
|
HostStatistics hs = {0};
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
ObjectLock olock(host);
|
ObjectLock olock(host);
|
||||||
|
|
||||||
if (host->IsReachable()) {
|
if (host->IsReachable()) {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "icinga/comment.hpp"
|
#include "icinga/comment.hpp"
|
||||||
#include "icinga/comment.tcpp"
|
#include "icinga/comment.tcpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "icinga/pluginutility.hpp"
|
#include "icinga/pluginutility.hpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
@ -62,11 +62,11 @@ String CompatUtility::GetCommandNamePrefix(const Command::Ptr command)
|
|||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
String prefix;
|
String prefix;
|
||||||
if (command->GetType() == DynamicType::GetByName("CheckCommand"))
|
if (command->GetType() == ConfigType::GetByName("CheckCommand"))
|
||||||
prefix = "check_";
|
prefix = "check_";
|
||||||
else if (command->GetType() == DynamicType::GetByName("NotificationCommand"))
|
else if (command->GetType() == ConfigType::GetByName("NotificationCommand"))
|
||||||
prefix = "notification_";
|
prefix = "notification_";
|
||||||
else if (command->GetType() == DynamicType::GetByName("EventCommand"))
|
else if (command->GetType() == ConfigType::GetByName("EventCommand"))
|
||||||
prefix = "event_";
|
prefix = "event_";
|
||||||
|
|
||||||
return prefix;
|
return prefix;
|
||||||
@ -376,12 +376,12 @@ Array::Ptr CompatUtility::GetModifiedAttributesList(const CustomVarObject::Ptr&
|
|||||||
{
|
{
|
||||||
Array::Ptr mod_attr_list = new Array();
|
Array::Ptr mod_attr_list = new Array();
|
||||||
|
|
||||||
if (object->GetType() != DynamicType::GetByName("Host") &&
|
if (object->GetType() != ConfigType::GetByName("Host") &&
|
||||||
object->GetType() != DynamicType::GetByName("Service") &&
|
object->GetType() != ConfigType::GetByName("Service") &&
|
||||||
object->GetType() != DynamicType::GetByName("User") &&
|
object->GetType() != ConfigType::GetByName("User") &&
|
||||||
object->GetType() != DynamicType::GetByName("CheckCommand") &&
|
object->GetType() != ConfigType::GetByName("CheckCommand") &&
|
||||||
object->GetType() != DynamicType::GetByName("EventCommand") &&
|
object->GetType() != ConfigType::GetByName("EventCommand") &&
|
||||||
object->GetType() != DynamicType::GetByName("NotificationCommand"))
|
object->GetType() != ConfigType::GetByName("NotificationCommand"))
|
||||||
return mod_attr_list;
|
return mod_attr_list;
|
||||||
|
|
||||||
int flags = object->GetModifiedAttributes();
|
int flags = object->GetModifiedAttributes();
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "icinga/i2-icinga.hpp"
|
#include "icinga/i2-icinga.hpp"
|
||||||
#include "icinga/customvarobject.thpp"
|
#include "icinga/customvarobject.thpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "remote/messageorigin.hpp"
|
#include "remote/messageorigin.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
|
|
||||||
library icinga;
|
library icinga;
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
abstract class CustomVarObject : DynamicObject
|
abstract class CustomVarObject : ConfigObject
|
||||||
{
|
{
|
||||||
[config] Dictionary::Ptr vars;
|
[config] Dictionary::Ptr vars;
|
||||||
};
|
};
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "config/configitembuilder.hpp"
|
#include "config/configitembuilder.hpp"
|
||||||
#include "config/applyrule.hpp"
|
#include "config/applyrule.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/workqueue.hpp"
|
#include "base/workqueue.hpp"
|
||||||
|
@ -82,7 +82,7 @@ void Dependency::OnConfigLoaded(void)
|
|||||||
|
|
||||||
void Dependency::OnAllConfigLoaded(void)
|
void Dependency::OnAllConfigLoaded(void)
|
||||||
{
|
{
|
||||||
DynamicObject::OnAllConfigLoaded();
|
ConfigObject::OnAllConfigLoaded();
|
||||||
|
|
||||||
Host::Ptr childHost = Host::GetByName(GetChildHostName());
|
Host::Ptr childHost = Host::GetByName(GetChildHostName());
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ void Dependency::OnAllConfigLoaded(void)
|
|||||||
|
|
||||||
void Dependency::Stop(void)
|
void Dependency::Stop(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Stop();
|
ConfigObject::Stop();
|
||||||
|
|
||||||
GetChild()->RemoveDependency(this);
|
GetChild()->RemoveDependency(this);
|
||||||
GetParent()->RemoveReverseDependency(this);
|
GetParent()->RemoveReverseDependency(this);
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "icinga/hostgroup.tcpp"
|
#include "icinga/hostgroup.tcpp"
|
||||||
#include "config/objectrule.hpp"
|
#include "config/objectrule.hpp"
|
||||||
#include "config/configitem.hpp"
|
#include "config/configitem.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "icinga/icingaapplication.tcpp"
|
#include "icinga/icingaapplication.tcpp"
|
||||||
#include "icinga/cib.hpp"
|
#include "icinga/cib.hpp"
|
||||||
#include "config/configwriter.cpp"
|
#include "config/configwriter.cpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
@ -69,7 +69,7 @@ void IcingaApplication::StatsFunc(const Dictionary::Ptr& status, const Array::Pt
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, DynamicType::GetObjectsByType<IcingaApplication>()) {
|
BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, ConfigType::GetObjectsByType<IcingaApplication>()) {
|
||||||
Dictionary::Ptr stats = new Dictionary();
|
Dictionary::Ptr stats = new Dictionary();
|
||||||
stats->Set("node_name", icingaapplication->GetNodeName());
|
stats->Set("node_name", icingaapplication->GetNodeName());
|
||||||
stats->Set("enable_notifications", icingaapplication->GetEnableNotifications());
|
stats->Set("enable_notifications", icingaapplication->GetEnableNotifications());
|
||||||
@ -138,7 +138,7 @@ void IcingaApplication::OnShutdown(void)
|
|||||||
DumpProgramState();
|
DumpProgramState();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PersistModAttrHelper(const ConfigWriter::Ptr& cw, DynamicObject::Ptr& previousObject, const DynamicObject::Ptr& object, const String& attr, const Value& value)
|
static void PersistModAttrHelper(const ConfigWriter::Ptr& cw, ConfigObject::Ptr& previousObject, const ConfigObject::Ptr& object, const String& attr, const Value& value)
|
||||||
{
|
{
|
||||||
if (object != previousObject) {
|
if (object != previousObject) {
|
||||||
if (previousObject)
|
if (previousObject)
|
||||||
@ -168,11 +168,11 @@ static void PersistModAttrHelper(const ConfigWriter::Ptr& cw, DynamicObject::Ptr
|
|||||||
|
|
||||||
void IcingaApplication::DumpProgramState(void)
|
void IcingaApplication::DumpProgramState(void)
|
||||||
{
|
{
|
||||||
DynamicObject::DumpObjects(GetStatePath());
|
ConfigObject::DumpObjects(GetStatePath());
|
||||||
|
|
||||||
ConfigWriter::Ptr cw = new ConfigWriter(GetModAttrPath());
|
ConfigWriter::Ptr cw = new ConfigWriter(GetModAttrPath());
|
||||||
DynamicObject::Ptr previousObject;
|
ConfigObject::Ptr previousObject;
|
||||||
DynamicObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, cw, boost::ref(previousObject), _1, _2, _3));
|
ConfigObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, cw, boost::ref(previousObject), _1, _2, _3));
|
||||||
|
|
||||||
if (previousObject)
|
if (previousObject)
|
||||||
cw->EmitRaw("\n}\n");
|
cw->EmitRaw("\n}\n");
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "icinga/icingastatuswriter.hpp"
|
#include "icinga/icingastatuswriter.hpp"
|
||||||
#include "icinga/icingastatuswriter.tcpp"
|
#include "icinga/icingastatuswriter.tcpp"
|
||||||
#include "icinga/cib.hpp"
|
#include "icinga/cib.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
@ -40,7 +40,7 @@ void IcingaStatusWriter::StatsFunc(const Dictionary::Ptr& status, const Array::P
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, DynamicType::GetObjectsByType<IcingaStatusWriter>()) {
|
BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, ConfigType::GetObjectsByType<IcingaStatusWriter>()) {
|
||||||
nodes->Set(icingastatuswriter->GetName(), 1); //add more stats
|
nodes->Set(icingastatuswriter->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ void IcingaStatusWriter::StatsFunc(const Dictionary::Ptr& status, const Array::P
|
|||||||
*/
|
*/
|
||||||
void IcingaStatusWriter::Start(void)
|
void IcingaStatusWriter::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
m_StatusTimer = new Timer();
|
m_StatusTimer = new Timer();
|
||||||
m_StatusTimer->SetInterval(GetUpdateInterval());
|
m_StatusTimer->SetInterval(GetUpdateInterval());
|
||||||
|
@ -25,7 +25,7 @@ library icinga;
|
|||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
class IcingaStatusWriter : DynamicObject
|
class IcingaStatusWriter : ConfigObject
|
||||||
{
|
{
|
||||||
[config] String status_path {
|
[config] String status_path {
|
||||||
default {{{ return Application::GetLocalStateDir() + "/cache/icinga2/status.json"; }}}
|
default {{{ return Application::GetLocalStateDir() + "/cache/icinga2/status.json"; }}}
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/dynamicobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/scriptframe.hpp"
|
#include "base/scriptframe.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "config/configitembuilder.hpp"
|
#include "config/configitembuilder.hpp"
|
||||||
#include "config/applyrule.hpp"
|
#include "config/applyrule.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/workqueue.hpp"
|
#include "base/workqueue.hpp"
|
||||||
|
@ -115,7 +115,7 @@ void Notification::OnAllConfigLoaded(void)
|
|||||||
|
|
||||||
void Notification::Start(void)
|
void Notification::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
Checkable::Ptr obj = GetCheckable();
|
Checkable::Ptr obj = GetCheckable();
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ void Notification::Start(void)
|
|||||||
|
|
||||||
void Notification::Stop(void)
|
void Notification::Stop(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Stop();
|
ConfigObject::Stop();
|
||||||
|
|
||||||
Checkable::Ptr obj = GetCheckable();
|
Checkable::Ptr obj = GetCheckable();
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "config/configitembuilder.hpp"
|
#include "config/configitembuilder.hpp"
|
||||||
#include "config/applyrule.hpp"
|
#include "config/applyrule.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "icinga/downtime.hpp"
|
#include "icinga/downtime.hpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "base/timer.hpp"
|
#include "base/timer.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
@ -98,14 +98,14 @@ void ScheduledDowntime::OnAllConfigLoaded(void)
|
|||||||
|
|
||||||
void ScheduledDowntime::Start(void)
|
void ScheduledDowntime::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
CreateNextDowntime();
|
CreateNextDowntime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScheduledDowntime::TimerProc(void)
|
void ScheduledDowntime::TimerProc(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, DynamicType::GetObjectsByType<ScheduledDowntime>()) {
|
BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, ConfigType::GetObjectsByType<ScheduledDowntime>()) {
|
||||||
sd->CreateNextDowntime();
|
sd->CreateNextDowntime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "config/configitembuilder.hpp"
|
#include "config/configitembuilder.hpp"
|
||||||
#include "config/applyrule.hpp"
|
#include "config/applyrule.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/workqueue.hpp"
|
#include "base/workqueue.hpp"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "icinga/servicegroup.tcpp"
|
#include "icinga/servicegroup.tcpp"
|
||||||
#include "config/objectrule.hpp"
|
#include "config/objectrule.hpp"
|
||||||
#include "config/configitem.hpp"
|
#include "config/configitem.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "icinga/timeperiod.hpp"
|
#include "icinga/timeperiod.hpp"
|
||||||
#include "icinga/timeperiod.tcpp"
|
#include "icinga/timeperiod.tcpp"
|
||||||
#include "icinga/legacytimeperiod.hpp"
|
#include "icinga/legacytimeperiod.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
@ -46,7 +46,7 @@ void TimePeriod::StaticInitialize(void)
|
|||||||
|
|
||||||
void TimePeriod::Start(void)
|
void TimePeriod::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
/* Pre-fill the time period for the next 24 hours. */
|
/* Pre-fill the time period for the next 24 hours. */
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
@ -268,7 +268,7 @@ void TimePeriod::UpdateTimerHandler(void)
|
|||||||
{
|
{
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
|
|
||||||
BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType<TimePeriod>()) {
|
BOOST_FOREACH(const TimePeriod::Ptr& tp, ConfigType::GetObjectsByType<TimePeriod>()) {
|
||||||
double valid_end;
|
double valid_end;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ REGISTER_TYPE(User);
|
|||||||
|
|
||||||
void User::OnConfigLoaded(void)
|
void User::OnConfigLoaded(void)
|
||||||
{
|
{
|
||||||
DynamicObject::OnConfigLoaded();
|
ConfigObject::OnConfigLoaded();
|
||||||
|
|
||||||
SetTypeFilter(FilterArrayToInt(GetTypes(), ~0));
|
SetTypeFilter(FilterArrayToInt(GetTypes(), ~0));
|
||||||
SetStateFilter(FilterArrayToInt(GetStates(), ~0));
|
SetStateFilter(FilterArrayToInt(GetStates(), ~0));
|
||||||
@ -40,7 +40,7 @@ void User::OnConfigLoaded(void)
|
|||||||
|
|
||||||
void User::OnAllConfigLoaded(void)
|
void User::OnAllConfigLoaded(void)
|
||||||
{
|
{
|
||||||
DynamicObject::OnAllConfigLoaded();
|
ConfigObject::OnAllConfigLoaded();
|
||||||
|
|
||||||
UserGroup::EvaluateObjectRules(this);
|
UserGroup::EvaluateObjectRules(this);
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ void User::OnAllConfigLoaded(void)
|
|||||||
|
|
||||||
void User::Stop(void)
|
void User::Stop(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Stop();
|
ConfigObject::Stop();
|
||||||
|
|
||||||
Array::Ptr groups = GetGroups();
|
Array::Ptr groups = GetGroups();
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "icinga/usergroup.tcpp"
|
#include "icinga/usergroup.tcpp"
|
||||||
#include "config/objectrule.hpp"
|
#include "config/objectrule.hpp"
|
||||||
#include "config/configitem.hpp"
|
#include "config/configitem.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "icinga/eventcommand.hpp"
|
#include "icinga/eventcommand.hpp"
|
||||||
#include "icinga/notificationcommand.hpp"
|
#include "icinga/notificationcommand.hpp"
|
||||||
#include "icinga/compatutility.hpp"
|
#include "icinga/compatutility.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
@ -60,17 +60,17 @@ String CommandsTable::GetPrefix(void) const
|
|||||||
|
|
||||||
void CommandsTable::FetchRows(const AddRowFunction& addRowFn)
|
void CommandsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<CheckCommand>()) {
|
BOOST_FOREACH(const ConfigObject::Ptr& object, ConfigType::GetObjectsByType<CheckCommand>()) {
|
||||||
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<EventCommand>()) {
|
BOOST_FOREACH(const ConfigObject::Ptr& object, ConfigType::GetObjectsByType<EventCommand>()) {
|
||||||
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<NotificationCommand>()) {
|
BOOST_FOREACH(const ConfigObject::Ptr& object, ConfigType::GetObjectsByType<NotificationCommand>()) {
|
||||||
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "livestatus/hoststable.hpp"
|
#include "livestatus/hoststable.hpp"
|
||||||
#include "livestatus/servicestable.hpp"
|
#include "livestatus/servicestable.hpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
@ -65,7 +65,7 @@ String CommentsTable::GetPrefix(void) const
|
|||||||
|
|
||||||
void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
|
void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
Dictionary::Ptr comments = host->GetComments();
|
Dictionary::Ptr comments = host->GetComments();
|
||||||
|
|
||||||
ObjectLock olock(comments);
|
ObjectLock olock(comments);
|
||||||
@ -80,7 +80,7 @@ void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
|
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
||||||
Dictionary::Ptr comments = service->GetComments();
|
Dictionary::Ptr comments = service->GetComments();
|
||||||
|
|
||||||
ObjectLock olock(comments);
|
ObjectLock olock(comments);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "livestatus/contactgroupstable.hpp"
|
#include "livestatus/contactgroupstable.hpp"
|
||||||
#include "icinga/usergroup.hpp"
|
#include "icinga/usergroup.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -49,7 +49,7 @@ String ContactGroupsTable::GetPrefix(void) const
|
|||||||
|
|
||||||
void ContactGroupsTable::FetchRows(const AddRowFunction& addRowFn)
|
void ContactGroupsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType<UserGroup>()) {
|
BOOST_FOREACH(const UserGroup::Ptr& ug, ConfigType::GetObjectsByType<UserGroup>()) {
|
||||||
if (!addRowFn(ug, LivestatusGroupByNone, Empty))
|
if (!addRowFn(ug, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "icinga/user.hpp"
|
#include "icinga/user.hpp"
|
||||||
#include "icinga/timeperiod.hpp"
|
#include "icinga/timeperiod.hpp"
|
||||||
#include "icinga/compatutility.hpp"
|
#include "icinga/compatutility.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
@ -70,7 +70,7 @@ String ContactsTable::GetPrefix(void) const
|
|||||||
|
|
||||||
void ContactsTable::FetchRows(const AddRowFunction& addRowFn)
|
void ContactsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType<User>()) {
|
BOOST_FOREACH(const User::Ptr& user, ConfigType::GetObjectsByType<User>()) {
|
||||||
if (!addRowFn(user, LivestatusGroupByNone, Empty))
|
if (!addRowFn(user, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "livestatus/hoststable.hpp"
|
#include "livestatus/hoststable.hpp"
|
||||||
#include "livestatus/servicestable.hpp"
|
#include "livestatus/servicestable.hpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
@ -65,7 +65,7 @@ String DowntimesTable::GetPrefix(void) const
|
|||||||
|
|
||||||
void DowntimesTable::FetchRows(const AddRowFunction& addRowFn)
|
void DowntimesTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
Dictionary::Ptr downtimes = host->GetDowntimes();
|
Dictionary::Ptr downtimes = host->GetDowntimes();
|
||||||
|
|
||||||
ObjectLock olock(downtimes);
|
ObjectLock olock(downtimes);
|
||||||
@ -80,7 +80,7 @@ void DowntimesTable::FetchRows(const AddRowFunction& addRowFn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
|
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
||||||
Dictionary::Ptr downtimes = service->GetDowntimes();
|
Dictionary::Ptr downtimes = service->GetDowntimes();
|
||||||
|
|
||||||
ObjectLock olock(downtimes);
|
ObjectLock olock(downtimes);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "icinga/icingaapplication.hpp"
|
#include "icinga/icingaapplication.hpp"
|
||||||
#include "remote/endpoint.hpp"
|
#include "remote/endpoint.hpp"
|
||||||
#include "remote/zone.hpp"
|
#include "remote/zone.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
@ -62,7 +62,7 @@ String EndpointsTable::GetPrefix(void) const
|
|||||||
|
|
||||||
void EndpointsTable::FetchRows(const AddRowFunction& addRowFn)
|
void EndpointsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
|
BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>()) {
|
||||||
if (!addRowFn(endpoint, LivestatusGroupByNone, Empty))
|
if (!addRowFn(endpoint, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "icinga/hostgroup.hpp"
|
#include "icinga/hostgroup.hpp"
|
||||||
#include "icinga/host.hpp"
|
#include "icinga/host.hpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -73,7 +73,7 @@ String HostGroupsTable::GetPrefix(void) const
|
|||||||
|
|
||||||
void HostGroupsTable::FetchRows(const AddRowFunction& addRowFn)
|
void HostGroupsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType<HostGroup>()) {
|
BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType<HostGroup>()) {
|
||||||
if (!addRowFn(hg, LivestatusGroupByNone, Empty))
|
if (!addRowFn(hg, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "icinga/macroprocessor.hpp"
|
#include "icinga/macroprocessor.hpp"
|
||||||
#include "icinga/icingaapplication.hpp"
|
#include "icinga/icingaapplication.hpp"
|
||||||
#include "icinga/compatutility.hpp"
|
#include "icinga/compatutility.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
@ -187,7 +187,7 @@ String HostsTable::GetPrefix(void) const
|
|||||||
void HostsTable::FetchRows(const AddRowFunction& addRowFn)
|
void HostsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
if (GetGroupByType() == LivestatusGroupByHostGroup) {
|
if (GetGroupByType() == LivestatusGroupByHostGroup) {
|
||||||
BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType<HostGroup>()) {
|
BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType<HostGroup>()) {
|
||||||
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
|
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
|
||||||
/* the caller must know which groupby type and value are set for this row */
|
/* the caller must know which groupby type and value are set for this row */
|
||||||
if (!addRowFn(host, LivestatusGroupByHostGroup, hg))
|
if (!addRowFn(host, LivestatusGroupByHostGroup, hg))
|
||||||
@ -195,7 +195,7 @@ void HostsTable::FetchRows(const AddRowFunction& addRowFn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||||
if (!addRowFn(host, LivestatusGroupByNone, Empty))
|
if (!addRowFn(host, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "icinga/perfdatavalue.hpp"
|
#include "icinga/perfdatavalue.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/dynamictype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/tcpsocket.hpp"
|
#include "base/tcpsocket.hpp"
|
||||||
@ -47,7 +47,7 @@ void LivestatusListener::StatsFunc(const Dictionary::Ptr& status, const Array::P
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, DynamicType::GetObjectsByType<LivestatusListener>()) {
|
BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, ConfigType::GetObjectsByType<LivestatusListener>()) {
|
||||||
Dictionary::Ptr stats = new Dictionary();
|
Dictionary::Ptr stats = new Dictionary();
|
||||||
stats->Set("connections", l_Connections);
|
stats->Set("connections", l_Connections);
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ void LivestatusListener::StatsFunc(const Dictionary::Ptr& status, const Array::P
|
|||||||
*/
|
*/
|
||||||
void LivestatusListener::Start(void)
|
void LivestatusListener::Start(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Start();
|
ConfigObject::Start();
|
||||||
|
|
||||||
if (GetSocketType() == "tcp") {
|
if (GetSocketType() == "tcp") {
|
||||||
TcpSocket::Ptr socket = new TcpSocket();
|
TcpSocket::Ptr socket = new TcpSocket();
|
||||||
@ -121,7 +121,7 @@ void LivestatusListener::Start(void)
|
|||||||
|
|
||||||
void LivestatusListener::Stop(void)
|
void LivestatusListener::Stop(void)
|
||||||
{
|
{
|
||||||
DynamicObject::Stop();
|
ConfigObject::Stop();
|
||||||
|
|
||||||
m_Listener->Close();
|
m_Listener->Close();
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user