option(ICINGA2_WITH_PGSQL "Build the PostgreSQL IDO module" ON)
option(ICINGA2_WITH_CHECKER "Build the checker module" ON)
option(ICINGA2_WITH_COMPAT "Build the compat module" ON)
-option(ICINGA2_WITH_DEMO "Build the demo module" OFF)
-option(ICINGA2_WITH_HELLO "Build the hello module" OFF)
option(ICINGA2_WITH_LIVESTATUS "Build the Livestatus module" ON)
option(ICINGA2_WITH_NOTIFICATION "Build the notification module" ON)
option(ICINGA2_WITH_PERFDATA "Build the perfdata module" ON)
RUNTIME DESTINATION ${InstallPath}
)
-if(ICINGA2_WITH_HELLO)
- add_executable(hello-app $<TARGET_OBJECTS:icingaloader>)
- add_whole_static_library(hello-app base)
- add_whole_static_library(hello-app config)
- add_whole_static_library(hello-app remote)
- add_whole_static_library(hello-app cli)
- add_whole_static_library(hello-app hello)
-
- set_target_properties (
- hello-app PROPERTIES
- INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
- FOLDER Bin
- OUTPUT_NAME hello
- )
-
- install(
- TARGETS hello-app
- RUNTIME DESTINATION ${InstallPath}
- )
-endif()
-
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/icinga2\")")
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/icinga2\")")
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_RUNDIR}/icinga2\")")
add_subdirectory(icinga)
add_subdirectory(methods)
-if(ICINGA2_WITH_HELLO)
- add_subdirectory(hello)
-endif()
-
if(ICINGA2_WITH_CHECKER)
add_subdirectory(checker)
endif()
endif()
endif()
-if(ICINGA2_WITH_DEMO)
- add_subdirectory(demo)
-endif()
-
if(ICINGA2_WITH_LIVESTATUS)
add_subdirectory(livestatus)
endif()
+++ /dev/null
-# Icinga 2
-# Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)
-#
-# 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(demo.ti demo.tcpp demo.thpp)
-
-set(demo_SOURCES
- demo.cpp demo.hpp demo.thpp
-)
-
-if(ICINGA2_UNITY_BUILD)
- mkunity_target(demo demo demo_SOURCES)
-endif()
-
-add_library(demo STATIC ${demo_SOURCES})
-
-target_link_libraries(demo ${Boost_LIBRARIES} base config icinga remote)
-
-set_target_properties (
- demo PROPERTIES
- FOLDER Components
-)
+++ /dev/null
-/******************************************************************************
- * Icinga 2 *
- * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
- * *
- * 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 "demo/demo.hpp"
-#include "demo/demo.tcpp"
-#include "remote/apilistener.hpp"
-#include "remote/apifunction.hpp"
-#include "base/configtype.hpp"
-#include "base/logger.hpp"
-
-using namespace icinga;
-
-REGISTER_TYPE(Demo);
-
-REGISTER_APIFUNCTION(HelloWorld, demo, &Demo::DemoMessageHandler);
-
-/**
- * Starts the component.
- */
-void Demo::Start(bool runtimeCreated)
-{
- ObjectImpl<Demo>::Start(runtimeCreated);
-
- m_DemoTimer = new Timer();
- m_DemoTimer->SetInterval(5);
- m_DemoTimer->OnTimerExpired.connect(std::bind(&Demo::DemoTimerHandler, this));
- m_DemoTimer->Start();
-}
-
-/**
- * Periodically broadcasts an API message.
- */
-void Demo::DemoTimerHandler()
-{
- Dictionary::Ptr message = new Dictionary();
- message->Set("method", "demo::HelloWorld");
-
- ApiListener::Ptr listener = ApiListener::GetInstance();
- if (listener) {
- MessageOrigin::Ptr origin = new MessageOrigin();
- listener->RelayMessage(origin, nullptr, message, true);
- Log(LogInformation, "Demo", "Sent demo::HelloWorld message");
- }
-}
-
-Value Demo::DemoMessageHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr&)
-{
- Log(LogInformation, "Demo")
- << "Got demo message from '" << origin->FromClient->GetEndpoint()->GetName() << "'";
-
- return Empty;
-}
+++ /dev/null
-/******************************************************************************
- * Icinga 2 *
- * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
- * *
- * 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 DEMO_H
-#define DEMO_H
-
-#include "demo/demo.thpp"
-#include "remote/messageorigin.hpp"
-#include "base/timer.hpp"
-
-namespace icinga
-{
-
-/**
- * @ingroup demo
- */
-class Demo final : public ObjectImpl<Demo>
-{
-public:
- DECLARE_OBJECT(Demo);
- DECLARE_OBJECTNAME(Demo);
-
- void Start(bool runtimeCreated) override;
-
- static Value DemoMessageHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
-
-
-private:
- Timer::Ptr m_DemoTimer;
-
- void DemoTimerHandler();
-};
-
-}
-
-#endif /* DEMO_H */
+++ /dev/null
-/******************************************************************************
- * Icinga 2 *
- * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
- * *
- * 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 "base/configobject.hpp"
-
-library demo;
-
-namespace icinga
-{
-
-class Demo : ConfigObject
-{
-};
-
-}
+++ /dev/null
-# Icinga 2
-# Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)
-#
-# 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(helloapplication.ti helloapplication.tcpp helloapplication.thpp)
-
-set(hello_SOURCES
- helloapplication.cpp helloapplication.hpp helloapplication.thpp
-)
-
-if(ICINGA2_UNITY_BUILD)
- mkunity_target(hello hello hello_SOURCES)
-endif()
-
-add_library(hello STATIC ${hello_SOURCES})
-
-target_link_libraries(hello ${Boost_LIBRARIES} base config)
-
-set_target_properties (
- hello PROPERTIES
- FOLDER Lib
-)
+++ /dev/null
-/******************************************************************************
- * Icinga 2 *
- * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
- * *
- * 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/helloapplication.hpp"
-#include "hello/helloapplication.tcpp"
-#include "base/initialize.hpp"
-#include "base/logger.hpp"
-#include "base/scriptglobal.hpp"
-
-using namespace icinga;
-
-REGISTER_TYPE(HelloApplication);
-
-INITIALIZE_ONCE([]() {
- ScriptGlobal::Set("ApplicationType", "HelloApplication");
-});
-
-/**
- * The entry point for the hello application.
- *
- * @returns An exit status.
- */
-int HelloApplication::Main()
-{
- Log(LogInformation, "HelloApplication", "Hello World!");
-
- return 0;
-}
+++ /dev/null
-/******************************************************************************
- * Icinga 2 *
- * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
- * *
- * 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 HELLOAPPLICATION_H
-#define HELLOAPPLICATION_H
-
-#include "hello/helloapplication.thpp"
-
-namespace icinga
-{
-
-/**
- * The hello application.
- *
- * @ingroup hello
- */
-class HelloApplication final : public ObjectImpl<HelloApplication>
-{
-public:
- DECLARE_OBJECT(HelloApplication);
- DECLARE_OBJECTNAME(HelloApplication);
-
- int Main() override;
-};
-
-}
-
-#endif /* HELLOAPPLICATION_H */
+++ /dev/null
-/******************************************************************************
- * Icinga 2 *
- * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
- * *
- * 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 "base/application.hpp"
-
-library hello;
-
-namespace icinga
-{
-
-class HelloApplication : Application
-{
-};
-
-}