mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
parent
91c82263a5
commit
3c363499bb
@ -5,6 +5,7 @@ include aminclude.am
|
|||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
third-party \
|
third-party \
|
||||||
|
tools \
|
||||||
lib \
|
lib \
|
||||||
components \
|
components \
|
||||||
icinga-app \
|
icinga-app \
|
||||||
|
1
components/checker/.gitignore
vendored
Normal file
1
components/checker/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
checker-type.cpp
|
@ -1,28 +1,35 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
pkglib_LTLIBRARIES = \
|
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.cpp \
|
||||||
checkercomponent.h \
|
checkercomponent.h \
|
||||||
|
checker-type.cpp \
|
||||||
i2-checker.h
|
i2-checker.h
|
||||||
|
|
||||||
checker_la_CPPFLAGS = \
|
libchecker_la_CPPFLAGS = \
|
||||||
$(BOOST_CPPFLAGS) \
|
$(BOOST_CPPFLAGS) \
|
||||||
-I${top_srcdir}/lib/base \
|
-I${top_srcdir}/lib/base \
|
||||||
-I${top_srcdir}/lib/config \
|
-I${top_srcdir}/lib/config \
|
||||||
-I${top_srcdir}/lib/remoting \
|
-I${top_srcdir}/lib/remoting \
|
||||||
-I${top_srcdir}/lib/icinga
|
-I${top_srcdir}/lib/icinga
|
||||||
|
|
||||||
checker_la_LDFLAGS = \
|
libchecker_la_LDFLAGS = \
|
||||||
$(BOOST_LDFLAGS) \
|
$(BOOST_LDFLAGS) \
|
||||||
-module \
|
-module \
|
||||||
-no-undefined \
|
-no-undefined \
|
||||||
@RELEASE_INFO@ \
|
@RELEASE_INFO@ \
|
||||||
@VERSION_INFO@
|
@VERSION_INFO@
|
||||||
|
|
||||||
checker_la_LIBADD = \
|
libchecker_la_LIBADD = \
|
||||||
$(BOOST_SIGNALS_LIB) \
|
$(BOOST_SIGNALS_LIB) \
|
||||||
$(BOOST_THREAD_LIB) \
|
$(BOOST_THREAD_LIB) \
|
||||||
${top_builddir}/lib/base/libbase.la \
|
${top_builddir}/lib/base/libbase.la \
|
||||||
|
21
components/checker/checker-type.conf
Normal file
21
components/checker/checker-type.conf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* 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 {
|
||||||
|
}
|
@ -21,7 +21,11 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_COMPONENT("checker", CheckerComponent);
|
REGISTER_TYPE(CheckerComponent);
|
||||||
|
|
||||||
|
CheckerComponent::CheckerComponent(const Dictionary::Ptr& serializedUpdate)
|
||||||
|
: DynamicObject(serializedUpdate)
|
||||||
|
{ }
|
||||||
|
|
||||||
void CheckerComponent::Start(void)
|
void CheckerComponent::Start(void)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ struct ServiceNextCheckExtractor
|
|||||||
/**
|
/**
|
||||||
* @ingroup checker
|
* @ingroup checker
|
||||||
*/
|
*/
|
||||||
class CheckerComponent : public IComponent
|
class CheckerComponent : public DynamicObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef shared_ptr<CheckerComponent> Ptr;
|
typedef shared_ptr<CheckerComponent> Ptr;
|
||||||
@ -63,6 +63,8 @@ public:
|
|||||||
>
|
>
|
||||||
> ServiceSet;
|
> ServiceSet;
|
||||||
|
|
||||||
|
CheckerComponent(const Dictionary::Ptr& serializedUpdate);
|
||||||
|
|
||||||
virtual void Start(void);
|
virtual void Start(void);
|
||||||
virtual void Stop(void);
|
virtual void Stop(void);
|
||||||
|
|
||||||
|
1
components/compat/.gitignore
vendored
Normal file
1
components/compat/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
compat-type.cpp
|
@ -1,28 +1,35 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
pkglib_LTLIBRARIES = \
|
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.cpp \
|
||||||
compatcomponent.h \
|
compatcomponent.h \
|
||||||
|
compat-type.cpp \
|
||||||
i2-compat.h
|
i2-compat.h
|
||||||
|
|
||||||
compat_la_CPPFLAGS = \
|
libcompat_la_CPPFLAGS = \
|
||||||
$(BOOST_CPPFLAGS) \
|
$(BOOST_CPPFLAGS) \
|
||||||
-I${top_srcdir}/lib/base \
|
-I${top_srcdir}/lib/base \
|
||||||
-I${top_srcdir}/lib/config \
|
-I${top_srcdir}/lib/config \
|
||||||
-I${top_srcdir}/lib/remoting \
|
-I${top_srcdir}/lib/remoting \
|
||||||
-I${top_srcdir}/lib/icinga
|
-I${top_srcdir}/lib/icinga
|
||||||
|
|
||||||
compat_la_LDFLAGS = \
|
libcompat_la_LDFLAGS = \
|
||||||
$(BOOST_LDFLAGS) \
|
$(BOOST_LDFLAGS) \
|
||||||
-module \
|
-module \
|
||||||
-no-undefined \
|
-no-undefined \
|
||||||
@RELEASE_INFO@ \
|
@RELEASE_INFO@ \
|
||||||
@VERSION_INFO@
|
@VERSION_INFO@
|
||||||
|
|
||||||
compat_la_LIBADD = \
|
libcompat_la_LIBADD = \
|
||||||
$(BOOST_SIGNALS_LIB) \
|
$(BOOST_SIGNALS_LIB) \
|
||||||
$(BOOST_THREAD_LIB) \
|
$(BOOST_THREAD_LIB) \
|
||||||
${top_builddir}/lib/base/libbase.la \
|
${top_builddir}/lib/base/libbase.la \
|
||||||
|
25
components/compat/compat-type.conf
Normal file
25
components/compat/compat-type.conf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* 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"
|
||||||
|
}
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_COMPONENT("compat", CompatComponent);
|
REGISTER_TYPE(CompatComponent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hint: The reason why we're using "\n" rather than std::endl is because
|
* Hint: The reason why we're using "\n" rather than std::endl is because
|
||||||
@ -29,70 +29,6 @@ REGISTER_COMPONENT("compat", CompatComponent);
|
|||||||
* performance (see http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html).
|
* performance (see http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the status.dat path.
|
|
||||||
*
|
|
||||||
* @returns statuspath from config, or static default
|
|
||||||
*/
|
|
||||||
String CompatComponent::GetStatusPath(void) const
|
|
||||||
{
|
|
||||||
DynamicObject::Ptr config = GetConfig();
|
|
||||||
|
|
||||||
Value statusPath = config->Get("status_path");
|
|
||||||
if (statusPath.IsEmpty())
|
|
||||||
return Application::GetLocalStateDir() + "/cache/icinga2/status.dat";
|
|
||||||
else
|
|
||||||
return statusPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the objects.cache path.
|
|
||||||
*
|
|
||||||
* @returns objectspath from config, or static default
|
|
||||||
*/
|
|
||||||
String CompatComponent::GetObjectsPath(void) const
|
|
||||||
{
|
|
||||||
DynamicObject::Ptr config = GetConfig();
|
|
||||||
|
|
||||||
Value objectsPath = config->Get("objects_path");
|
|
||||||
if (objectsPath.IsEmpty())
|
|
||||||
return Application::GetLocalStateDir() + "/cache/icinga2/objects.cache";
|
|
||||||
else
|
|
||||||
return objectsPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the log path.
|
|
||||||
*
|
|
||||||
* @returns log path
|
|
||||||
*/
|
|
||||||
String CompatComponent::GetLogPath(void) const
|
|
||||||
{
|
|
||||||
DynamicObject::Ptr config = GetConfig();
|
|
||||||
|
|
||||||
Value logPath = config->Get("log_path");
|
|
||||||
if (logPath.IsEmpty())
|
|
||||||
return Application::GetLocalStateDir() + "/log/icinga2/compat";
|
|
||||||
else
|
|
||||||
return logPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the icinga.cmd path.
|
|
||||||
*
|
|
||||||
* @returns icinga.cmd path
|
|
||||||
*/
|
|
||||||
String CompatComponent::GetCommandPath(void) const
|
|
||||||
{
|
|
||||||
DynamicObject::Ptr config = GetConfig();
|
|
||||||
|
|
||||||
Value commandPath = config->Get("command_path");
|
|
||||||
if (commandPath.IsEmpty())
|
|
||||||
return Application::GetLocalStateDir() + "/run/icinga2/icinga2.cmd";
|
|
||||||
else
|
|
||||||
return commandPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the component.
|
* Starts the component.
|
||||||
*/
|
*/
|
||||||
@ -111,10 +47,68 @@ void CompatComponent::Start(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops the component.
|
* Retrieves the status.dat path.
|
||||||
|
*
|
||||||
|
* @returns statuspath from config, or static default
|
||||||
*/
|
*/
|
||||||
void CompatComponent::Stop(void)
|
String CompatComponent::GetStatusPath(void) const
|
||||||
{
|
{
|
||||||
|
Value statusPath = m_StatusPath;
|
||||||
|
if (statusPath.IsEmpty())
|
||||||
|
return Application::GetLocalStateDir() + "/cache/icinga2/status.dat";
|
||||||
|
else
|
||||||
|
return statusPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the objects.cache path.
|
||||||
|
*
|
||||||
|
* @returns objectspath from config, or static default
|
||||||
|
*/
|
||||||
|
String CompatComponent::GetObjectsPath(void) const
|
||||||
|
{
|
||||||
|
Value objectsPath = m_ObjectsPath;
|
||||||
|
if (objectsPath.IsEmpty())
|
||||||
|
return Application::GetLocalStateDir() + "/cache/icinga2/objects.cache";
|
||||||
|
else
|
||||||
|
return objectsPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the log path.
|
||||||
|
*
|
||||||
|
* @returns log path
|
||||||
|
*/
|
||||||
|
String CompatComponent::GetLogPath(void) const
|
||||||
|
{
|
||||||
|
Value logPath = m_LogPath;
|
||||||
|
if (logPath.IsEmpty())
|
||||||
|
return Application::GetLocalStateDir() + "/log/icinga2/compat";
|
||||||
|
else
|
||||||
|
return logPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the icinga.cmd path.
|
||||||
|
*
|
||||||
|
* @returns icinga.cmd path
|
||||||
|
*/
|
||||||
|
String CompatComponent::GetCommandPath(void) const
|
||||||
|
{
|
||||||
|
Value commandPath = m_CommandPath;
|
||||||
|
if (commandPath.IsEmpty())
|
||||||
|
return Application::GetLocalStateDir() + "/run/icinga2/icinga2.cmd";
|
||||||
|
else
|
||||||
|
return commandPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
#ifndef _WIN32
|
||||||
|
@ -32,13 +32,19 @@ enum CompatObjectType
|
|||||||
/**
|
/**
|
||||||
* @ingroup compat
|
* @ingroup compat
|
||||||
*/
|
*/
|
||||||
class CompatComponent : public IComponent
|
class CompatComponent : public DynamicObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CompatComponent(const Dictionary::Ptr& serializedUpdate);
|
||||||
|
|
||||||
virtual void Start(void);
|
virtual void Start(void);
|
||||||
virtual void Stop(void);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Attribute<String> m_StatusPath;
|
||||||
|
Attribute<String> m_ObjectsPath;
|
||||||
|
Attribute<String> m_LogPath;
|
||||||
|
Attribute<String> m_CommandPath;
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
thread m_CommandThread;
|
thread m_CommandThread;
|
||||||
|
|
||||||
|
1
components/delegation/.gitignore
vendored
Normal file
1
components/delegation/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
delegation-type.cpp
|
@ -1,28 +1,35 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
pkglib_LTLIBRARIES = \
|
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.cpp \
|
||||||
delegationcomponent.h \
|
delegationcomponent.h \
|
||||||
|
delegation-type.cpp \
|
||||||
i2-delegation.h
|
i2-delegation.h
|
||||||
|
|
||||||
delegation_la_CPPFLAGS = \
|
libdelegation_la_CPPFLAGS = \
|
||||||
$(BOOST_CPPFLAGS) \
|
$(BOOST_CPPFLAGS) \
|
||||||
-I${top_srcdir}/lib/base \
|
-I${top_srcdir}/lib/base \
|
||||||
-I${top_srcdir}/lib/config \
|
-I${top_srcdir}/lib/config \
|
||||||
-I${top_srcdir}/lib/remoting \
|
-I${top_srcdir}/lib/remoting \
|
||||||
-I${top_srcdir}/lib/icinga
|
-I${top_srcdir}/lib/icinga
|
||||||
|
|
||||||
delegation_la_LDFLAGS = \
|
libdelegation_la_LDFLAGS = \
|
||||||
$(BOOST_LDFLAGS) \
|
$(BOOST_LDFLAGS) \
|
||||||
-module \
|
-module \
|
||||||
-no-undefined \
|
-no-undefined \
|
||||||
@RELEASE_INFO@ \
|
@RELEASE_INFO@ \
|
||||||
@VERSION_INFO@
|
@VERSION_INFO@
|
||||||
|
|
||||||
delegation_la_LIBADD = \
|
libdelegation_la_LIBADD = \
|
||||||
$(BOOST_SIGNALS_LIB) \
|
$(BOOST_SIGNALS_LIB) \
|
||||||
$(BOOST_THREAD_LIB) \
|
$(BOOST_THREAD_LIB) \
|
||||||
${top_builddir}/lib/base/libbase.la \
|
${top_builddir}/lib/base/libbase.la \
|
||||||
|
21
components/delegation/delegation-type.conf
Normal file
21
components/delegation/delegation-type.conf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* 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 {
|
||||||
|
}
|
@ -22,13 +22,16 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_COMPONENT("delegation", DelegationComponent);
|
REGISTER_TYPE(DelegationComponent);
|
||||||
|
|
||||||
|
DelegationComponent::DelegationComponent(const Dictionary::Ptr& serializedUpdate)
|
||||||
|
: DynamicObject(serializedUpdate)
|
||||||
|
{ }
|
||||||
|
|
||||||
void DelegationComponent::Start(void)
|
void DelegationComponent::Start(void)
|
||||||
{
|
{
|
||||||
m_DelegationTimer = boost::make_shared<Timer>();
|
m_DelegationTimer = boost::make_shared<Timer>();
|
||||||
|
|
||||||
// TODO: implement a handler for config changes for the delegation_interval variable
|
|
||||||
m_DelegationTimer->SetInterval(30);
|
m_DelegationTimer->SetInterval(30);
|
||||||
m_DelegationTimer->OnTimerExpired.connect(boost::bind(&DelegationComponent::DelegationTimerHandler, this));
|
m_DelegationTimer->OnTimerExpired.connect(boost::bind(&DelegationComponent::DelegationTimerHandler, this));
|
||||||
m_DelegationTimer->Start();
|
m_DelegationTimer->Start();
|
||||||
|
@ -26,9 +26,11 @@ namespace icinga
|
|||||||
/**
|
/**
|
||||||
* @ingroup delegation
|
* @ingroup delegation
|
||||||
*/
|
*/
|
||||||
class DelegationComponent : public IComponent
|
class DelegationComponent : public DynamicObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
DelegationComponent(const Dictionary::Ptr& serializedUpdate);
|
||||||
|
|
||||||
virtual void Start(void);
|
virtual void Start(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
1
components/demo/.gitignore
vendored
Normal file
1
components/demo/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
demo-type.cpp
|
@ -1,28 +1,35 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
pkglib_LTLIBRARIES = \
|
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.cpp \
|
||||||
democomponent.h \
|
democomponent.h \
|
||||||
|
demo-type.cpp \
|
||||||
i2-demo.h
|
i2-demo.h
|
||||||
|
|
||||||
demo_la_CPPFLAGS = \
|
libdemo_la_CPPFLAGS = \
|
||||||
$(BOOST_CPPFLAGS) \
|
$(BOOST_CPPFLAGS) \
|
||||||
-I${top_srcdir}/lib/base \
|
-I${top_srcdir}/lib/base \
|
||||||
-I${top_srcdir}/lib/config \
|
-I${top_srcdir}/lib/config \
|
||||||
-I${top_srcdir}/lib/remoting \
|
-I${top_srcdir}/lib/remoting \
|
||||||
-I${top_srcdir}/lib/icinga
|
-I${top_srcdir}/lib/icinga
|
||||||
|
|
||||||
demo_la_LDFLAGS = \
|
libdemo_la_LDFLAGS = \
|
||||||
$(BOOST_LDFLAGS) \
|
$(BOOST_LDFLAGS) \
|
||||||
-module \
|
-module \
|
||||||
-no-undefined \
|
-no-undefined \
|
||||||
@RELEASE_INFO@ \
|
@RELEASE_INFO@ \
|
||||||
@VERSION_INFO@
|
@VERSION_INFO@
|
||||||
|
|
||||||
demo_la_LIBADD = \
|
libdemo_la_LIBADD = \
|
||||||
$(BOOST_SIGNALS_LIB) \
|
$(BOOST_SIGNALS_LIB) \
|
||||||
$(BOOST_THREAD_LIB) \
|
$(BOOST_THREAD_LIB) \
|
||||||
${top_builddir}/lib/base/libbase.la \
|
${top_builddir}/lib/base/libbase.la \
|
||||||
|
21
components/demo/demo-type.conf
Normal file
21
components/demo/demo-type.conf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* 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 {
|
||||||
|
}
|
@ -21,7 +21,11 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_COMPONENT("demo", DemoComponent);
|
REGISTER_TYPE(DemoComponent);
|
||||||
|
|
||||||
|
DemoComponent::DemoComponent(const Dictionary::Ptr& serializedUpdate)
|
||||||
|
: DynamicObject(serializedUpdate)
|
||||||
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the component.
|
* Starts the component.
|
||||||
|
@ -26,9 +26,11 @@ namespace icinga
|
|||||||
/**
|
/**
|
||||||
* @ingroup demo
|
* @ingroup demo
|
||||||
*/
|
*/
|
||||||
class DemoComponent : public IComponent
|
class DemoComponent : public DynamicObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
DemoComponent(const Dictionary::Ptr& serializedUpdate);
|
||||||
|
|
||||||
virtual void Start(void);
|
virtual void Start(void);
|
||||||
virtual void Stop(void);
|
virtual void Stop(void);
|
||||||
|
|
||||||
|
1
components/livestatus/.gitignore
vendored
Normal file
1
components/livestatus/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
livestatus-type.cpp
|
@ -1,9 +1,15 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
pkglib_LTLIBRARIES = \
|
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.cpp \
|
||||||
attributefilter.h \
|
attributefilter.h \
|
||||||
andfilter.cpp \
|
andfilter.cpp \
|
||||||
@ -28,6 +34,7 @@ livestatus_la_SOURCES = \
|
|||||||
filter.h \
|
filter.h \
|
||||||
hoststable.cpp \
|
hoststable.cpp \
|
||||||
hoststable.h \
|
hoststable.h \
|
||||||
|
livestatus-type.cpp \
|
||||||
negatefilter.cpp \
|
negatefilter.cpp \
|
||||||
negatefilter.h \
|
negatefilter.h \
|
||||||
orfilter.cpp \
|
orfilter.cpp \
|
||||||
@ -42,21 +49,21 @@ livestatus_la_SOURCES = \
|
|||||||
table.h \
|
table.h \
|
||||||
i2-livestatus.h
|
i2-livestatus.h
|
||||||
|
|
||||||
livestatus_la_CPPFLAGS = \
|
liblivestatus_la_CPPFLAGS = \
|
||||||
$(BOOST_CPPFLAGS) \
|
$(BOOST_CPPFLAGS) \
|
||||||
-I${top_srcdir}/lib/base \
|
-I${top_srcdir}/lib/base \
|
||||||
-I${top_srcdir}/lib/config \
|
-I${top_srcdir}/lib/config \
|
||||||
-I${top_srcdir}/lib/remoting \
|
-I${top_srcdir}/lib/remoting \
|
||||||
-I${top_srcdir}/lib/icinga
|
-I${top_srcdir}/lib/icinga
|
||||||
|
|
||||||
livestatus_la_LDFLAGS = \
|
liblivestatus_la_LDFLAGS = \
|
||||||
$(BOOST_LDFLAGS) \
|
$(BOOST_LDFLAGS) \
|
||||||
-module \
|
-module \
|
||||||
-no-undefined \
|
-no-undefined \
|
||||||
@RELEASE_INFO@ \
|
@RELEASE_INFO@ \
|
||||||
@VERSION_INFO@
|
@VERSION_INFO@
|
||||||
|
|
||||||
livestatus_la_LIBADD = \
|
liblivestatus_la_LIBADD = \
|
||||||
$(BOOST_SIGNALS_LIB) \
|
$(BOOST_SIGNALS_LIB) \
|
||||||
$(BOOST_THREAD_LIB) \
|
$(BOOST_THREAD_LIB) \
|
||||||
${top_builddir}/lib/base/libbase.la \
|
${top_builddir}/lib/base/libbase.la \
|
||||||
|
@ -22,7 +22,13 @@
|
|||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
using namespace livestatus;
|
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.
|
* Starts the component.
|
||||||
@ -43,18 +49,9 @@ void LivestatusComponent::Start(void)
|
|||||||
m_Listener = socket;
|
m_Listener = socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Stops the component.
|
|
||||||
*/
|
|
||||||
void LivestatusComponent::Stop(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
String LivestatusComponent::GetSocketPath(void) const
|
String LivestatusComponent::GetSocketPath(void) const
|
||||||
{
|
{
|
||||||
DynamicObject::Ptr config = GetConfig();
|
Value socketPath = m_SocketPath;
|
||||||
|
|
||||||
Value socketPath = config->Get("socket_path");
|
|
||||||
if (socketPath.IsEmpty())
|
if (socketPath.IsEmpty())
|
||||||
return Application::GetLocalStateDir() + "/run/icinga2/livestatus";
|
return Application::GetLocalStateDir() + "/run/icinga2/livestatus";
|
||||||
else
|
else
|
||||||
|
@ -26,15 +26,18 @@ namespace livestatus
|
|||||||
/**
|
/**
|
||||||
* @ingroup livestatus
|
* @ingroup livestatus
|
||||||
*/
|
*/
|
||||||
class LivestatusComponent : public IComponent
|
class LivestatusComponent : public DynamicObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
LivestatusComponent(const Dictionary::Ptr& serializedUpdate);
|
||||||
|
|
||||||
virtual void Start(void);
|
virtual void Start(void);
|
||||||
virtual void Stop(void);
|
|
||||||
|
|
||||||
String GetSocketPath(void) const;
|
String GetSocketPath(void) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Attribute<String> m_SocketPath;
|
||||||
|
|
||||||
Socket::Ptr m_Listener;
|
Socket::Ptr m_Listener;
|
||||||
set<LivestatusConnection::Ptr> m_Connections;
|
set<LivestatusConnection::Ptr> m_Connections;
|
||||||
|
|
||||||
|
21
components/livestatus/livestatus-type.conf
Normal file
21
components/livestatus/livestatus-type.conf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* 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 {
|
||||||
|
}
|
1
components/notification/.gitignore
vendored
Normal file
1
components/notification/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
notification-type.cpp
|
@ -1,28 +1,35 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
pkglib_LTLIBRARIES = \
|
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.cpp \
|
||||||
notificationcomponent.h \
|
notificationcomponent.h \
|
||||||
|
notification-type.cpp \
|
||||||
i2-notification.h
|
i2-notification.h
|
||||||
|
|
||||||
notification_la_CPPFLAGS = \
|
libnotification_la_CPPFLAGS = \
|
||||||
$(BOOST_CPPFLAGS) \
|
$(BOOST_CPPFLAGS) \
|
||||||
-I${top_srcdir}/lib/base \
|
-I${top_srcdir}/lib/base \
|
||||||
-I${top_srcdir}/lib/config \
|
-I${top_srcdir}/lib/config \
|
||||||
-I${top_srcdir}/lib/remoting \
|
-I${top_srcdir}/lib/remoting \
|
||||||
-I${top_srcdir}/lib/icinga
|
-I${top_srcdir}/lib/icinga
|
||||||
|
|
||||||
notification_la_LDFLAGS = \
|
libnotification_la_LDFLAGS = \
|
||||||
$(BOOST_LDFLAGS) \
|
$(BOOST_LDFLAGS) \
|
||||||
-module \
|
-module \
|
||||||
-no-undefined \
|
-no-undefined \
|
||||||
@RELEASE_INFO@ \
|
@RELEASE_INFO@ \
|
||||||
@VERSION_INFO@
|
@VERSION_INFO@
|
||||||
|
|
||||||
notification_la_LIBADD = \
|
libnotification_la_LIBADD = \
|
||||||
$(BOOST_SIGNALS_LIB) \
|
$(BOOST_SIGNALS_LIB) \
|
||||||
$(BOOST_THREAD_LIB) \
|
$(BOOST_THREAD_LIB) \
|
||||||
${top_builddir}/lib/base/libbase.la \
|
${top_builddir}/lib/base/libbase.la \
|
||||||
|
21
components/notification/notification-type.conf
Normal file
21
components/notification/notification-type.conf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* 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 {
|
||||||
|
}
|
@ -21,7 +21,11 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_COMPONENT("notification", NotificationComponent);
|
REGISTER_TYPE(NotificationComponent);
|
||||||
|
|
||||||
|
NotificationComponent::NotificationComponent(const Dictionary::Ptr& serializedUpdate)
|
||||||
|
: DynamicObject(serializedUpdate)
|
||||||
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the component.
|
* Starts the component.
|
||||||
|
@ -26,9 +26,11 @@ namespace icinga
|
|||||||
/**
|
/**
|
||||||
* @ingroup notification
|
* @ingroup notification
|
||||||
*/
|
*/
|
||||||
class NotificationComponent : public IComponent
|
class NotificationComponent : public DynamicObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
NotificationComponent(const Dictionary::Ptr& serializedUpdate);
|
||||||
|
|
||||||
virtual void Start(void);
|
virtual void Start(void);
|
||||||
virtual void Stop(void);
|
virtual void Stop(void);
|
||||||
|
|
||||||
|
1
components/replication/.gitignore
vendored
Normal file
1
components/replication/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
replication-type.cpp
|
@ -1,28 +1,35 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
pkglib_LTLIBRARIES = \
|
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.cpp \
|
||||||
replicationcomponent.h \
|
replicationcomponent.h \
|
||||||
|
replication-type.cpp \
|
||||||
i2-replication.h
|
i2-replication.h
|
||||||
|
|
||||||
replication_la_CPPFLAGS = \
|
libreplication_la_CPPFLAGS = \
|
||||||
$(BOOST_CPPFLAGS) \
|
$(BOOST_CPPFLAGS) \
|
||||||
-I${top_srcdir}/lib/base \
|
-I${top_srcdir}/lib/base \
|
||||||
-I${top_srcdir}/lib/config \
|
-I${top_srcdir}/lib/config \
|
||||||
-I${top_srcdir}/lib/remoting \
|
-I${top_srcdir}/lib/remoting \
|
||||||
-I${top_srcdir}/lib/icinga
|
-I${top_srcdir}/lib/icinga
|
||||||
|
|
||||||
replication_la_LDFLAGS = \
|
libreplication_la_LDFLAGS = \
|
||||||
$(BOOST_LDFLAGS) \
|
$(BOOST_LDFLAGS) \
|
||||||
-module \
|
-module \
|
||||||
-no-undefined \
|
-no-undefined \
|
||||||
@RELEASE_INFO@ \
|
@RELEASE_INFO@ \
|
||||||
@VERSION_INFO@
|
@VERSION_INFO@
|
||||||
|
|
||||||
replication_la_LIBADD = \
|
libreplication_la_LIBADD = \
|
||||||
$(BOOST_SIGNALS_LIB) \
|
$(BOOST_SIGNALS_LIB) \
|
||||||
$(BOOST_THREAD_LIB) \
|
$(BOOST_THREAD_LIB) \
|
||||||
${top_builddir}/lib/base/libbase.la \
|
${top_builddir}/lib/base/libbase.la \
|
||||||
|
21
components/replication/replication-type.conf
Normal file
21
components/replication/replication-type.conf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* 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 {
|
||||||
|
}
|
@ -21,7 +21,11 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_COMPONENT("replication", ReplicationComponent);
|
REGISTER_TYPE(ReplicationComponent);
|
||||||
|
|
||||||
|
ReplicationComponent::ReplicationComponent(const Dictionary::Ptr& serializedUpdate)
|
||||||
|
: DynamicObject(serializedUpdate)
|
||||||
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the component.
|
* Starts the component.
|
||||||
|
@ -26,9 +26,11 @@ namespace icinga
|
|||||||
/**
|
/**
|
||||||
* @ingroup replication
|
* @ingroup replication
|
||||||
*/
|
*/
|
||||||
class ReplicationComponent : public IComponent
|
class ReplicationComponent : public DynamicObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
ReplicationComponent(const Dictionary::Ptr& serializedUpdate);
|
||||||
|
|
||||||
virtual void Start(void);
|
virtual void Start(void);
|
||||||
virtual void Stop(void);
|
virtual void Stop(void);
|
||||||
|
|
||||||
|
@ -131,6 +131,7 @@ third-party/cJSON/Makefile
|
|||||||
third-party/execvpe/Makefile
|
third-party/execvpe/Makefile
|
||||||
third-party/mmatch/Makefile
|
third-party/mmatch/Makefile
|
||||||
third-party/popen-noshell/Makefile
|
third-party/popen-noshell/Makefile
|
||||||
|
tools/Makefile
|
||||||
])
|
])
|
||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
etc/init.d/icinga2
|
etc/init.d/icinga2
|
||||||
|
@ -29,12 +29,12 @@ icinga2_LDADD = \
|
|||||||
${top_builddir}/lib/base/libbase.la \
|
${top_builddir}/lib/base/libbase.la \
|
||||||
${top_builddir}/lib/config/libconfig.la \
|
${top_builddir}/lib/config/libconfig.la \
|
||||||
-dlopen ${top_builddir}/lib/icinga/libicinga.la \
|
-dlopen ${top_builddir}/lib/icinga/libicinga.la \
|
||||||
-dlopen ${top_builddir}/components/checker/checker.la \
|
-dlopen ${top_builddir}/components/checker/libchecker.la \
|
||||||
-dlopen ${top_builddir}/components/replication/replication.la \
|
-dlopen ${top_builddir}/components/replication/libreplication.la \
|
||||||
-dlopen ${top_builddir}/components/compat/compat.la \
|
-dlopen ${top_builddir}/components/compat/libcompat.la \
|
||||||
-dlopen ${top_builddir}/components/delegation/delegation.la \
|
-dlopen ${top_builddir}/components/delegation/libdelegation.la \
|
||||||
-dlopen ${top_builddir}/components/demo/demo.la \
|
-dlopen ${top_builddir}/components/demo/libdemo.la \
|
||||||
-dlopen ${top_builddir}/components/notification/notification.la
|
-dlopen ${top_builddir}/components/notification/libnotification.la
|
||||||
|
|
||||||
if PYTHON_USE
|
if PYTHON_USE
|
||||||
icinga2_LDADD += \
|
icinga2_LDADD += \
|
||||||
|
@ -48,6 +48,11 @@ static bool LoadConfigFiles(bool validateOnly)
|
|||||||
ConfigCompiler::CompileFile(configPath);
|
ConfigCompiler::CompileFile(configPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String name, fragment;
|
||||||
|
BOOST_FOREACH(tie(name, fragment), ConfigCompiler::GetConfigFragments()) {
|
||||||
|
ConfigCompiler::CompileText(name, fragment);
|
||||||
|
}
|
||||||
|
|
||||||
ConfigCompilerContext::SetContext(NULL);
|
ConfigCompilerContext::SetContext(NULL);
|
||||||
|
|
||||||
context.Validate();
|
context.Validate();
|
||||||
@ -207,13 +212,20 @@ int main(int argc, char **argv)
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
);
|
);
|
||||||
|
|
||||||
Component::AddSearchDir(Application::GetPkgLibDir());
|
String searchDir = Application::GetPkgLibDir();
|
||||||
|
Logger::Write(LogInformation, "base", "Adding library search dir: " + searchDir);
|
||||||
|
|
||||||
(void) Utility::LoadIcingaLibrary("icinga", false);
|
#ifdef _WIN32
|
||||||
|
SetDllDirectory(searchDir.CStr());
|
||||||
|
#else /* _WIN32 */
|
||||||
|
lt_dladdsearchdir(searchDir.CStr());
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
(void) Utility::LoadExtensionLibrary("icinga");
|
||||||
|
|
||||||
if (g_AppParams.count("library")) {
|
if (g_AppParams.count("library")) {
|
||||||
BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as<vector<String> >()) {
|
BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as<vector<String> >()) {
|
||||||
Utility::LoadIcingaLibrary(libraryName, false);
|
(void) Utility::LoadExtensionLibrary(libraryName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,5 +5,4 @@ icinga2itl_DATA = \
|
|||||||
notification.conf \
|
notification.conf \
|
||||||
service.conf \
|
service.conf \
|
||||||
service-common.conf \
|
service-common.conf \
|
||||||
standalone.conf \
|
standalone.conf
|
||||||
types.conf
|
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
* configuration templates.
|
* configuration templates.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "types.conf"
|
|
||||||
|
|
||||||
#include "host.conf"
|
#include "host.conf"
|
||||||
#include "service.conf"
|
#include "service.conf"
|
||||||
#include "service-common.conf"
|
#include "service-common.conf"
|
||||||
|
@ -17,8 +17,11 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
local object Component "checker" {}
|
#library "checker"
|
||||||
|
local object CheckerComponent "checker" {}
|
||||||
|
|
||||||
local object Component "delegation" {}
|
#library "delegation"
|
||||||
|
local object DelegationComponent "delegation" {}
|
||||||
|
|
||||||
local object Component "notification" {}
|
#library "notification"
|
||||||
|
local object NotificationComponent "notification" {}
|
||||||
|
@ -12,8 +12,6 @@ libbase_la_SOURCES = \
|
|||||||
asynctask.h \
|
asynctask.h \
|
||||||
attribute.cpp \
|
attribute.cpp \
|
||||||
attribute.h \
|
attribute.h \
|
||||||
component.cpp \
|
|
||||||
component.h \
|
|
||||||
connection.cpp \
|
connection.cpp \
|
||||||
connection.h \
|
connection.h \
|
||||||
convert.cpp \
|
convert.cpp \
|
||||||
|
@ -1,140 +0,0 @@
|
|||||||
/******************************************************************************
|
|
||||||
* Icinga 2 *
|
|
||||||
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License *
|
|
||||||
* as published by the Free Software Foundation; either version 2 *
|
|
||||||
* of the License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This program is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with this program; if not, write to the Free Software Foundation *
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
/******************************************************************************
|
|
||||||
* Icinga 2 *
|
|
||||||
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License *
|
|
||||||
* as published by the Free Software Foundation; either version 2 *
|
|
||||||
* of the License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This program is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with this program; if not, write to the Free Software Foundation *
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
#ifndef 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 */
|
|
@ -95,7 +95,7 @@ shared_ptr<T> DynamicObjectFactory(const Dictionary::Ptr& serializedUpdate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define REGISTER_TYPE_ALIAS(type, alias) \
|
#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) \
|
#define REGISTER_TYPE(type) \
|
||||||
REGISTER_TYPE_ALIAS(type, #type)
|
REGISTER_TYPE_ALIAS(type, #type)
|
||||||
|
@ -233,7 +233,6 @@ namespace signals2 = boost::signals2;
|
|||||||
#include "scriptlanguage.h"
|
#include "scriptlanguage.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "component.h"
|
|
||||||
#include "streamlogger.h"
|
#include "streamlogger.h"
|
||||||
#include "sysloglogger.h"
|
#include "sysloglogger.h"
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define REGISTER_SCRIPTFUNCTION(name, callback) \
|
#define REGISTER_SCRIPTFUNCTION(name, callback) \
|
||||||
static RegisterFunctionHelper g_RegisterSF_ ## type(name, callback)
|
static icinga::RegisterFunctionHelper g_RegisterSF_ ## type(name, callback)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,25 +346,22 @@ void Utility::Sleep(double timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the specified library and invokes an Icinga-specific init
|
* Loads the specified library.
|
||||||
* function if available.
|
|
||||||
*
|
*
|
||||||
* @param library The name of the 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
|
#ifdef _WIN32
|
||||||
HMODULE
|
HMODULE
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
lt_dlhandle
|
lt_dlhandle
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
Utility::LoadIcingaLibrary(const String& library, bool module)
|
Utility::LoadExtensionLibrary(const String& library)
|
||||||
{
|
{
|
||||||
String path;
|
String path;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
path = library + ".dll";
|
path = library + ".dll";
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
path = (module ? "" : "lib") + library + ".la";
|
path = "lib" + library + ".la";
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
Logger::Write(LogInformation, "base", "Loading library '" + path + "'");
|
Logger::Write(LogInformation, "base", "Loading library '" + path + "'");
|
||||||
@ -547,4 +544,3 @@ String Utility::FormatDateTime(const char *format, double ts)
|
|||||||
|
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
lt_dlhandle
|
lt_dlhandle
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
LoadIcingaLibrary(const String& library, bool module);
|
LoadExtensionLibrary(const String& library);
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
static void SetNonBlocking(int fd);
|
static void SetNonBlocking(int fd);
|
||||||
|
1
lib/config/.gitignore
vendored
Normal file
1
lib/config/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
base-type.cpp
|
@ -8,7 +8,14 @@ BUILT_SOURCES = config_parser.h
|
|||||||
|
|
||||||
AM_YFLAGS = -d
|
AM_YFLAGS = -d
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
base-type.conf
|
||||||
|
|
||||||
|
.conf.cpp:
|
||||||
|
$(top_builddir)/tools/mkembedconfig $< $@
|
||||||
|
|
||||||
libconfig_la_SOURCES = \
|
libconfig_la_SOURCES = \
|
||||||
|
base-type.cpp \
|
||||||
configcompiler.cpp \
|
configcompiler.cpp \
|
||||||
configcompiler.h \
|
configcompiler.h \
|
||||||
configcompilercontext.cpp \
|
configcompilercontext.cpp \
|
||||||
|
48
lib/config/base-type.conf
Normal file
48
lib/config/base-type.conf
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* 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"
|
||||||
|
}
|
@ -108,7 +108,7 @@ void ConfigCompiler::HandleInclude(const String& include, bool search, const Deb
|
|||||||
*/
|
*/
|
||||||
void ConfigCompiler::HandleLibrary(const String& library)
|
void ConfigCompiler::HandleLibrary(const String& library)
|
||||||
{
|
{
|
||||||
Utility::LoadIcingaLibrary(library, false);
|
(void) Utility::LoadExtensionLibrary(library);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -211,3 +211,13 @@ void ConfigCompiler::AddIncludeSearchDir(const String& dir)
|
|||||||
m_IncludeSearchDirs.push_back(dir);
|
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;
|
||||||
|
}
|
||||||
|
@ -58,6 +58,9 @@ public:
|
|||||||
size_t ReadInput(char *buffer, size_t max_bytes);
|
size_t ReadInput(char *buffer, size_t max_bytes);
|
||||||
void *GetScanner(void) const;
|
void *GetScanner(void) const;
|
||||||
|
|
||||||
|
static void RegisterConfigFragment(const String& name, const String& fragment);
|
||||||
|
static map<String, String>& GetConfigFragments(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String m_Path;
|
String m_Path;
|
||||||
istream *m_Input;
|
istream *m_Input;
|
||||||
@ -72,6 +75,23 @@ private:
|
|||||||
void DestroyScanner(void);
|
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 */
|
#endif /* CONFIGCOMPILER_H */
|
||||||
|
1
lib/icinga/.gitignore
vendored
Normal file
1
lib/icinga/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
icinga-type.cpp
|
@ -4,6 +4,12 @@
|
|||||||
pkglib_LTLIBRARIES = \
|
pkglib_LTLIBRARIES = \
|
||||||
libicinga.la
|
libicinga.la
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
icinga-type.conf
|
||||||
|
|
||||||
|
.conf.cpp:
|
||||||
|
$(top_builddir)/tools/mkembedconfig $< $@
|
||||||
|
|
||||||
libicinga_la_SOURCES = \
|
libicinga_la_SOURCES = \
|
||||||
api.cpp \
|
api.cpp \
|
||||||
api.h \
|
api.h \
|
||||||
@ -19,6 +25,7 @@ libicinga_la_SOURCES = \
|
|||||||
host.h \
|
host.h \
|
||||||
i2-icinga.cpp \
|
i2-icinga.cpp \
|
||||||
i2-icinga.h \
|
i2-icinga.h \
|
||||||
|
icinga-type.cpp \
|
||||||
icingaapplication.cpp \
|
icingaapplication.cpp \
|
||||||
icingaapplication.h \
|
icingaapplication.h \
|
||||||
macroprocessor.cpp \
|
macroprocessor.cpp \
|
||||||
|
@ -17,31 +17,6 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* 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 {
|
type Host {
|
||||||
%attribute string "alias",
|
%attribute string "alias",
|
||||||
%attribute string "hostcheck",
|
%attribute string "hostcheck",
|
||||||
@ -227,15 +202,6 @@ type ServiceGroup {
|
|||||||
%attribute string "action_url"
|
%attribute string "action_url"
|
||||||
}
|
}
|
||||||
|
|
||||||
type Endpoint {
|
|
||||||
%attribute string "node",
|
|
||||||
%attribute string "service",
|
|
||||||
%attribute number "local"
|
|
||||||
}
|
|
||||||
|
|
||||||
type TimePeriod {
|
|
||||||
}
|
|
||||||
|
|
||||||
type Notification {
|
type Notification {
|
||||||
%require "methods",
|
%require "methods",
|
||||||
%attribute dictionary "methods" {
|
%attribute dictionary "methods" {
|
||||||
@ -265,14 +231,6 @@ type Notification {
|
|||||||
%attribute string "notification_command"
|
%attribute string "notification_command"
|
||||||
}
|
}
|
||||||
|
|
||||||
type Script {
|
|
||||||
%require "language",
|
|
||||||
%attribute string "language",
|
|
||||||
|
|
||||||
%require "code",
|
|
||||||
%attribute string "code"
|
|
||||||
}
|
|
||||||
|
|
||||||
type User {
|
type User {
|
||||||
%attribute string "display_name",
|
%attribute string "display_name",
|
||||||
|
|
1
lib/remoting/.gitignore
vendored
Normal file
1
lib/remoting/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
remoting-type.cpp
|
@ -4,6 +4,9 @@
|
|||||||
pkglib_LTLIBRARIES = \
|
pkglib_LTLIBRARIES = \
|
||||||
libremoting.la
|
libremoting.la
|
||||||
|
|
||||||
|
.conf.cpp:
|
||||||
|
$(top_builddir)/tools/mkembedconfig $< $@
|
||||||
|
|
||||||
libremoting_la_SOURCES = \
|
libremoting_la_SOURCES = \
|
||||||
endpoint.cpp \
|
endpoint.cpp \
|
||||||
endpoint.h \
|
endpoint.h \
|
||||||
@ -15,6 +18,7 @@ libremoting_la_SOURCES = \
|
|||||||
jsonrpcconnection.h \
|
jsonrpcconnection.h \
|
||||||
messagepart.cpp \
|
messagepart.cpp \
|
||||||
messagepart.h \
|
messagepart.h \
|
||||||
|
remoting-type.cpp \
|
||||||
requestmessage.cpp \
|
requestmessage.cpp \
|
||||||
requestmessage.h \
|
requestmessage.h \
|
||||||
responsemessage.cpp \
|
responsemessage.cpp \
|
||||||
|
24
lib/remoting/remoting-type.conf
Normal file
24
lib/remoting/remoting-type.conf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* 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"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user