mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
commit
67b82a81c9
@ -115,10 +115,12 @@ static bool LoadConfigFiles(const String& appType, bool validateOnly)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
static void SigHupHandler(int)
|
static void SigHupHandler(int)
|
||||||
{
|
{
|
||||||
Application::RequestRestart();
|
Application::RequestRestart();
|
||||||
}
|
}
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
static bool Daemonize(const String& stderrFile)
|
static bool Daemonize(const String& stderrFile)
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
library "methods"
|
||||||
|
|
||||||
template CheckCommand "plugin-check-command" {
|
template CheckCommand "plugin-check-command" {
|
||||||
methods = {
|
methods = {
|
||||||
execute = "PluginCheck"
|
execute = "PluginCheck"
|
||||||
|
@ -20,3 +20,4 @@ add_subdirectory(config)
|
|||||||
add_subdirectory(icinga)
|
add_subdirectory(icinga)
|
||||||
add_subdirectory(db_ido)
|
add_subdirectory(db_ido)
|
||||||
add_subdirectory(methods)
|
add_subdirectory(methods)
|
||||||
|
add_subdirectory(hello)
|
||||||
|
@ -159,6 +159,11 @@ void Application::RunEventLoop(void) const
|
|||||||
#endif /* _DEBUG */
|
#endif /* _DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::OnShutdown(void)
|
||||||
|
{
|
||||||
|
/* Nothing to do here. */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watches for changes to the system time. Adjusts timers if necessary.
|
* Watches for changes to the system time. Adjusts timers if necessary.
|
||||||
*/
|
*/
|
||||||
|
@ -101,7 +101,7 @@ protected:
|
|||||||
|
|
||||||
void RunEventLoop(void) const;
|
void RunEventLoop(void) const;
|
||||||
|
|
||||||
virtual void OnShutdown(void) = 0;
|
virtual void OnShutdown(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Application *m_Instance; /**< The application instance. */
|
static Application *m_Instance; /**< The application instance. */
|
||||||
|
40
lib/hello/CMakeLists.txt
Normal file
40
lib/hello/CMakeLists.txt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Icinga 2
|
||||||
|
# Copyright (C) 2012-2013 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.
|
||||||
|
|
||||||
|
mkclass_target(hello.ti hello.th)
|
||||||
|
|
||||||
|
mkembedconfig_target(hello-type.conf hello-type.cpp)
|
||||||
|
|
||||||
|
add_library(hello SHARED
|
||||||
|
hello.cpp hello.th hello-type.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(hello ${Boost_LIBRARIES} base)
|
||||||
|
|
||||||
|
set_target_properties (
|
||||||
|
hello PROPERTIES
|
||||||
|
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
|
||||||
|
FOLDER Lib
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS hello
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
21
lib/hello/hello-type.conf
Normal file
21
lib/hello/hello-type.conf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Icinga 2 *
|
||||||
|
* Copyright (C) 2012-2013 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 Hello {
|
||||||
|
}
|
38
lib/hello/hello.cpp
Normal file
38
lib/hello/hello.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Icinga 2 *
|
||||||
|
* Copyright (C) 2012-2013 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 "hello/hello.h"
|
||||||
|
#include "base/dynamictype.h"
|
||||||
|
#include "base/logger_fwd.h"
|
||||||
|
|
||||||
|
using namespace icinga;
|
||||||
|
|
||||||
|
REGISTER_TYPE(Hello);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entry point for the Hello application.
|
||||||
|
*
|
||||||
|
* @returns An exit status.
|
||||||
|
*/
|
||||||
|
int Hello::Main(void)
|
||||||
|
{
|
||||||
|
Log(LogInformation, "hello", "Hello World!");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
44
lib/hello/hello.h
Normal file
44
lib/hello/hello.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Icinga 2 *
|
||||||
|
* Copyright (C) 2012-2013 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 HELLO_H
|
||||||
|
#define HELLO_H
|
||||||
|
|
||||||
|
#include "hello/hello.th"
|
||||||
|
|
||||||
|
namespace icinga
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Hello application.
|
||||||
|
*
|
||||||
|
* @ingroup hello
|
||||||
|
*/
|
||||||
|
class Hello : public ReflectionObjectImpl<Hello>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_PTR_TYPEDEFS(Hello);
|
||||||
|
DECLARE_TYPENAME(Hello);
|
||||||
|
|
||||||
|
int Main(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HELLO_H */
|
10
lib/hello/hello.ti
Normal file
10
lib/hello/hello.ti
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "base/application.h"
|
||||||
|
|
||||||
|
namespace icinga
|
||||||
|
{
|
||||||
|
|
||||||
|
class Hello : Application
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -38,8 +38,6 @@ INITIALIZE_ONCE(IcingaApplication, &IcingaApplication::StaticInitialize);
|
|||||||
|
|
||||||
void IcingaApplication::StaticInitialize(void)
|
void IcingaApplication::StaticInitialize(void)
|
||||||
{
|
{
|
||||||
(void) Utility::LoadExtensionLibrary("methods");
|
|
||||||
|
|
||||||
ScriptVariable::Set("IcingaEnableNotifications", true);
|
ScriptVariable::Set("IcingaEnableNotifications", true);
|
||||||
ScriptVariable::Set("IcingaEnableEventHandlers", true);
|
ScriptVariable::Set("IcingaEnableEventHandlers", true);
|
||||||
ScriptVariable::Set("IcingaEnableFlapping", true);
|
ScriptVariable::Set("IcingaEnableFlapping", true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user