SUBDIRS = \
third-party \
+ tools \
lib \
components \
icinga-app \
--- /dev/null
+checker-type.cpp
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = \
- checker.la
+ libchecker.la
-checker_la_SOURCES = \
+EXTRA_DIST = \
+ checker-type.conf
+
+.conf.cpp:
+ $(top_builddir)/tools/mkembedconfig $< $@
+
+libchecker_la_SOURCES = \
checkercomponent.cpp \
checkercomponent.h \
+ checker-type.cpp \
i2-checker.h
-checker_la_CPPFLAGS = \
+libchecker_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \
-I${top_srcdir}/lib/base \
-I${top_srcdir}/lib/config \
-I${top_srcdir}/lib/remoting \
-I${top_srcdir}/lib/icinga
-checker_la_LDFLAGS = \
+libchecker_la_LDFLAGS = \
$(BOOST_LDFLAGS) \
-module \
-no-undefined \
@RELEASE_INFO@ \
@VERSION_INFO@
-checker_la_LIBADD = \
+libchecker_la_LIBADD = \
$(BOOST_SIGNALS_LIB) \
$(BOOST_THREAD_LIB) \
${top_builddir}/lib/base/libbase.la \
--- /dev/null
+/******************************************************************************
+ * Icinga 2 *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+type CheckerComponent {
+}
using namespace icinga;
-REGISTER_COMPONENT("checker", CheckerComponent);
+REGISTER_TYPE(CheckerComponent);
+
+CheckerComponent::CheckerComponent(const Dictionary::Ptr& serializedUpdate)
+ : DynamicObject(serializedUpdate)
+{ }
void CheckerComponent::Start(void)
{
/**
* @ingroup checker
*/
-class CheckerComponent : public IComponent
+class CheckerComponent : public DynamicObject
{
public:
typedef shared_ptr<CheckerComponent> Ptr;
>
> ServiceSet;
+ CheckerComponent(const Dictionary::Ptr& serializedUpdate);
+
virtual void Start(void);
virtual void Stop(void);
--- /dev/null
+compat-type.cpp
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = \
- compat.la
+ libcompat.la
-compat_la_SOURCES = \
+EXTRA_DIST = \
+ compat-type.conf
+
+.conf.cpp:
+ $(top_builddir)/tools/mkembedconfig $< $@
+
+libcompat_la_SOURCES = \
compatcomponent.cpp \
compatcomponent.h \
+ compat-type.cpp \
i2-compat.h
-compat_la_CPPFLAGS = \
+libcompat_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \
-I${top_srcdir}/lib/base \
-I${top_srcdir}/lib/config \
-I${top_srcdir}/lib/remoting \
-I${top_srcdir}/lib/icinga
-compat_la_LDFLAGS = \
+libcompat_la_LDFLAGS = \
$(BOOST_LDFLAGS) \
-module \
-no-undefined \
@RELEASE_INFO@ \
@VERSION_INFO@
-compat_la_LIBADD = \
+libcompat_la_LIBADD = \
$(BOOST_SIGNALS_LIB) \
$(BOOST_THREAD_LIB) \
${top_builddir}/lib/base/libbase.la \
--- /dev/null
+/******************************************************************************
+ * Icinga 2 *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+type CompatComponent {
+ %attribute string "status_path",
+ %attribute string "objects_path",
+ %attribute string "log_path",
+ %attribute string "command_path"
+}
using namespace icinga;
-REGISTER_COMPONENT("compat", CompatComponent);
+REGISTER_TYPE(CompatComponent);
/**
* Hint: The reason why we're using "\n" rather than std::endl is because
* performance (see http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html).
*/
+/**
+ * Starts the component.
+ */
+void CompatComponent::Start(void)
+{
+ m_StatusTimer = boost::make_shared<Timer>();
+ m_StatusTimer->SetInterval(15);
+ m_StatusTimer->OnTimerExpired.connect(boost::bind(&CompatComponent::StatusTimerHandler, this));
+ m_StatusTimer->Start();
+ m_StatusTimer->Reschedule(0);
+
+#ifndef _WIN32
+ m_CommandThread = thread(boost::bind(&CompatComponent::CommandPipeThread, this, GetCommandPath()));
+ m_CommandThread.detach();
+#endif /* _WIN32 */
+}
+
/**
* Retrieves the status.dat path.
*
*/
String CompatComponent::GetStatusPath(void) const
{
- DynamicObject::Ptr config = GetConfig();
-
- Value statusPath = config->Get("status_path");
+ Value statusPath = m_StatusPath;
if (statusPath.IsEmpty())
return Application::GetLocalStateDir() + "/cache/icinga2/status.dat";
else
*/
String CompatComponent::GetObjectsPath(void) const
{
- DynamicObject::Ptr config = GetConfig();
-
- Value objectsPath = config->Get("objects_path");
+ Value objectsPath = m_ObjectsPath;
if (objectsPath.IsEmpty())
return Application::GetLocalStateDir() + "/cache/icinga2/objects.cache";
else
*/
String CompatComponent::GetLogPath(void) const
{
- DynamicObject::Ptr config = GetConfig();
-
- Value logPath = config->Get("log_path");
+ Value logPath = m_LogPath;
if (logPath.IsEmpty())
return Application::GetLocalStateDir() + "/log/icinga2/compat";
else
*/
String CompatComponent::GetCommandPath(void) const
{
- DynamicObject::Ptr config = GetConfig();
-
- Value commandPath = config->Get("command_path");
+ Value commandPath = m_CommandPath;
if (commandPath.IsEmpty())
return Application::GetLocalStateDir() + "/run/icinga2/icinga2.cmd";
else
return commandPath;
}
-/**
- * Starts the component.
- */
-void CompatComponent::Start(void)
-{
- m_StatusTimer = boost::make_shared<Timer>();
- m_StatusTimer->SetInterval(15);
- m_StatusTimer->OnTimerExpired.connect(boost::bind(&CompatComponent::StatusTimerHandler, this));
- m_StatusTimer->Start();
- m_StatusTimer->Reschedule(0);
-
-#ifndef _WIN32
- m_CommandThread = thread(boost::bind(&CompatComponent::CommandPipeThread, this, GetCommandPath()));
- m_CommandThread.detach();
-#endif /* _WIN32 */
-}
-
-/**
- * Stops the component.
- */
-void CompatComponent::Stop(void)
+CompatComponent::CompatComponent(const Dictionary::Ptr& serializedUpdate)
+ : DynamicObject(serializedUpdate)
{
+ RegisterAttribute("status_path", Attribute_Config, &m_StatusPath);
+ RegisterAttribute("objects_path", Attribute_Config, &m_ObjectsPath);
+ RegisterAttribute("log_path", Attribute_Config, &m_LogPath);
+ RegisterAttribute("command_path", Attribute_Config, &m_CommandPath);
}
#ifndef _WIN32
/**
* @ingroup compat
*/
-class CompatComponent : public IComponent
+class CompatComponent : public DynamicObject
{
public:
+ CompatComponent(const Dictionary::Ptr& serializedUpdate);
+
virtual void Start(void);
- virtual void Stop(void);
private:
+ Attribute<String> m_StatusPath;
+ Attribute<String> m_ObjectsPath;
+ Attribute<String> m_LogPath;
+ Attribute<String> m_CommandPath;
+
#ifndef _WIN32
thread m_CommandThread;
--- /dev/null
+delegation-type.cpp
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = \
- delegation.la
+ libdelegation.la
-delegation_la_SOURCES = \
+EXTRA_DIST = \
+ delegation-type.conf
+
+.conf.cpp:
+ $(top_builddir)/tools/mkembedconfig $< $@
+
+libdelegation_la_SOURCES = \
delegationcomponent.cpp \
delegationcomponent.h \
+ delegation-type.cpp \
i2-delegation.h
-delegation_la_CPPFLAGS = \
+libdelegation_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \
-I${top_srcdir}/lib/base \
-I${top_srcdir}/lib/config \
-I${top_srcdir}/lib/remoting \
-I${top_srcdir}/lib/icinga
-delegation_la_LDFLAGS = \
+libdelegation_la_LDFLAGS = \
$(BOOST_LDFLAGS) \
-module \
-no-undefined \
@RELEASE_INFO@ \
@VERSION_INFO@
-delegation_la_LIBADD = \
+libdelegation_la_LIBADD = \
$(BOOST_SIGNALS_LIB) \
$(BOOST_THREAD_LIB) \
${top_builddir}/lib/base/libbase.la \
--- /dev/null
+/******************************************************************************
+ * Icinga 2 *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+type DelegationComponent {
+}
using namespace icinga;
-REGISTER_COMPONENT("delegation", DelegationComponent);
+REGISTER_TYPE(DelegationComponent);
+
+DelegationComponent::DelegationComponent(const Dictionary::Ptr& serializedUpdate)
+ : DynamicObject(serializedUpdate)
+{ }
void DelegationComponent::Start(void)
{
m_DelegationTimer = boost::make_shared<Timer>();
- // TODO: implement a handler for config changes for the delegation_interval variable
m_DelegationTimer->SetInterval(30);
m_DelegationTimer->OnTimerExpired.connect(boost::bind(&DelegationComponent::DelegationTimerHandler, this));
m_DelegationTimer->Start();
/**
* @ingroup delegation
*/
-class DelegationComponent : public IComponent
+class DelegationComponent : public DynamicObject
{
public:
+ DelegationComponent(const Dictionary::Ptr& serializedUpdate);
+
virtual void Start(void);
private:
--- /dev/null
+demo-type.cpp
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = \
- demo.la
+ libdemo.la
-demo_la_SOURCES = \
+EXTRA_DIST = \
+ demo-type.conf
+
+.conf.cpp:
+ $(top_builddir)/tools/mkembedconfig $< $@
+
+libdemo_la_SOURCES = \
democomponent.cpp \
democomponent.h \
+ demo-type.cpp \
i2-demo.h
-demo_la_CPPFLAGS = \
+libdemo_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \
-I${top_srcdir}/lib/base \
-I${top_srcdir}/lib/config \
-I${top_srcdir}/lib/remoting \
-I${top_srcdir}/lib/icinga
-demo_la_LDFLAGS = \
+libdemo_la_LDFLAGS = \
$(BOOST_LDFLAGS) \
-module \
-no-undefined \
@RELEASE_INFO@ \
@VERSION_INFO@
-demo_la_LIBADD = \
+libdemo_la_LIBADD = \
$(BOOST_SIGNALS_LIB) \
$(BOOST_THREAD_LIB) \
${top_builddir}/lib/base/libbase.la \
--- /dev/null
+/******************************************************************************
+ * Icinga 2 *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+type DemoComponent {
+}
using namespace icinga;
-REGISTER_COMPONENT("demo", DemoComponent);
+REGISTER_TYPE(DemoComponent);
+
+DemoComponent::DemoComponent(const Dictionary::Ptr& serializedUpdate)
+ : DynamicObject(serializedUpdate)
+{ }
/**
* Starts the component.
/**
* @ingroup demo
*/
-class DemoComponent : public IComponent
+class DemoComponent : public DynamicObject
{
public:
+ DemoComponent(const Dictionary::Ptr& serializedUpdate);
+
virtual void Start(void);
virtual void Stop(void);
--- /dev/null
+livestatus-type.cpp
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = \
- livestatus.la
+ liblivestatus.la
-livestatus_la_SOURCES = \
+EXTRA_DIST = \
+ livestatus-type.conf
+
+.conf.cpp:
+ $(top_builddir)/tools/mkembedconfig $< $@
+
+liblivestatus_la_SOURCES = \
attributefilter.cpp \
attributefilter.h \
andfilter.cpp \
filter.h \
hoststable.cpp \
hoststable.h \
+ livestatus-type.cpp \
negatefilter.cpp \
negatefilter.h \
orfilter.cpp \
table.h \
i2-livestatus.h
-livestatus_la_CPPFLAGS = \
+liblivestatus_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \
-I${top_srcdir}/lib/base \
-I${top_srcdir}/lib/config \
-I${top_srcdir}/lib/remoting \
-I${top_srcdir}/lib/icinga
-livestatus_la_LDFLAGS = \
+liblivestatus_la_LDFLAGS = \
$(BOOST_LDFLAGS) \
-module \
-no-undefined \
@RELEASE_INFO@ \
@VERSION_INFO@
-livestatus_la_LIBADD = \
+liblivestatus_la_LIBADD = \
$(BOOST_SIGNALS_LIB) \
$(BOOST_THREAD_LIB) \
${top_builddir}/lib/base/libbase.la \
using namespace icinga;
using namespace livestatus;
-REGISTER_COMPONENT("livestatus", LivestatusComponent);
+REGISTER_TYPE(LivestatusComponent);
+
+LivestatusComponent::LivestatusComponent(const Dictionary::Ptr& serializedUpdate)
+ : DynamicObject(serializedUpdate)
+{
+ RegisterAttribute("socket_path", Attribute_Config, &m_SocketPath);
+}
/**
* Starts the component.
m_Listener = socket;
}
-/**
- * Stops the component.
- */
-void LivestatusComponent::Stop(void)
-{
-}
-
String LivestatusComponent::GetSocketPath(void) const
{
- DynamicObject::Ptr config = GetConfig();
-
- Value socketPath = config->Get("socket_path");
+ Value socketPath = m_SocketPath;
if (socketPath.IsEmpty())
return Application::GetLocalStateDir() + "/run/icinga2/livestatus";
else
/**
* @ingroup livestatus
*/
-class LivestatusComponent : public IComponent
+class LivestatusComponent : public DynamicObject
{
public:
+ LivestatusComponent(const Dictionary::Ptr& serializedUpdate);
+
virtual void Start(void);
- virtual void Stop(void);
String GetSocketPath(void) const;
private:
+ Attribute<String> m_SocketPath;
+
Socket::Ptr m_Listener;
set<LivestatusConnection::Ptr> m_Connections;
--- /dev/null
+/******************************************************************************
+ * Icinga 2 *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+type LivestatusComponent {
+}
--- /dev/null
+notification-type.cpp
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = \
- notification.la
+ libnotification.la
-notification_la_SOURCES = \
+EXTRA_DIST = \
+ notification-type.conf
+
+.conf.cpp:
+ $(top_builddir)/tools/mkembedconfig $< $@
+
+libnotification_la_SOURCES = \
notificationcomponent.cpp \
notificationcomponent.h \
+ notification-type.cpp \
i2-notification.h
-notification_la_CPPFLAGS = \
+libnotification_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \
-I${top_srcdir}/lib/base \
-I${top_srcdir}/lib/config \
-I${top_srcdir}/lib/remoting \
-I${top_srcdir}/lib/icinga
-notification_la_LDFLAGS = \
+libnotification_la_LDFLAGS = \
$(BOOST_LDFLAGS) \
-module \
-no-undefined \
@RELEASE_INFO@ \
@VERSION_INFO@
-notification_la_LIBADD = \
+libnotification_la_LIBADD = \
$(BOOST_SIGNALS_LIB) \
$(BOOST_THREAD_LIB) \
${top_builddir}/lib/base/libbase.la \
--- /dev/null
+/******************************************************************************
+ * Icinga 2 *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+type NotificationComponent {
+}
using namespace icinga;
-REGISTER_COMPONENT("notification", NotificationComponent);
+REGISTER_TYPE(NotificationComponent);
+
+NotificationComponent::NotificationComponent(const Dictionary::Ptr& serializedUpdate)
+ : DynamicObject(serializedUpdate)
+{ }
/**
* Starts the component.
/**
* @ingroup notification
*/
-class NotificationComponent : public IComponent
+class NotificationComponent : public DynamicObject
{
public:
+ NotificationComponent(const Dictionary::Ptr& serializedUpdate);
+
virtual void Start(void);
virtual void Stop(void);
--- /dev/null
+replication-type.cpp
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = \
- replication.la
+ libreplication.la
-replication_la_SOURCES = \
+EXTRA_DIST = \
+ replication-type.conf
+
+.conf.cpp:
+ $(top_builddir)/tools/mkembedconfig $< $@
+
+libreplication_la_SOURCES = \
replicationcomponent.cpp \
replicationcomponent.h \
+ replication-type.cpp \
i2-replication.h
-replication_la_CPPFLAGS = \
+libreplication_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \
-I${top_srcdir}/lib/base \
-I${top_srcdir}/lib/config \
-I${top_srcdir}/lib/remoting \
-I${top_srcdir}/lib/icinga
-replication_la_LDFLAGS = \
+libreplication_la_LDFLAGS = \
$(BOOST_LDFLAGS) \
-module \
-no-undefined \
@RELEASE_INFO@ \
@VERSION_INFO@
-replication_la_LIBADD = \
+libreplication_la_LIBADD = \
$(BOOST_SIGNALS_LIB) \
$(BOOST_THREAD_LIB) \
${top_builddir}/lib/base/libbase.la \
--- /dev/null
+/******************************************************************************
+ * Icinga 2 *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+type ReplicationComponent {
+}
using namespace icinga;
-REGISTER_COMPONENT("replication", ReplicationComponent);
+REGISTER_TYPE(ReplicationComponent);
+
+ReplicationComponent::ReplicationComponent(const Dictionary::Ptr& serializedUpdate)
+ : DynamicObject(serializedUpdate)
+{ }
/**
* Starts the component.
/**
* @ingroup replication
*/
-class ReplicationComponent : public IComponent
+class ReplicationComponent : public DynamicObject
{
public:
+ ReplicationComponent(const Dictionary::Ptr& serializedUpdate);
+
virtual void Start(void);
virtual void Stop(void);
third-party/execvpe/Makefile
third-party/mmatch/Makefile
third-party/popen-noshell/Makefile
+tools/Makefile
])
AC_OUTPUT([
etc/init.d/icinga2
${top_builddir}/lib/base/libbase.la \
${top_builddir}/lib/config/libconfig.la \
-dlopen ${top_builddir}/lib/icinga/libicinga.la \
- -dlopen ${top_builddir}/components/checker/checker.la \
- -dlopen ${top_builddir}/components/replication/replication.la \
- -dlopen ${top_builddir}/components/compat/compat.la \
- -dlopen ${top_builddir}/components/delegation/delegation.la \
- -dlopen ${top_builddir}/components/demo/demo.la \
- -dlopen ${top_builddir}/components/notification/notification.la
+ -dlopen ${top_builddir}/components/checker/libchecker.la \
+ -dlopen ${top_builddir}/components/replication/libreplication.la \
+ -dlopen ${top_builddir}/components/compat/libcompat.la \
+ -dlopen ${top_builddir}/components/delegation/libdelegation.la \
+ -dlopen ${top_builddir}/components/demo/libdemo.la \
+ -dlopen ${top_builddir}/components/notification/libnotification.la
if PYTHON_USE
icinga2_LDADD += \
ConfigCompiler::CompileFile(configPath);
}
+ String name, fragment;
+ BOOST_FOREACH(tie(name, fragment), ConfigCompiler::GetConfigFragments()) {
+ ConfigCompiler::CompileText(name, fragment);
+ }
+
ConfigCompilerContext::SetContext(NULL);
context.Validate();
#endif /* _WIN32 */
);
- Component::AddSearchDir(Application::GetPkgLibDir());
+ String searchDir = Application::GetPkgLibDir();
+ Logger::Write(LogInformation, "base", "Adding library search dir: " + searchDir);
+
+#ifdef _WIN32
+ SetDllDirectory(searchDir.CStr());
+#else /* _WIN32 */
+ lt_dladdsearchdir(searchDir.CStr());
+#endif /* _WIN32 */
- (void) Utility::LoadIcingaLibrary("icinga", false);
+ (void) Utility::LoadExtensionLibrary("icinga");
if (g_AppParams.count("library")) {
BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as<vector<String> >()) {
- Utility::LoadIcingaLibrary(libraryName, false);
+ (void) Utility::LoadExtensionLibrary(libraryName);
}
}
notification.conf \
service.conf \
service-common.conf \
- standalone.conf \
- types.conf
+ standalone.conf
* configuration templates.
*/
-#include "types.conf"
-
#include "host.conf"
#include "service.conf"
#include "service-common.conf"
* along with this program; if not, write to the Free Software Foundation *
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-
-local object Component "checker" {}
-local object Component "delegation" {}
+#library "checker"
+local object CheckerComponent "checker" {}
-local object Component "notification" {}
+#library "delegation"
+local object DelegationComponent "delegation" {}
+
+#library "notification"
+local object NotificationComponent "notification" {}
asynctask.h \
attribute.cpp \
attribute.h \
- component.cpp \
- component.h \
connection.cpp \
connection.h \
convert.cpp \
+++ /dev/null
-/******************************************************************************
- * Icinga 2 *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU General Public License *
- * as published by the Free Software Foundation; either version 2 *
- * of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software Foundation *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
- ******************************************************************************/
-
-#include "i2-base.h"
-
-using namespace icinga;
-
-REGISTER_TYPE(Component);
-
-boost::mutex Component::m_Mutex;
-map<String, Component::Factory> Component::m_Factories;
-
-/**
- * Constructor for the component class.
- */
-Component::Component(const Dictionary::Ptr& properties)
- : DynamicObject(properties)
-{
- if (!IsLocal())
- BOOST_THROW_EXCEPTION(runtime_error("Component objects must be local."));
-
- Logger::Write(LogInformation, "base", "Loading component '" + GetName() + "'");
-
- (void) Utility::LoadIcingaLibrary(GetName(), true);
-
- Component::Factory factory;
-
- {
- boost::mutex::scoped_lock lock(m_Mutex);
-
- map<String, Factory>::iterator it;
- it = m_Factories.find(GetName());
-
- if (it == m_Factories.end())
- BOOST_THROW_EXCEPTION(invalid_argument("Unknown component: " + GetName()));
-
- factory = it->second;
- }
-
- m_Impl = factory();
-
- if (!m_Impl)
- BOOST_THROW_EXCEPTION(runtime_error("Component factory returned NULL."));
-}
-
-/**
- * Destructor for the Component class.
- */
-Component::~Component(void)
-{
- if (m_Impl)
- m_Impl->Stop();
-}
-
-/**
- * Starts the component. Called when the DynamicObject is fully
- * constructed/registered.
- */
-void Component::Start(void)
-{
- m_Impl->SetConfig(GetSelf());
- m_Impl->Start();
-}
-
-/**
- * Adds a directory to the component search path.
- *
- * @param componentDirectory The directory.
- */
-void Component::AddSearchDir(const String& componentDirectory)
-{
- Logger::Write(LogInformation, "base", "Adding library search dir: " +
- componentDirectory);
-
-#ifdef _WIN32
- SetDllDirectory(componentDirectory.CStr());
-#else /* _WIN32 */
- lt_dladdsearchdir(componentDirectory.CStr());
-#endif /* _WIN32 */
-}
-
-/**
- * Retrieves the configuration for this component.
- *
- * @returns The configuration.
- */
-DynamicObject::Ptr IComponent::GetConfig(void) const
-{
- return m_Config.lock();
-}
-
-/**
- * Sets the configuration for this component.
- */
-void IComponent::SetConfig(const DynamicObject::Ptr& config)
-{
- m_Config = config;
-}
-
-/**
- * Starts the component.
- */
-void IComponent::Start(void)
-{
- /* Nothing to do in the default implementation. */
-}
-
-/**
- * Stops the component.
- */
-void IComponent::Stop(void)
-{
- /* Nothing to do in the default implementation. */
-}
-
-/**
- * Registers a component factory.
- */
-void Component::Register(const String& name, const Component::Factory& factory)
-{
- boost::mutex::scoped_lock lock(m_Mutex);
-
- m_Factories[name] = factory;
-}
+++ /dev/null
-/******************************************************************************
- * Icinga 2 *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU General Public License *
- * as published by the Free Software Foundation; either version 2 *
- * of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software Foundation *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
- ******************************************************************************/
-
-#ifndef COMPONENT_H
-#define COMPONENT_H
-
-namespace icinga
-{
-
-/**
- * Interface for application extensions.
- *
- * @ingroup base
- */
-class I2_BASE_API IComponent : public Object
-{
-public:
- typedef shared_ptr<IComponent> Ptr;
- typedef weak_ptr<IComponent> WeakPtr;
-
- virtual void Start(void);
- virtual void Stop(void);
-
-protected:
- DynamicObject::Ptr GetConfig(void) const;
-
-private:
- DynamicObject::WeakPtr m_Config; /**< The configuration object for this
- component. */
-
- void SetConfig(const DynamicObject::Ptr& config);
-
- friend class Component;
-};
-
-/**
- * An application extension that can be dynamically loaded
- * at run-time.
- *
- * @ingroup base
- */
-class I2_BASE_API Component : public DynamicObject
-{
-public:
- typedef shared_ptr<Component> Ptr;
- typedef weak_ptr<Component> WeakPtr;
-
- typedef function<IComponent::Ptr (void)> Factory;
-
- Component(const Dictionary::Ptr& properties);
- ~Component(void);
-
- virtual void Start(void);
-
- static void AddSearchDir(const String& componentDirectory);
-
- static void Register(const String& name, const Factory& factory);
-
-private:
- IComponent::Ptr m_Impl; /**< The implementation object for this
- component. */
-
- static boost::mutex m_Mutex;
- static map<String, Factory> m_Factories;
-};
-
-/**
- * Helper class for registering Component implementation classes.
- *
- * @ingroup base
- */
-class RegisterComponentHelper
-{
-public:
- RegisterComponentHelper(const String& name, const Component::Factory& factory)
- {
- Component::Register(name, factory);
- }
-};
-
-/**
- * Factory function for IComponent-based classes.
- *
- * @ingroup base
- */
-template<typename T>
-IComponent::Ptr ComponentFactory(void)
-{
- return boost::make_shared<T>();
-}
-
-
-#define REGISTER_COMPONENT(name, klass) \
- static RegisterComponentHelper g_RegisterSF_ ## type(name, ComponentFactory<klass>)
-
-}
-
-#endif /* COMPONENT_H */
}
#define REGISTER_TYPE_ALIAS(type, alias) \
- static RegisterTypeHelper g_RegisterDT_ ## type(alias, DynamicObjectFactory<type>)
+ static icinga::RegisterTypeHelper g_RegisterDT_ ## type(alias, DynamicObjectFactory<type>)
#define REGISTER_TYPE(type) \
REGISTER_TYPE_ALIAS(type, #type)
#include "scriptlanguage.h"
#include "logger.h"
#include "application.h"
-#include "component.h"
#include "streamlogger.h"
#include "sysloglogger.h"
};
#define REGISTER_SCRIPTFUNCTION(name, callback) \
- static RegisterFunctionHelper g_RegisterSF_ ## type(name, callback)
+ static icinga::RegisterFunctionHelper g_RegisterSF_ ## type(name, callback)
}
}
/**
- * Loads the specified library and invokes an Icinga-specific init
- * function if available.
+ * Loads the specified library.
*
* @param library The name of the library.
- * @param module Whether the library is a module (non-module libraries have a
- * "lib" prefix on *NIX).
*/
#ifdef _WIN32
HMODULE
#else /* _WIN32 */
lt_dlhandle
#endif /* _WIN32 */
-Utility::LoadIcingaLibrary(const String& library, bool module)
+Utility::LoadExtensionLibrary(const String& library)
{
String path;
#ifdef _WIN32
path = library + ".dll";
#else /* _WIN32 */
- path = (module ? "" : "lib") + library + ".la";
+ path = "lib" + library + ".la";
#endif /* _WIN32 */
Logger::Write(LogInformation, "base", "Loading library '" + path + "'");
return timestamp;
}
-
#else /* _WIN32 */
lt_dlhandle
#endif /* _WIN32 */
- LoadIcingaLibrary(const String& library, bool module);
+ LoadExtensionLibrary(const String& library);
#ifndef _WIN32
static void SetNonBlocking(int fd);
--- /dev/null
+base-type.cpp
AM_YFLAGS = -d
+EXTRA_DIST = \
+ base-type.conf
+
+.conf.cpp:
+ $(top_builddir)/tools/mkembedconfig $< $@
+
libconfig_la_SOURCES = \
+ base-type.cpp \
configcompiler.cpp \
configcompiler.h \
configcompilercontext.cpp \
--- /dev/null
+/******************************************************************************
+ * Icinga 2 *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+type DynamicObject {
+ %require "__local",
+ %attribute number "__local",
+
+ %require "__name",
+ %attribute string "__name",
+
+ %require "__type",
+ %attribute string "__type",
+
+ %attribute dictionary "methods" {
+ },
+
+ %attribute any "custom::*"
+}
+
+type Logger {
+ %attribute string "type",
+ %attribute string "path",
+ %attribute string "severity"
+}
+
+type Script {
+ %require "language",
+ %attribute string "language",
+
+ %require "code",
+ %attribute string "code"
+}
*/
void ConfigCompiler::HandleLibrary(const String& library)
{
- Utility::LoadIcingaLibrary(library, false);
+ (void) Utility::LoadExtensionLibrary(library);
}
/**
m_IncludeSearchDirs.push_back(dir);
}
+void ConfigCompiler::RegisterConfigFragment(const String& name, const String& fragment)
+{
+ GetConfigFragments()[name] = fragment;
+}
+
+map<String, String>& ConfigCompiler::GetConfigFragments(void)
+{
+ static map<String, String> fragments;
+ return fragments;
+}
static void HandleFileInclude(const String& include, bool search,
const DebugInfo& debuginfo);
-
+
/* internally used methods */
void HandleInclude(const String& include, bool search, const DebugInfo& debuginfo);
void HandleLibrary(const String& library);
-
+
size_t ReadInput(char *buffer, size_t max_bytes);
void *GetScanner(void) const;
+ static void RegisterConfigFragment(const String& name, const String& fragment);
+ static map<String, String>& GetConfigFragments(void);
+
private:
String m_Path;
istream *m_Input;
void DestroyScanner(void);
};
+/**
+ * Helper class for registering config fragments.
+ *
+ * @ingroup base
+ */
+class RegisterConfigFragmentHelper
+{
+public:
+ RegisterConfigFragmentHelper(const String& name, const String& fragment)
+ {
+ ConfigCompiler::RegisterConfigFragment(name, fragment);
+ }
+};
+
+#define REGISTER_CONFIG_FRAGMENT(name, fragment) \
+ static icinga::RegisterConfigFragmentHelper g_RegisterCF_ ## type(name, fragment)
+
}
#endif /* CONFIGCOMPILER_H */
--- /dev/null
+icinga-type.cpp
pkglib_LTLIBRARIES = \
libicinga.la
+EXTRA_DIST = \
+ icinga-type.conf
+
+.conf.cpp:
+ $(top_builddir)/tools/mkembedconfig $< $@
+
libicinga_la_SOURCES = \
api.cpp \
api.h \
host.h \
i2-icinga.cpp \
i2-icinga.h \
+ icinga-type.cpp \
icingaapplication.cpp \
icingaapplication.h \
macroprocessor.cpp \
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-type DynamicObject {
- %require "__local",
- %attribute number "__local",
-
- %require "__name",
- %attribute string "__name",
-
- %require "__type",
- %attribute string "__type",
-
- %attribute dictionary "methods" {
- },
-
- %attribute any "custom::*"
-}
-
-type Component {
-}
-
-type Logger {
- %attribute string "type",
- %attribute string "path",
- %attribute string "severity"
-}
-
type Host {
%attribute string "alias",
%attribute string "hostcheck",
%attribute string "action_url"
}
-type Endpoint {
- %attribute string "node",
- %attribute string "service",
- %attribute number "local"
-}
-
-type TimePeriod {
-}
-
type Notification {
%require "methods",
%attribute dictionary "methods" {
%attribute dictionary "groups" {
%attribute string "*"
},
-
+
%attribute dictionary "notification_command" {
%attribute string "_*"
},
%attribute string "notification_command"
}
-type Script {
- %require "language",
- %attribute string "language",
-
- %require "code",
- %attribute string "code"
-}
-
type User {
%attribute string "display_name",
--- /dev/null
+remoting-type.cpp
pkglib_LTLIBRARIES = \
libremoting.la
+.conf.cpp:
+ $(top_builddir)/tools/mkembedconfig $< $@
+
libremoting_la_SOURCES = \
endpoint.cpp \
endpoint.h \
jsonrpcconnection.h \
messagepart.cpp \
messagepart.h \
+ remoting-type.cpp \
requestmessage.cpp \
requestmessage.h \
responsemessage.cpp \
--- /dev/null
+/******************************************************************************
+ * Icinga 2 *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+type Endpoint {
+ %attribute string "node",
+ %attribute string "service",
+ %attribute number "local"
+}