pax_global_header00006660000000000000000000000064126255562650014530gustar00rootroot0000000000000052 comment=508e2f8998f0e25f0c677b49523893f9595f1721 icinga2-2.4.1/000077500000000000000000000000001262555626500130505ustar00rootroot00000000000000icinga2-2.4.1/.gitignore000066400000000000000000000001111262555626500150310ustar00rootroot00000000000000.vagrant *.komodoproject .*.swp .*.swo build/ build-debug/ build-release/icinga2-2.4.1/.mailmap000066400000000000000000000010571262555626500144740ustar00rootroot00000000000000 Gunnar Beutner Jean-Marcel Flach Dolf Schimmel Markus Waldmüller icinga2-2.4.1/.travis.yml000066400000000000000000000010021262555626500151520ustar00rootroot00000000000000sudo: false language: cpp compiler: - gcc addons: apt_packages: - ccache - libboost-all-dev - flex - bison - libssl-dev - libpq-dev - libmysqlclient-dev - libedit-dev - libyajl-dev - libwxbase3.0-dev - libwxgtk3.0-dev before_script: - mkdir build - cd build - export PATH="/usr/lib/ccache:$PATH" - cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/tmp/icinga2 script: - make && make test && make install && /tmp/icinga2/sbin/icinga2 --version icinga2-2.4.1/AUTHORS000066400000000000000000000055631262555626500141310ustar00rootroot00000000000000Alexander A. Klimov Alexander Fuhr Alexander Schomburg Alexander Wirt Andrew Meyer Bastian Guse Benedikt Heine Bernd Erk Blerim Sheqa Brian Dockter Bruno Lingner Carlos Cesario Christian Harke Christian Jonak Christian Lehmann Claudio Künzler David Beck Dinesh Majrekar Dirk Goetz Dolf Schimmel Edvin Seferovic Eric Lippmann Ferdi Gueran Gaël Beaudoin Gerd von Egidy Gunnar Beutner Hannes Van de Vel Hendrik Röder Ian Kelling Ildar Hizbulin James Pharaoh Jan Andres Jan Wagner Jason Young Jean-Marcel Flach Jesse Morgan Jo Goossens Johannes Meyer Jonas Meurer Joseph L. Casale Jérôme Drouet Lars Engels Lee Clemens Lennart Betz Louis Sautier Malte Rabenseifner Marcus van Dam Marius Sturm Markus Frosch Markus Waldmüller Martin Stiborsky Matthaus Owens Max Zhang Mhd Sulhan Michael Friedrich Pall Sigurdsson Paul Richards Petr Ruzicka Phil Hutchinson Ralph Breier Reto Zeder Ricardo Bartels Sam Kottler Sebastian Chrostek Simon Ruderich Siyalrach Anton Thomas Stephan Platz Steve McMaster Thomas Gelf Tim Hardeck Tobias von der Krone Tom Geissler Valentin Hoebel Wolfgang Nieder Yohan Jarosz Zoltan Nagy Élie Bouttier icinga2-2.4.1/CMakeLists.txt000066400000000000000000000327521262555626500156210ustar00rootroot00000000000000# Icinga 2 # Copyright (C) 2012-2015 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. cmake_minimum_required(VERSION 2.6) set(BOOST_MIN_VERSION "1.41.0") project(icinga2) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third-party/cmake") if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() option(ICINGA2_WITH_MYSQL "Build the MySQL IDO module" ON) 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) option(ICINGA2_WITH_STUDIO "Build the Icinga Studio application" OFF) file(STRINGS icinga2.spec VERSION_LINE REGEX "^Version: ") string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE}) include(GNUInstallDirs) include(InstallConfig) set(ICINGA2_USER "icinga" CACHE STRING "Icinga 2 user") set(ICINGA2_GROUP "icinga" CACHE STRING "Icinga 2 group") set(ICINGA2_COMMAND_GROUP "icingacmd" CACHE STRING "Icinga 2 command group") set(ICINGA2_RUNDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run" CACHE STRING "/run directory") set(ICINGA2_PLUGINDIR "/usr/lib/nagios/plugins" CACHE STRING "Path for the check plugins") set(ICINGA2_GIT_VERSION_INFO ON CACHE BOOL "Whether to use git describe") set(ICINGA2_UNITY_BUILD ON CACHE BOOL "Whether to perform a unity build") set(ICINGA2_LTO_BUILD OFF CACHE BOOL "Whether to use LTO") file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" ICINGA2_LICENSE_GPL) file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDITIONS) set(ICINGA2_LICENSE "${ICINGA2_LICENSE_GPL}\n\n---\n\n${ICINGA2_LICENSE_ADDITIONS}") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" ${ICINGA2_LICENSE}) include(GetGitRevisionDescription) git_describe(GIT_VERSION --tags) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/icinga-version.h.force) configure_file(icinga-version.h.force ${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h COPYONLY) else() if(NOT ICINGA2_GIT_VERSION_INFO OR GIT_VERSION MATCHES "-NOTFOUND$") file(STRINGS icinga2.spec SPEC_VERSION REGEX "^Version:") string(LENGTH "${SPEC_VERSION}" SPEC_VERSION_LENGTH) math(EXPR SPEC_VERSION_LENGTH "${SPEC_VERSION_LENGTH} - 9") string(SUBSTRING ${SPEC_VERSION} 9 ${SPEC_VERSION_LENGTH} SPEC_VERSION) file(STRINGS icinga2.spec SPEC_REVISION REGEX "^%define revision ") string(LENGTH "${SPEC_REVISION}" SPEC_REVISION_LENGTH) math(EXPR SPEC_REVISION_LENGTH "${SPEC_REVISION_LENGTH} - 17") string(SUBSTRING ${SPEC_REVISION} 17 ${SPEC_REVISION_LENGTH} SPEC_REVISION) set(GIT_VERSION "r${SPEC_VERSION}-${SPEC_REVISION}") endif() configure_file(icinga-version.h.cmake icinga-version.h) endif() if(WIN32) set(Boost_USE_STATIC_LIBS ON) add_definitions(-DBOOST_ALL_NO_LIB) endif() find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS thread system program_options regex REQUIRED) link_directories(${Boost_LIBRARY_DIRS}) include_directories(${Boost_INCLUDE_DIRS}) find_package(OpenSSL REQUIRED) include_directories(${OPENSSL_INCLUDE_DIR}) find_package(YAJL) if(NOT YAJL_FOUND) include_directories(${icinga2_BINARY_DIR}/third-party/yajl/include) link_directories(${icinga2_BINARY_DIR}/third-party/yajl) set(YAJL_LIBRARIES "yajl") endif() find_package(Editline) set(HAVE_EDITLINE "${EDITLINE_FOUND}") find_package(Termcap) set(HAVE_TERMCAP "${TERMCAP_FOUND}") include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/lib ) #set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) if(APPLE) set(CMAKE_INSTALL_NAME_DIR "@executable_path/..") set(CMAKE_MACOSX_RPATH 0) endif(APPLE) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -g") endif() if(CMAKE_C_COMPILER_ID STREQUAL "SunPro") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mt") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mt -library=stlport4") endif() if(CMAKE_C_COMPILER_ID STREQUAL "GNU") if(CMAKE_SYSTEM_NAME MATCHES AIX) set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -g -lpthread") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -lpthread") elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -pthread") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pthread") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpthread") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lpthread") else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") endif() if(NOT CMAKE_SYSTEM_NAME MATCHES AIX AND NOT CMAKE_SYSTEM_NAME MATCHES OpenBSD AND NOT CMAKE_SYSTEM_NAME MATCHES SunOS) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -Wl,--no-export-dynamic -Bsymbolic-functions -Wl,--dynamic-list-cpp-typeinfo -Wl,--dynamic-list-data") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--no-export-dynamic -Bsymbolic-functions -Wl,--dynamic-list-cpp-typeinfo -Wl,--dynamic-list-data") endif() endif() if(ICINGA2_LTO_BUILD) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto -fno-fat-lto-objects") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -fno-fat-lto-objects") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto") endif() include(CheckCCompilerFlag) check_c_compiler_flag(-fvisibility-inlines-hidden HAVE_VISIBILITY_INLINES_HIDDEN) if(HAVE_VISIBILITY_INLINES_HIDDEN) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility-inlines-hidden") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") endif() if(MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) endif() set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/Bin/${CMAKE_BUILD_TYPE} CACHE PATH "Library output path") set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/Bin/${CMAKE_BUILD_TYPE} CACHE PATH "Executable output path") include(CheckSymbolExists) include(CheckFunctionExists) include(CheckLibraryExists) include(CheckIncludeFileCXX) check_symbol_exists(__COUNTER__ "" HAVE_COUNTER_MACRO) if(NOT HAVE_COUNTER_MACRO AND ICINGA2_UNITY_BUILD) message(STATUS "Your C/C++ compiler does not support the __COUNTER__ macro. Disabling unity build.") set(ICINGA2_UNITY_BUILD FALSE) endif() set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DI2_DEBUG") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DI2_DEBUG") check_function_exists(vfork HAVE_VFORK) check_function_exists(backtrace_symbols HAVE_BACKTRACE_SYMBOLS) check_function_exists(pipe2 HAVE_PIPE2) check_function_exists(nice HAVE_NICE) check_library_exists(dl dladdr "dlfcn.h" HAVE_DLADDR) check_library_exists(execinfo backtrace_symbols "" HAVE_LIBEXECINFO) check_include_file_cxx(cxxabi.h HAVE_CXXABI_H) if(HAVE_LIBEXECINFO) set(HAVE_BACKTRACE_SYMBOLS TRUE) endif() if(UNIX) include(CheckCXXCompilerFlag) check_cxx_compiler_flag("-std=c++11" CXX_FLAG_CXX11) check_cxx_compiler_flag("-std=c++0x" CXX_FLAG_CXX0X) if(CXX_FLAG_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") elseif(CXX_FLAG_CXX0X) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") endif() check_cxx_compiler_flag("-Wno-inconsistent-missing-override" CXX_FLAG_NO_OVERRIDE_WARNING) if(CXX_FLAG_NO_OVERRIDE_WARNING) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override") endif() endif() include(CheckCXXSourceCompiles) check_cxx_source_compiles("class Base { public: virtual void test(void) { } }; class Derived : public Base { virtual void test(void) override { } }; int main(){}" CXX_FEATURE_OVERRIDE) if(NOT CXX_FEATURE_OVERRIDE) add_definitions("-Doverride=") endif() configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ESCAPE_QUOTES) install( FILES README.md COPYING COPYING.Exceptions AUTHORS ChangeLog NEWS DESTINATION ${CMAKE_INSTALL_DOCDIR} ) include(CTest) enable_testing() set_property(GLOBAL PROPERTY USE_FOLDERS ON) add_subdirectory(third-party) add_subdirectory(tools) add_subdirectory(lib) add_subdirectory(icinga-app) add_subdirectory(etc) add_subdirectory(itl) add_subdirectory(doc) add_subdirectory(test) add_subdirectory(agent) add_subdirectory(plugins) if(ICINGA2_WITH_STUDIO) add_subdirectory(icinga-studio) endif() set(CPACK_PACKAGE_NAME "Icinga2") set(CPACK_PACKAGE_VENDOR "Icinga Development Team") set(CPACK_PACKAGE_VERSION ${ICINGA2_VERSION}) set(CPACK_NSIS_DISPLAY_NAME "Icinga 2") set(CPACK_PACKAGE_INSTALL_DIRECTORY "ICINGA2") set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icinga-app\\\\icinga.ico") set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icinga-app\\\\icinga.ico") set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/icinga-app\\\\icinga.ico") set(CPACK_NSIS_INSTALLED_ICON_NAME "sbin\\\\icinga2.exe") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt") set(CPACK_NSIS_EXECUTABLES_DIRECTORY "sbin") set(CPACK_PACKAGE_EXECUTABLES "Icinga2SetupAgent;Icinga 2 Agent Wizard;icinga-studio;Icinga Studio") set(CPACK_NSIS_MUI_FINISHPAGE_RUN "Icinga2SetupAgent") set(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS "nsExec::Exec 'net stop icinga2'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nnsExec::Exec 'icacls \\\"$INSTDIR\\\" /grant *S-1-5-20:(oi)(ci)m'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nnsExec::Exec 'icacls \\\"$INSTDIR\\\\etc\\\" /inheritance:r /grant:r *S-1-5-20:(oi)(ci)m /grant:r *S-1-5-32-544:(oi)(ci)f'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\etc\\\\icinga2\\\\pki'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\cache\\\\icinga2'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\lib\\\\icinga2\\\\pki'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\lib\\\\icinga2\\\\agent\\\\inventory'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\lib\\\\icinga2\\\\api\\\\config'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\lib\\\\icinga2\\\\api\\\\log'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\lib\\\\icinga2\\\\api\\\\zones'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\log\\\\icinga2\\\\compat\\\\archive'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\log\\\\icinga2\\\\crash'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\run\\\\icinga2\\\\cmd'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\spool\\\\icinga2\\\\perfdata'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\spool\\\\icinga2\\\\tmp'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nnsExec::Exec '\\\"$INSTDIR\\\\sbin\\\\icinga2\\\" --scm-install daemon'") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nnsExec::Exec 'net start icinga2'") set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "nsExec::Exec '\\\"$INSTDIR\\\\sbin\\\\icinga2\\\" --scm-uninstall'") set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) include(InstallRequiredSystemLibraries) if(WIN32) set(NSCP_SHA256SUM "") if (EXISTS ${CMAKE_CURRENT_BINARY_DIR}/NSCP-Win32.msi) file(SHA256 ${CMAKE_CURRENT_BINARY_DIR}/NSCP-Win32.msi NSCP_SHA256SUM) endif() if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/NSCP-Win32.msi OR NOT ${NSCP_SHA256SUM} STREQUAL "226cef0154daf1f9b93d0e168068e723e2be407548e5c4772557401d87535b48") file(DOWNLOAD https://github.com/mickem/nscp/releases/download/0.4.3.143/NSCP-0.4.3.143-Win32.msi ${CMAKE_CURRENT_BINARY_DIR}/NSCP-Win32.msi SHOW_PROGRESS) endif() install(FILES ${CMAKE_CURRENT_BINARY_DIR}/NSCP-Win32.msi DESTINATION ${CMAKE_INSTALL_SBINDIR}) install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${OPENSSL_INCLUDE_DIR}/../bin/libeay32.dll ${OPENSSL_INCLUDE_DIR}/../bin/ssleay32.dll DESTINATION ${CMAKE_INSTALL_SBINDIR} ) endif() include(CPack) icinga2-2.4.1/COPYING000066400000000000000000000431021262555626500141030ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.icinga2-2.4.1/COPYING.Exceptions000066400000000000000000000012741262555626500162270ustar00rootroot00000000000000In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. icinga2-2.4.1/ChangeLog000066400000000000000000002357501262555626500146360ustar00rootroot00000000000000# Icinga 2.x CHANGELOG Please check [doc/1-about.md]. ## What's New ### What's New in Version 2.4.1 #### Changes * ITL * Add running_kernel_use_sudo option for the running_kernel check * Configuration * Add global constants: `PlatformName`. `PlatformVersion`, `PlatformKernel` and `PlatformKernelVersion` * CLI * Use NodeName and ZoneName constants for 'node setup' and 'node wizard' #### Feature * Feature 10622: Add by_ssh_options argument for the check_by_ssh plugin * Feature 10693: Add running_kernel_use_sudo option for the running_kernel check * Feature 10716: Use NodeName and ZoneName constants for 'node setup' and 'node wizard' #### Bugfixes * Bug 10528: Documentation example in "Access Object Attributes at Runtime" doesn't work correctly * Bug 10615: Build fails on SLES 11 SP3 with GCC 4.8 * Bug 10632: "node wizard" does not ask user to verify SSL certificate * Bug 10641: API setup command incorrectly overwrites existing certificates * Bug 10643: Icinga 2 crashes when ScheduledDowntime objects are used * Bug 10645: Documentation for schedule-downtime is missing required paremeters * Bug 10648: lib/base/process.cpp SIGSEGV on Debian squeeze / RHEL 6 * Bug 10661: Incorrect web inject URL in documentation * Bug 10663: Incorrect redirect for stderr in /usr/lib/icinga2/prepare-dirs * Bug 10667: Indentation in command-plugins.conf * Bug 10677: node wizard checks for /var/lib/icinga2/ca directory but not the files * Bug 10690: CLI command 'repository add' doesn't work * Bug 10692: Fix typos in the documentation * Bug 10708: Windows setup wizard crashes when InstallDir registry key is not set * Bug 10710: Incorrect path for icinga2 binary in development documentation * Bug 10720: Remove --master_zone from --help because it is currently not implemented ### What's New in Version 2.4.0 #### Changes * API * RESTful API with basic auth or client certificates * Filters, types, permissions * configuration package management * query/create/modify/delete config objects at runtime * status queries for global stats * actions (e.g. acknowledge all service problems) * event streams * ITL and Plugin Check Command definitions * The 'running_kernel' check command was moved to the plugins-contrib section. You have to update your config to include 'plugins-contrib' * Configuration * The global constants Enable* and Vars have been removed. Use the IcingaApplication object attributes instead. * Features * New Graphite tree. Please check the documentation how enable the legacy schema. * IcingaStatusWriter feature has been deprecated and will be removed in future versions. * Modified attributes are not exposed as bit mask to external interfaces anymore (api related changes). External commands like CHANGE_*_MODATTR have been removed. #### Feature * Feature 7709: Validators should be implemented in (auto-generated) native code * Feature 8093: Add icinga, cluster, cluster-zone check information to the ApiListener status handler * Feature 8149: graphite writer should pass "-" in host names and "." in perf data * Feature 8666: Allow some of the Array and Dictionary methods to be inlined by the compiler * Feature 8688: Add embedded DB IDO version health check * Feature 8689: Add support for current and current-1 db ido schema version * Feature 8690: 'icinga2 console' should serialize temporary attributes (rather than just config + state) * Feature 8738: Implement support for CLIENT_MULTI_STATEMENTS * Feature 8741: Deprecate IcingaStatusWriter feature * Feature 8775: Move the base command templates into libmethods * Feature 8776: Implement support for libedit * Feature 8791: Refactor the startup process * Feature 8832: Implement constructor-style casts * Feature 8842: Add support for the C++11 keyword 'override' * Feature 8867: Use DebugHint information when reporting validation errors * Feature 8890: Move implementation code from thpp files into separate files * Feature 8922: Avoid unnecessary dictionary lookups * Feature 9044: Remove the ScopeCurrent constant * Feature 9068: Implement sandbox mode for the config parser * Feature 9074: Basic API framework * Feature 9076: Reflection support for the API * Feature 9077: Implement filters for the API * Feature 9078: Event stream support for the API * Feature 9079: Implement status queries for the API * Feature 9080: Add commands (actions) for the API * Feature 9081: Add modified attribute support for the API * Feature 9082: Runtime configuration for the API * Feature 9083: Configuration file management for the API * Feature 9084: Enable the ApiListener by default * Feature 9085: Certificate-based authentication for the API * Feature 9086: Password-based authentication for the API * Feature 9087: Create default administrative user * Feature 9088: API permissions * Feature 9091: API status queries * Feature 9093: Changelog for modified attributes * Feature 9095: Disallow changes for certain config attributes at runtime * Feature 9096: Dependency tracking for objects * Feature 9098: Update modules to support adding and removing objects at runtime * Feature 9099: Implement support for writing configuration files * Feature 9100: Multiple sources for zone configuration tree * Feature 9101: Commands for adding and removing objects * Feature 9102: Support validating configuration changes * Feature 9103: Staging for configuration validation * Feature 9104: Implement config file management commands * Feature 9105: API Documentation * Feature 9175: Move 'running_kernel' check command to plugins-contrib 'operating system' section * Feature 9286: DB IDO/Livestatus: Add zone object table w/ endpoint members * Feature 9414: "-Wno-deprecated-register" compiler option breaks builds on SLES 11 * Feature 9447: Implement support for HTTP * Feature 9448: Define RESTful url schema * Feature 9461: New Graphite schema * Feature 9470: Implement URL parser * Feature 9471: Implement ApiUser type * Feature 9594: Implement base64 de- and encoder * Feature 9614: Register ServiceOK, ServiceWarning, HostUp, etc. as constants * Feature 9647: Move url to /lib/remote from /lib/base * Feature 9689: Add exceptions for Utility::MkDir{,P} * Feature 9693: Add Array::FromVector() method * Feature 9698: Implement support for X-HTTP-Method-Override * Feature 9704: String::Trim() should return a new string rather than modifying the current string * Feature 9705: Add real path sanity checks to provided file paths * Feature 9723: Documentation for config management API * Feature 9768: Update the url parsers behaviour * Feature 9777: Make Comments and Downtime types available as ConfigObject type in the API * Feature 9794: Setting global variables with i2tcl doesn't work * Feature 9849: Validation for modified attributes * Feature 9850: Re-implement events for attribute changes * Feature 9851: Remove GetModifiedAttributes/SetModifiedAttributes * Feature 9852: Implement support for . in modify_attribute * Feature 9859: Implement global modified attributes * Feature 9866: Implement support for attaching GDB to the Icinga process on crash * Feature 9914: Rename DynamicObject/DynamicType to ConfigObject/ConfigType * Feature 9919: Allow comments when parsing JSON * Feature 9921: Implement the 'base' field for the Type class * Feature 9926: Ensure that runtime config objects are persisted on disk * Feature 9927: Figure out how to sync dynamically created objects inside the cluster * Feature 9929: Add override keyword for all relevant methods * Feature 9930: Document Object#clone * Feature 9931: Implement Object#clone and rename Array/Dictionary#clone to shallow_clone * Feature 9933: Implement support for indexers in ConfigObject::RestoreAttribute * Feature 9935: Implement support for restoring modified attributes * Feature 9937: Add package attribute for ConfigObject and set its origin * Feature 9940: Implement support for filter_vars * Feature 9944: Add String::ToLower/ToUpper * Feature 9946: Remove debug messages in HttpRequest class * Feature 9953: Rename config/modules to config/packages * Feature 9960: Implement ignore_on_error keyword * Feature 10017: Use an AST node for the 'library' keyword * Feature 10038: Add plural_name field to /v1/types * Feature 10039: URL class improvements * Feature 10042: Implement a demo API client: Icinga Studio * Feature 10060: Implement joins for status queries * Feature 10116: Add global status handler for the API * Feature 10186: Make ConfigObject::{G,S}etField() method public * Feature 10194: Sanitize error status codes and messages * Feature 10202: Add documentation for api-users.conf and app.conf * Feature 10209: Rename statusqueryhandler to objectqueryhandler * Feature 10212: Move /v1/ to /v1/objects/ * Feature 10243: Provide keywords to retrieve the current file name at parse time * Feature 10257: Change object version to timestamps for diff updates on config sync * Feature 10329: Pretty-print arrays and dictionaries when converting them to strings * Feature 10368: Document that modified attributes require accept_config for cluster/clients * Feature 10374: Add check command nginx_status * Feature 10383: DB IDO should provide its connected state via /v1/status * Feature 10385: Add 'support' tracker to changelog.py * Feature 10387: Use the API for "icinga2 console" * Feature 10388: Log a warning message on unauthorized http request * Feature 10392: Original attributes list in IDO * Feature 10393: Hide internal attributes * Feature 10394: Add getter for endpoint 'connected' attribute * Feature 10407: Remove api.cpp, api.hpp * Feature 10409: Add documentation for apply+for in the language reference chapter * Feature 10423: Ability to set port on SNMP Checks * Feature 10431: Add the name for comments/downtimes next to legacy_id to DB IDO * Feature 10441: Rewrite man page * Feature 10479: Use ZoneName variable for parent_zone in node update-config * Feature 10482: Documentation: Reorganize Livestatus and alternative frontends * Feature 10503: Missing parameters for check jmx4perl * Feature 10507: Add check command negate * Feature 10509: Change GetLastStateUp/Down to host attributes * Feature 10511: Add check command mysql * Feature 10513: Add ipv4/ipv6 only to tcp and http CheckCommand * Feature 10522: Change output format for 'icinga2 console' * Feature 10547: Icinga 2 script debugger * Feature 10548: Implement CSRF protection for the API * Feature 10549: Change 'api setup' into a manual step while configuring the API * Feature 10551: Change object query result set * Feature 10566: Enhance programmatic examples for the API docs * Feature 10574: Mention wxWidget (optional) requirement in INSTALL.md * Feature 10575: Documentation for /v1/console * Feature 10576: Explain variable names for joined objects in filter expressions * Feature 10577: Documentation for the script debugger * Feature 10591: Explain DELETE for config stages/packages * Feature 10630: Update wxWidgets documentation for Icinga Studio #### Bugfixes * Bug 8822: Update OpenSSL for the Windows builds * Bug 8823: Don't allow users to instantiate the StreamLogger class * Bug 8830: Make default notifications include users from host.vars.notification.mail.users * Bug 8865: Failed assertion in IdoMysqlConnection::FieldToEscapedString * Bug 8907: Validation fails even though field is not required * Bug 8924: Specify pidfile for status_of_proc in the init script * Bug 8952: Crash in VMOps::FunctionCall * Bug 8989: pgsql driver does not have latest mysql changes synced * Bug 9015: Compiler warnings with latest HEAD 5ac5f98 * Bug 9027: PostgreSQL schema sets default timestamps w/o time zone * Bug 9053: icinga demo module can not be built * Bug 9188: Remove incorrect 'ignore where' expression from 'ssh' apply example * Bug 9455: Fix incorrect datatype for the check_source column in icinga_statehistory table * Bug 9547: Wrong vars changed handler in api events * Bug 9576: Overflow in freshness_threshold column (smallint) w/ DB IDO MySQL * Bug 9590: 'node wizard/setup' should always generate new CN certificates * Bug 9703: Problem with child nodes in http url registry * Bug 9735: Broken cluster config sync w/o include_zones * Bug 9778: Accessing field ID 0 ("prototype") fails * Bug 9793: Operator - should not work with "" and numbers * Bug 9795: ScriptFrame's 'Self' attribute gets corrupted when an expression throws an exception * Bug 9813: win32 build: S_ISDIR is undefined * Bug 9843: console autocompletion should take into account parent classes' prototypes * Bug 9868: Crash in ScriptFrame::~ScriptFrame * Bug 9872: Color codes in console prompt break line editing * Bug 9876: Crash during cluster log replay * Bug 9879: Missing conf.d or zones.d cause parse failure * Bug 9911: Do not let API users create objects with invalid names * Bug 9966: Fix formatting in mkclass * Bug 9968: Implement support for '.' when persisting modified attributes * Bug 9987: Crash in ConfigCompiler::RegisterZoneDir * Bug 10008: Don't parse config files for branches not taken * Bug 10012: Unused variable 'dobj' in configobject.tcpp * Bug 10024: HTTP keep-alive does not work with .NET WebClient * Bug 10027: Filtering by name doesn't work * Bug 10034: Unused variable console_type in consolecommand.cpp * Bug 10041: build failure: demo module * Bug 10048: Error handling in HttpClient/icinga-studio * Bug 10110: Add object_id where clause for icinga_downtimehistory * Bug 10180: API actions do not follow REST guidelines * Bug 10198: Detect infinite recursion in user scripts * Bug 10210: Move the Collection status handler to /v1/status * Bug 10211: PerfdataValue is not properly serialised in status queries * Bug 10224: URL parser is cutting off last character * Bug 10234: ASCII NULs don't work in string values * Bug 10238: Use a temporary file for modified-attributes.conf updates * Bug 10241: Properly encode URLs in Icinga Studio * Bug 10249: Config Sync shouldn't send updates for objects the client doesn't have access to * Bug 10253: /v1/objects/ returns an HTTP error when there are no objects of that type * Bug 10255: Config sync does not set endpoint syncing and plays disconnect-sync ping-pong * Bug 10256: ConfigWriter::EmitValue should format floating point values properly * Bug 10326: icinga2 repository host add does not work * Bug 10350: Remove duplicated text in section "Apply Notifications to Hosts and Services" * Bug 10355: Version updates are not working properly * Bug 10360: Icinga2 API performance regression * Bug 10371: Ensure that modified attributes work with clients with local config and no zone attribute * Bug 10386: restore_attribute does not work in clusters * Bug 10403: Escaping $ not documented * Bug 10406: Misleading wording in generated zones.conf * Bug 10410: OpenBSD: hang during ConfigItem::ActivateItems() in daemon startup * Bug 10417: 'which' isn't available in a minimal CentOS container * Bug 10422: Changing a group's attributes causes duplicate rows in the icinga_*group_members table * Bug 10433: 'dig_lookup' custom attribute for the 'dig' check command isn't optional * Bug 10436: Custom variables aren't removed from the IDO database * Bug 10439: "Command options" is empty when executing icinga2 without any argument. * Bug 10440: Improve --help output for the --log-level option * Bug 10455: Improve error handling during log replay * Bug 10456: Incorrect attribute name in the documentation * Bug 10457: Don't allow scripts to access FANoUserView attributes in sandbox mode * Bug 10461: Line continuation is broken in 'icinga2 console' * Bug 10466: Crash in IndexerExpression::GetReference when attempting to set an attribute on an object other than the current one * Bug 10473: IDO tries to execute empty UPDATE queries * Bug 10491: Unique constraint violation with multiple comment inserts in DB IDO * Bug 10495: Incorrect JSON-RPC message causes Icinga 2 to crash * Bug 10498: IcingaStudio: Accessing non-ConfigObjects causes ugly exception * Bug 10501: Plural name rule not treating edge case correcly * Bug 10504: Increase the default timeout for OS checks * Bug 10508: Figure out whether we need the Checkable attributes state_raw, last_state_raw, hard_state_raw * Bug 10510: CreatePipeOverlapped is not thread-safe * Bug 10512: Mismatch on {comment,downtime}_id vs internal name in the API * Bug 10517: Circular reference between *Connection and TlsStream objects * Bug 10518: Crash in ConfigWriter::GetKeywords * Bug 10527: Fix indentation for Dictionary::ToString * Bug 10529: Change session_token to integer timestamp * Bug 10535: Spaces do not work in command arguments * Bug 10538: Crash in ConfigWriter::EmitIdentifier * Bug 10539: Don't validate custom attributes that aren't strings * Bug 10540: Async mysql queries aren't logged in the debug log * Bug 10545: Broken build - unresolved external symbol "public: void __thiscall icinga::ApiClient::ExecuteScript... * Bug 10555: Don't try to use --gc-sections on Solaris * Bug 10556: Update OpenSSL for the Windows builds * Bug 10558: There's a variable called 'string' in filter expressions * Bug 10559: Autocompletion doesn't work in the debugger * Bug 10560: 'api setup' should create a user even when api feature is already enabled * Bug 10561: 'remove-comment' action does not support filters * Bug 10562: Documentation should not reference real host names * Bug 10563: /v1/console should only use a single permission * Bug 10568: Improve location information for errors in API filters * Bug 10569: Icinga 2 API Docs * Bug 10578: API call doesn't fail when trying to use a template that doesn't exist * Bug 10580: Detailed error message is missing when object creation via API fails * Bug 10583: modify_attribute: object cannot be cloned * Bug 10588: Documentation for /v1/types * Bug 10596: Deadlock in MacroProcessor::EvaluateFunction * Bug 10601: Don't allow users to set state attributes via PUT * Bug 10602: API overwrites (and then deletes) config file when trying to create an object that already exists * Bug 10604: Group memberships are not updated for runtime created objects * Bug 10629: Download URL for NSClient++ is incorrect * Bug 10637: Utility::FormatErrorNumber fails when error message uses arguments ### What's New in Version 2.3.11 #### Changes * Function for performing CIDR matches: cidr_match() * New methods: String#reverse and Array#reverse * New ITL command definitions: nwc_health, hpasm, squid, pgsql * Additional arguments for ITL command definitions: by_ssh, dig, pop, spop, imap, simap * Documentation updates * Various bugfixes #### Features * Feature 9183: Add timestamp support for OpenTsdbWriter * Feature 9466: Add FreeBSD setup to getting started * Feature 9812: add check command for check_nwc_health * Feature 9854: check_command for plugin check_hpasm * Feature 10004: escape_shell_arg() method * Feature 10006: Implement a way for users to resolve commands+arguments in the same way Icinga does * Feature 10057: Command Execution Bridge: Use of same endpoint names in examples for a better understanding * Feature 10109: Add check command squid * Feature 10112: Add check command pgsql * Feature 10129: Add ipv4/ipv6 only to nrpe CheckCommand * Feature 10139: expand check command dig * Feature 10142: Update debug docs for core dumps and full backtraces * Feature 10157: Update graphing section in the docs * Feature 10158: Make check_disk.exe CheckCommand Config more verbose * Feature 10161: Improve documentation for check_memory * Feature 10197: Implement the Array#reverse and String#reverse methods * Feature 10207: Find a better description for cluster communication requirements * Feature 10216: Clarify on cluster/client naming convention and add troubleshooting section * Feature 10219: Add timeout argument for pop, spop, imap, simap commands * Feature 10352: Improve timeperiod documentation * Feature 10354: New method: cidr_match() * Feature 10379: Add a debug log message for updating the program status table in DB IDO #### Bugfixes * Bug 8805: check cluster-zone returns wrong log lag * Bug 9322: sending multiple Livestatus commands rejects all except the first * Bug 10002: Deadlock in WorkQueue::Enqueue * Bug 10079: Improve error message for socket errors in Livestatus * Bug 10093: Rather use unique SID when granting rights for folders in NSIS on Windows Client * Bug 10177: Windows Check Update -> Access denied * Bug 10191: String methods cannot be invoked on an empty string * Bug 10192: null + null should not be "" * Bug 10199: Remove unnecessary MakeLiteral calls in SetExpression::DoEvaluate * Bug 10204: Config parser problem with parenthesis and newlines * Bug 10205: config checker reports wrong error on apply for rules * Bug 10235: Deadlock in TlsStream::Close * Bug 10239: Don't throw an exception when replaying the current replay log file * Bug 10245: Percent character whitespace on Windows * Bug 10254: Performance Data Labels including '=' will not be displayed correct * Bug 10262: Don't log messages we've already relayed to all relevant zones * Bug 10266: "Not after" value overflows in X509 certificates on RHEL5 * Bug 10348: Checkresultreader is unable to process host checks * Bug 10349: Missing Start call for base class in CheckResultReader * Bug 10351: Broken table layout in chapter 20 * Bug 10365: ApiListener::SyncRelayMessage doesn't send message to all zone members * Bug 10377: Wrong connection log message for global zones ### What's New in Version 2.3.10 #### Features * Feature 9218: Use the command_endpoint name as check_source value if defined #### Bugfixes * Bug 9244: String escape problem with PostgreSQL >= 9.1 and standard_conforming_strings=on * Bug 10003: Nested "outer" macro calls fails on (handled) missing "inner" values * Bug 10051: Missing fix for reload on Windows in 2.3.9 * Bug 10058: Wrong calculation for host compat state "UNREACHABLE" in DB IDO * Bug 10074: Missing zero padding for generated CA serial.txt ### What's New in Version 2.3.9 #### Changes * Fix that the first SOFT state is recognized as second SOFT state * Implemented reload functionality for Windows * New ITL check commands * Documentation updates * Various other bugfixes #### Features * Feature 9527: CheckCommand for check_interfaces * Feature 9671: Add check_yum to ITL * Feature 9675: Add check_redis to ITL * Feature 9686: Update gdb pretty printer docs w/ Python 3 * Feature 9699: Adding "-r" parameter to the check_load command for dividing the load averages by the number of CPUs. * Feature 9747: check_command for plugin check_clamd * Feature 9796: Implement Dictionary#get and Array#get * Feature 9801: Add check_jmx4perl to ITL * Feature 9811: add check command for check_mailq * Feature 9827: snmpv3 CheckCommand section improved * Feature 9882: Implement the Dictionary#keys method * Feature 9883: Use an empty dictionary for the 'this' scope when executing commands with Livestatus * Feature 9985: add check command nscp-local-counter * Feature 9996: Add new arguments openvmtools for Open VM Tools #### Bugfixes * Bug 8979: Missing DEL_DOWNTIME_BY_HOST_NAME command required by Classic UI 1.x * Bug 9262: cluster check w/ immediate parent and child zone endpoints * Bug 9623: missing config warning on empty port in endpoints * Bug 9769: Set correct X509 version for certificates * Bug 9773: Add log for missing EventCommand for command_endpoints * Bug 9779: Trying to set a field for a non-object instance fails * Bug 9782: icinga2 node wizard don't take zone_name input * Bug 9806: Operator + is inconsistent when used with empty and non-empty strings * Bug 9814: Build fix for Boost 1.59 * Bug 9835: Dict initializer incorrectly re-initializes field that is set to an empty string * Bug 9860: missing check_perfmon.exe * Bug 9867: Agent freezes when the check returns massive output * Bug 9884: Warning about invalid API function icinga::Hello * Bug 9897: First SOFT state is recognized as second SOFT state * Bug 9902: typo in docs * Bug 9912: check_command interfaces option match_aliases has to be boolean * Bug 9913: Default disk checks on Windows fail because check_disk doesn't support -K * Bug 9928: Add missing category for IDO query * Bug 9947: Serial number field is not properly initialized for CA certificates * Bug 9961: Don't re-download NSCP for every build * Bug 9962: Utility::Glob on Windows doesn't support wildcards in all but the last path component * Bug 9972: Icinga2 - too many open files - Exception * Bug 9984: fix check command nscp-local * Bug 9992: Duplicate severity type in the documentation for SyslogLogger ### What's New in Version 2.3.8 #### Changes * Bugfixes #### Bugfixes * Bug 9554: Don't allow "ignore where" for groups when there's no "assign where" * Bug 9634: DB IDO: Do not update endpointstatus table on config updates * Bug 9637: Wrong parameter for CheckCommand "ping-common-windows" * Bug 9665: Escaping does not work for OpenTSDB perfdata plugin * Bug 9666: checkcommand disk does not check free inode - check_disk ### What's New in Version 2.3.7 #### Changes * Bugfixes #### Features * Feature 9610: Enhance troubleshooting ssl errors & cluster replay log #### Bugfixes * Bug 9406: Selective cluster reconnecting breaks client communication * Bug 9535: Config parser ignores "ignore" in template definition * Bug 9584: Incorrect return value for the macro() function * Bug 9585: Wrong formatting in DB IDO extensions docs * Bug 9586: DB IDO: endpoint* tables are cleared on reload causing constraint violations * Bug 9621: Assertion failed in icinga::ScriptUtils::Intersection * Bug 9622: Missing lock in ScriptUtils::Union ### What's New in Version 2.3.6 #### Changes * Require openssl1 on sles11sp3 from Security Module repository * Bug in SLES 11's OpenSSL version 0.9.8j preventing verification of generated certificates. * Re-create these certificates with 2.3.6 linking against openssl1 (cli command or CSR auto-signing). * ITL: Add ldap, ntp_peer, mongodb and elasticsearch CheckCommand definitions * Bugfixes #### Features * Feature 6714: add pagerduty notification documentation * Feature 9172: Add "ldap" CheckCommand for "check_ldap" plugin * Feature 9191: Add "mongodb" CheckCommand definition * Feature 9415: Add elasticsearch checkcommand to itl * Feature 9416: snmpv3 CheckCommand: Add possibility to set securityLevel * Feature 9451: Merge documentation fixes from GitHub * Feature 9523: Add ntp_peer CheckCommand * Feature 9562: Add new options for ntp_time CheckCommand * Feature 9578: new options for smtp CheckCommand #### Bugfixes * Bug 9205: port empty when using icinga2 node wizard * Bug 9253: Incorrect variable name in the ITL * Bug 9303: Missing 'snmp_is_cisco' in Manubulon snmp-memory command definition * Bug 9436: Functions can't be specified as command arguments * Bug 9450: node setup: indent accept_config and accept_commands * Bug 9452: Wrong file reference in README.md * Bug 9456: Windows client w/ command_endpoint broken with $nscp_path$ and NscpPath detection * Bug 9463: Incorrect check_ping.exe parameter in the ITL * Bug 9476: Documentation for checks in an HA zone is wrong * Bug 9481: Fix stability issues in the TlsStream/Stream classes * Bug 9489: Add log message for discarded cluster events (e.g. from unauthenticated clients) * Bug 9490: Missing openssl verify in cluster troubleshooting docs * Bug 9513: itl/plugins-contrib.d/*.conf should point to PluginContribDir * Bug 9522: wrong default port documentated for nrpe * Bug 9549: Generated certificates cannot be verified w/ openssl 0.9.8j on SLES 11 * Bug 9558: mysql-devel is not available in sles11sp3 * Bug 9563: Update getting started for Debian Jessie ### What's New in Version 2.3.5 #### Changes * NSClient++ is now bundled with the Windows setup wizard and can optionally be installed * Windows Wizard: "include " is set by default * Windows Wizard: Add update mode * Plugins: Add check_perfmon plugin for Windows * ITL: Add CheckCommand objects for Windows plugins ("include ") * ITL: Add CheckCommand definitions for "mongodb", "iftraffic", "disk_smb" * ITL: Add arguments to CheckCommands "dns", "ftp", "tcp", "nscp" #### Features * Feature 8116: Extend Windows installer with an update mode * Feature 8180: Add documentation and CheckCommands for the windows plugins * Feature 8809: Add check_perfmon plugin for Windows * Feature 9115: Add SHOWALL to NSCP Checkcommand * Feature 9130: Add 'check_drivesize' as nscp-local check command * Feature 9145: Add arguments to "dns" CheckCommand * Feature 9146: Add arguments to "ftp" CheckCommand * Feature 9147: Add arguments to "tcp" CheckCommand * Feature 9176: ITL Documentation: Add a link for passing custom attributes as command parameters * Feature 9180: Include Windows support details in the documentation * Feature 9185: Add timestamp support for PerfdataWriter * Feature 9191: Add "mongodb" CheckCommand definition * Feature 9238: Bundle NSClient++ in Windows Installer * Feature 9254: Add 'disk_smb' Plugin CheckCommand definition * Feature 9256: Determine NSClient++ installation path using MsiGetComponentPath * Feature 9260: Include by default on Windows * Feature 9261: Add the --load-all and --log options for nscp-local * Feature 9263: Add support for installing NSClient++ in the Icinga 2 Windows wizard * Feature 9270: Update service apply for documentation * Feature 9272: Add 'iftraffic' to plugins-contrib check command definitions * Feature 9285: Best practices: cluster config sync * Feature 9297: Add examples for function usage in "set_if" and "command" attributes * Feature 9310: Add typeof in 'assign/ignore where' expression as example * Feature 9311: Add local variable scope for *Command to documentation (host, service, etc) * Feature 9313: Use a more simple example for passing command parameters * Feature 9318: Explain string concatenation in objects by real-world example * Feature 9363: Update documentation for escape sequences * Feature 9419: Enhance cluster/client troubleshooting * Feature 9420: Enhance cluster docs with HA command_endpoints * Feature 9431: Documentation: Move configuration before advanced topics #### Bugfixes * Bug 8853: Syntax Highlighting: host.address vs host.add * Bug 8888: Icinga2 --version: Error showing Distribution * Bug 8891: Node wont connect properly to master if host is is not set for Endpoint on new installs * Bug 9055: Wrong timestamps w/ historical data replay in DB IDO * Bug 9109: WIN: syslog is not an enable-able feature in windows * Bug 9116: node update-config reports critical and warning * Bug 9121: Possible DB deadlock * Bug 9131: Missing ")" in last Apply Rules example * Bug 9142: Downtimes are always "fixed" * Bug 9143: Incorrect type and state filter mapping for User objects in DB IDO * Bug 9161: 'disk': wrong order of threshold command arguments * Bug 9187: SPEC: Give group write permissions for perfdata dir * Bug 9205: port empty when using icinga2 node wizard * Bug 9222: Missing custom attributes in backends if name is equal to object attribute * Bug 9253: Incorrect variable name in the ITL * Bug 9255: --scm-installs fails when the service is already installed * Bug 9258: Some checks in the default Windows configuration fail * Bug 9259: Disk and 'icinga' services are missing in the default Windows config * Bug 9268: Typo in Configuration Best Practice * Bug 9269: Wrong permission etc on windows * Bug 9324: Multi line output not correctly handled from compat channels * Bug 9328: Multiline vars are broken in objects.cache output * Bug 9372: plugins-contrib.d/databases.conf: wrong argument for mssql_health * Bug 9389: Documentation: Typo * Bug 9390: Wrong service table attributes in Livestatus documentation * Bug 9393: Documentation: Extend Custom Attributes with the boolean type * Bug 9394: Including on Linux fails with unregistered function * Bug 9399: Documentation: Typo * Bug 9406: Selective cluster reconnecting breaks client communication * Bug 9412: Documentation: Update the link to register a new Icinga account ### What's New in Version 2.3.4 #### Changes * ITL: Check commands for various databases * Improve validation messages for time periods * Update max_check_attempts in generic-{host,service} templates * Update logrotate configuration * Bugfixes #### Features * Feature 8760: Add database plugins to ITL * Feature 8803: Agent Wizard: add options for API defaults * Feature 8893: Improve timeperiod validation error messages * Feature 8895: Add explanatory note for Icinga2 client documentation #### Bugfixes * Bug 8808: logrotate doesn't work on Ubuntu * Bug 8821: command_endpoint check_results are not replicated to other endpoints in the same zone * Bug 8879: Reword documentation of check_address * Bug 8881: Add arguments to the UPS check * Bug 8889: Fix a minor markdown error * Bug 8892: Validation errors for time ranges which span the DST transition * Bug 8894: Default max_check_attempts should be lower for hosts than for services * Bug 8913: Windows Build: Flex detection * Bug 8917: Node wizard should only accept 'y', 'n', 'Y' and 'N' as answers for boolean questions * Bug 8919: Fix complexity class for Dictionary::Get * Bug 8987: Fix a typo * Bug 9012: Typo in graphite feature enable documentation * Bug 9014: Don't update scheduleddowntime table w/ trigger_time column when only adding a downtime * Bug 9016: Downtimes which have been triggered are not properly recorded in the database * Bug 9017: scheduled_downtime_depth column is not reset when a downtime ends or when a downtime is being removed * Bug 9021: Multiple log messages w/ "Attempting to send notifications for notification object" * Bug 9041: Acknowledging problems w/ expire time does not add the expiry information to the related comment for IDO and compat * Bug 9045: Vim syntax: Match groups before host/service/user objects * Bug 9049: check_disk order of command arguments * Bug 9050: web.conf is not in the RPM package * Bug 9064: troubleshoot truncates crash reports * Bug 9069: Documentation: set_if usage with boolean values and functions * Bug 9073: custom attributes with recursive macro function calls causing sigabrt ### What's New in Version 2.3.3 #### Changes * New function: parse_performance_data * Include more details in --version * Improve documentation * Bugfixes #### Features * Feature 8685: Show state/type filter names in notice/debug log * Feature 8686: Update documentation for "apply for" rules * Feature 8693: New function: parse_performance_data * Feature 8740: Add "access objects at runtime" examples to advanced section * Feature 8761: Include more details in --version * Feature 8816: Add "random" CheckCommand for test and demo purposes * Feature 8827: Move release info in INSTALL.md into a separate file #### Bugfixes * Bug 8660: Update syntax highlighting for 2.3 features * Bug 8677: Re-order the object types in alphabetical order * Bug 8724: Missing config validator for command arguments 'set_if' * Bug 8734: startup.log broken when the DB schema needs an update * Bug 8736: Don't update custom vars for each status update * Bug 8748: Don't ignore extraneous arguments for functions * Bug 8749: Build warnings with CMake 3.1.3 * Bug 8750: Flex version check does not reject unsupported versions * Bug 8753: Fix a typo in the documentation of ICINGA2_WITH_MYSQL and ICINGA2_WITH_PGSQL * Bug 8755: Fix VIM syntax highlighting for comments * Bug 8757: Add missing keywords in the syntax highlighting files * Bug 8762: Plugin "check_http" is missing in Windows environments * Bug 8763: Typo in doc library-reference * Bug 8764: Revamp migration documentation * Bug 8765: Explain processing logic/order of apply rules with for loops * Bug 8766: Remove prompt to create a TicketSalt from the wizard * Bug 8767: Typo and invalid example in the runtime macro documentation * Bug 8769: Improve error message for invalid field access * Bug 8770: object Notification + apply Service fails with error "...refers to service which doesn't exist" * Bug 8771: Correct HA documentation * Bug 8829: Figure out why command validators are not triggered * Bug 8834: Return doesn't work inside loops * Bug 8844: Segmentation fault when executing "icinga2 pki new-cert" * Bug 8862: wrong 'dns_lookup' custom attribute default in command-plugins.conf * Bug 8866: Fix incorrect perfdata templates in the documentation * Bug 8869: Array in command arguments doesn't work ### What's New in Version 2.3.2 #### Changes * Bugfixes #### Bugfixes * Bug 8721: Log message for cli commands breaks the init script ### What's New in Version 2.3.1 #### Changes * Bugfixes Please note that this version fixes the default thresholds for the disk check which were inadvertently broken in 2.3.0; if you're using percent-based custom thresholds you will need to add the '%' sign to your custom attributes #### Features * Feature 8659: Implement String#contains #### Bugfixes * Bug 8540: Kill signal sent only to check process, not whole process group * Bug 8657: Missing program name in 'icinga2 --version' * Bug 8658: Fix check_disk thresholds: make sure partitions are the last arguments * Bug 8672: Api heartbeat message response time problem * Bug 8673: Fix check_disk default thresholds and document the change of unit * Bug 8679: Config validation fail because of unexpected new-line * Bug 8680: Update documentation for DB IDO HA Run-Once * Bug 8683: Make sure that the /var/log/icinga2/crash directory exists * Bug 8684: Fix formatting for the GDB stacktrace * Bug 8687: Crash in Dependency::Stop * Bug 8691: Debian packages do not create /var/log/icinga2/crash ### What's New in Version 2.3.0 #### Changes * Improved configuration validation * Unnecessary escapes are no longer permitted (e.g. \') * Dashes are no longer permitted in identifier names (as their semantics are ambiguous) * Unused values are detected (e.g. { "-M" }) * Validation for time ranges has been improved * Additional validation rules for some object types (Notification and User) * New language features * Implement a separate type for boolean values * Support for user-defined functions * Support for conditional statements (if/else) * Support for 'for' and 'while' loops * Support for local variables using the 'var' keyword * New operators: % (modulo), ^ (xor), - (unary minus) and + (unary plus) * Implemented prototype-based methods for most built-in types (e.g. [ 3, 2 ].sort()) * Explicit access to local and global variables using the 'locals' and 'globals' keywords * Changed the order in which filters are evaluated for apply rules with 'for' * Make type objects accessible as global variables * Support for using functions in custom attributes * Access objects and their runtime attributes in functions (e.g. get_host(NodeName).state) * ITL improvements * Additional check commands were added to the ITL * Additional arguments for existing check commands * CLI improvements * Add the 'icinga2 console' CLI command which can be used to test expressions * Add the 'icinga2 troubleshoot' CLI command for collecting troubleshooting information * Performance improvements for the 'icinga2 node update-config' CLI command * Implement argument auto-completion for short options (e.g. daemon -c) * 'node setup' and 'node wizard' create backups for existing certificate files * Add ignore_soft_states option for Dependency object configuration * Fewer threads are used for socket I/O * Flapping detection for hosts and services is disabled by default * Added support for OpenTSDB * New Livestatus tables: hostsbygroup, servicesbygroup, servicesbyhostgroup * Include GDB backtrace in crash reports * Various documentation improvements * Solved a number of issues where cluster instances would not reconnect after intermittent connection problems * A lot of other, minor changes * [DB IDO schema upgrade](17-upgrading-icinga-2.md#upgrading-icinga-2) to `1.13.0` required! #### Features * Feature 3446: Add troubleshooting collect cli command * Feature 6109: Don't spawn threads for network connections * Feature 6570: Disallow side-effect-free r-value expressions in expression lists * Feature 6697: Plugin Check Commands: add check_vmware_esx * Feature 6857: Run CheckCommands with C locale (workaround for comma vs dot and plugin api bug) * Feature 6858: Add some more PNP details * Feature 6868: Disable flapping detection by default * Feature 6923: IDO should fill program_end_time on a clean shutdown * Feature 7136: extended Manubulon SNMP Check Plugin Command * Feature 7209: ITL: Interfacetable * Feature 7256: Add OpenTSDB Writer * Feature 7292: ITL: Check_Mem.pl * Feature 7294: ITL: ESXi-Hardware * Feature 7326: Add parent soft states option to Dependency object configuration * Feature 7361: Livestatus: Add GroupBy tables: hostsbygroup, servicesbygroup, servicesbyhostgroup * Feature 7545: Please add labels in SNMP checks * Feature 7564: Access object runtime attributes in custom vars & command arguments * Feature 7610: Variable from for loop not usable in assign statement * Feature 7700: Evaluate apply/object rules when the parent objects are created * Feature 7702: Add an option that hides CLI commands * Feature 7704: ConfigCompiler::HandleInclude* should return an AST node * Feature 7706: ConfigCompiler::Compile* should return an AST node * Feature 7748: Redesign how stack frames work for scripts * Feature 7767: Rename _DEBUG to I2_DEBUG * Feature 7774: Implement an AST Expression for T_CONST * Feature 7778: Missing check_disk output on Windows * Feature 7784: Implement the DISABLE_HOST_SVC_NOTIFICATIONS and ENABLE_HOST_SVC_NOTIFICATIONS commands * Feature 7793: Don't build db_ido when both MySQL and PostgreSQL aren't enabled * Feature 7794: Implement an option to disable building the Livestatus module * Feature 7795: Implement an option to disable building the Demo component * Feature 7805: Implement unit tests for the config parser * Feature 7807: Move the cast functions into libbase * Feature 7813: Implement the % operator * Feature 7816: Document operator precedence * Feature 7822: Make the config parser thread-safe * Feature 7823: Figure out whether Number + String should implicitly convert the Number argument to a string * Feature 7824: Implement the "if" and "else" keywords * Feature 7873: Plugin Check Commands: Add icmp * Feature 7879: Windows agent is missing the standard plugin check_ping * Feature 7883: Implement official support for user-defined functions and the "for" keyword * Feature 7901: Implement socket_path attribute for the IdoMysqlConnection class * Feature 7910: The lexer shouldn't accept escapes for characters which don't have to be escaped * Feature 7925: Move the config file for the ido-*sql features into the icinga2-ido-* packages * Feature 8016: Documentation enhancement for snmp traps and passive checks. * Feature 8019: Register type objects as global variables * Feature 8020: Improve output of ToString for type objects * Feature 8030: Evaluate usage of function() * Feature 8033: Allow name changed from inside the object * Feature 8040: Disallow calling strings as functions * Feature 8043: Implement a boolean sub-type for the Value class * Feature 8047: ConfigCompiler::HandleInclude should return an inline dictionary * Feature 8060: Windows plugins should behave like their Linux cousins * Feature 8065: Implement a way to remove dictionary keys * Feature 8071: Implement a way to call methods on objects * Feature 8074: Figure out how variable scopes should work * Feature 8078: Backport i2tcl's error reporting functionality into "icinga2 console" * Feature 8096: Document the new language features in 2.3 * Feature 8121: feature enable should use relative symlinks * Feature 8133: Implement line-continuation for the "console" command * Feature 8169: Implement additional methods for strings * Feature 8172: Assignments shouldn't have a "return" value * Feature 8195: Host/Service runtime macro downtime_depth * Feature 8226: Make invalid log-severity option output an error instead of a warning * Feature 8244: Implement keywords to explicitly access globals/locals * Feature 8259: The check "hostalive" is not working with ipv6 * Feature 8269: Implement the while keyword * Feature 8277: Add macros $host.check_source$ and $service.check_source$ * Feature 8290: Make operators &&, || behave like in JavaScript * Feature 8291: Implement validator support for function objects * Feature 8293: The Zone::global attribute is not documented * Feature 8316: Extend disk checkcommand * Feature 8322: Implement Array#join * Feature 8371: Add path information for objects in object list * Feature 8374: Add timestamp support for Graphite * Feature 8386: Add documentation for cli command 'console' * Feature 8393: Implement support for Json.encode and Json.decode * Feature 8394: Implement continue/break keywords * Feature 8399: Backup certificate files in 'node setup' * Feature 8410: udp check command is missing arguments. * Feature 8414: Add ITL check command for check_ipmi_sensor * Feature 8429: add webinject checkcommand * Feature 8465: Add the ability to use a CA certificate as a way of verifying hosts for CSR autosigning * Feature 8467: introduce time dependent variable values * Feature 8498: Snmp CheckCommand misses various options * Feature 8515: Show slave lag for the cluster-zone check * Feature 8522: Update Remote Client/Distributed Monitoring Documentation * Feature 8527: Change Livestatus query log level to 'notice' * Feature 8548: Add support for else-if * Feature 8575: Include GDB backtrace in crash reports * Feature 8599: Remove macro argument for IMPL_TYPE_LOOKUP * Feature 8600: Add validator for time ranges in ScheduledDowntime objects * Feature 8610: Support the SNI TLS extension * Feature 8621: Add check commands for NSClient++ * Feature 8648: Document closures ('use') #### Bugfixes * Bug 6171: Remove name and return value for stats functions * Bug 6959: Scheduled start time will be ignored if the host or service is already in a problem state * Bug 7311: Invalid macro results in exception * Bug 7542: Update validators for CustomVarObject * Bug 7576: validate configured legacy timeperiod ranges * Bug 7582: Variable expansion is single quoted. * Bug 7644: Unity build doesn't work with MSVC * Bug 7647: Avoid rebuilding libbase when the version number changes * Bug 7731: Reminder notifications not being sent but logged every 5 secs * Bug 7765: DB IDO: Duplicate entry icinga_{host,service}dependencies * Bug 7800: Fix the shift/reduce conflicts in the parser * Bug 7802: Change parameter type for include and include_recursive to T_STRING * Bug 7808: Unterminated string literals should cause parser to return an error * Bug 7809: Scoping rules for "for" are broken * Bug 7810: Return values for functions are broken * Bug 7811: The __return keyword is broken * Bug 7812: Validate array subscripts * Bug 7814: Set expression should check whether LHS is a null pointer * Bug 7815: - operator doesn't work in expressions * Bug 7826: Compiler warnings * Bug 7830: - shouldn't be allowed in identifiers * Bug 7871: Missing persistent_comment, notify_contact columns for acknowledgement table * Bug 7894: Fix warnings when using CMake 3.1.0 * Bug 7895: Serialize() fails to serialize objects which don't have a registered type * Bug 7995: Windows Agent: Missing directory "zones" in setup * Bug 8018: Value("").IsEmpty() should return true * Bug 8029: operator precedence for % and > is incorrect * Bug 8041: len() overflows * Bug 8061: Confusing error message for import * Bug 8067: Require at least one user for notification objects (user or as member of user_groups) * Bug 8076: icinga 2 Config Error needs to be more verbose * Bug 8081: Location info for strings is incorrect * Bug 8100: POSTGRES IDO: invalid syntax for integer: "true" while trying to update table icinga_hoststatus * Bug 8111: User::ValidateFilters isn't being used * Bug 8117: Agent checks fail when there's already a host with the same name * Bug 8122: Config file passing validation causes segfault * Bug 8132: Debug info for indexer is incorrect * Bug 8136: Icinga crashes when config file name is invalid * Bug 8164: escaped backslash in string literals * Bug 8166: parsing include_recursive * Bug 8173: Segfault on icinga::String::operator= when compiling configuration * Bug 8175: Compiler warnings * Bug 8179: Exception on missing config files * Bug 8184: group assign fails with bad lexical cast when evaluating rules * Bug 8185: Argument auto-completion doesn't work for short options * Bug 8211: icinga2 node update should not write config for blacklisted zones/host * Bug 8230: Lexer term for T_ANGLE_STRING is too aggressive * Bug 8249: Problems using command_endpoint inside HA zone * Bug 8257: Report missing command objects on remote agent * Bug 8260: icinga2 node wizard: Create backups of certificates * Bug 8289: Livestatus operator =~ is not case-insensitive * Bug 8294: Running icinga2 command as non privilged user raises error * Bug 8298: notify flag is ignored in ACKNOWLEDGE_*_PROBLEM commands * Bug 8300: ApiListener::ReplayLog shouldn't hold mutex lock during call to Socket::Poll * Bug 8307: PidPath, VarsPath, ObjectsPath and StatePath no longer read from init.conf * Bug 8309: Crash in ScheduledDowntime::CreateNextDowntime * Bug 8313: Incorrectly formatted timestamp in .timestamp file * Bug 8318: Remote Clients: Add manual setup cli commands * Bug 8323: Apply rule '' for host does not match anywhere! * Bug 8333: Icinga2 master doesn't change check-status when "accept_commands = true" is not set at client node * Bug 8372: Stacktrace on Endpoint not belonging to a zone or multiple zones * Bug 8383: last_hard_state missing in StatusDataWriter * Bug 8387: StatusDataWriter: Wrong host notification filters (broken fix in #8192) * Bug 8388: Config sync authoritative file never created * Bug 8389: Added downtimes must be triggered immediately if checkable is Not-OK * Bug 8390: Agent writes CR CR LF in synchronized config files * Bug 8397: Icinga2 config reset after package update (centos6.6) * Bug 8425: DB IDO: Duplicate entry icinga_scheduleddowntime * Bug 8433: Make the arguments for the stats functions const-ref * Bug 8434: Build fails on OpenBSD * Bug 8436: Indicate that Icinga2 is shutting down in case of a fatal error * Bug 8438: DB IDO {host,service}checks command_line value is "Object of type 'icinga::Array'" * Bug 8444: Don't attempt to restore program state from non-existing state file * Bug 8452: Livestatus query on commands table with custom vars fails * Bug 8461: Don't request heartbeat messages until after we've synced the log * Bug 8473: Exception in WorkQueue::StatusTimerHandler * Bug 8488: Figure out why 'node update-config' becomes slow over time * Bug 8493: Misleading ApiListener connection log messages on a master (Endpoint vs Zone) * Bug 8496: Icinga doesn't update long_output in DB * Bug 8511: Deadlock with DB IDO dump and forcing a scheduled check * Bug 8517: Config parser fails non-deterministic on Notification missing Checkable * Bug 8519: apply-for incorrectly converts loop var to string * Bug 8529: livestatus limit header not working * Bug 8535: Crash in ApiEvents::RepositoryTimerHandler * Bug 8536: Valgrind warning for ExternalCommandListener::CommandPipeThread * Bug 8537: Crash in DbObject::SendStatusUpdate * Bug 8544: Hosts: process_performance_data = 0 in database even though enable_perfdata = 1 in config * Bug 8555: Don't accept config updates for zones for which we have an authoritative copy of the config * Bug 8559: check_memory tool shows incorrect memory size on windows * Bug 8593: Memory leak in Expression::GetReference * Bug 8594: Improve Livestatus query performance * Bug 8596: Dependency: Validate *_{host,service}_name objects on their existance * Bug 8604: Attribute hints don't work for nested attributes * Bug 8627: Icinga2 shuts down when service is reloaded * Bug 8638: Fix a typo in documentation ### What's New in Version 2.2.4 #### Changes * Bugfixes #### Bugfixes * Bug #6943: Configured recurring downtimes not applied on saturdays * Bug #7660: livestatus / nsca / etc submits are ignored during reload * Bug #7685: kUn-Bashify mail-{host,service}-notification.sh * Bug #8128: Icinga 2.2.2 build fails on SLES11SP3 because of changed boost dependency * Bug #8131: vfork() hangs on OS X * Bug #8162: Satellite doesn't use manually supplied 'local zone name' * Bug #8192: Feature statusdata shows wrong host notification options * Bug #8201: Update Icinga Web 2 uri to /icingaweb2 * Bug #8214: Fix YAJL detection on Debian squeeze * Bug #8222: inconsistent URL http(s)://www.icinga.org * Bug #8223: Typos in readme file for windows plugins * Bug #8245: check_ssmtp command does NOT support mail_from * Bug #8256: Restart fails after deleting a Host * Bug #8288: Crash in DbConnection::ProgramStatusHandler * Bug #8295: Restart of Icinga hangs * Bug #8299: Scheduling downtime for host and all services only schedules services * Bug #8311: Segfault in Checkable::AddNotification * Bug #8321: enable_event_handlers attribute is missing in status.dat * Bug #8368: Output in "node wizard" is confusing ### What's New in Version 2.2.3 #### Changes * Bugfixes #### Bugfixes * Bug #8063: Volatile checks trigger invalid notifications on OK->OK state changes * Bug #8125: Incorrect ticket shouldn't cause "node wizard" to terminate * Bug #8126: Icinga 2.2.2 doesn't build on i586 SUSE distributions * Bug #8143: Windows plugin check_service.exe can't find service NTDS * Bug #8144: Arguments without values are not used on plugin exec * Bug #8147: check_interval must be greater than 0 error on update-config * Bug #8152: DB IDO query queue limit reached on reload * Bug #8171: Typo in example of StatusDataWriter * Bug #8178: Icinga 2.2.2 segfaults on FreeBSD * Bug #8181: icinga2 node update config shows hex instead of human readable names * Bug #8182: Segfault on update-config old empty config ### What's New in Version 2.2.2 #### Changes * Bugfixes #### Bugfixes * Bug #7045: icinga2 init-script doesn't validate configuration on reload action * Bug #7064: Missing host downtimes/comments in Livestatus * Bug #7301: Docs: Better explaination of dependency state filters * Bug #7314: double macros in command arguments seems to lead to exception * Bug #7511: Feature `compatlog' should flush output buffer on every new line * Bug #7518: update-config fails to create hosts * Bug #7591: CPU usage at 100% when check_interval = 0 in host object definition * Bug #7618: Repository does not support services which have a slash in their name * Bug #7683: If a parent host goes down, the child host isn't marked as unrechable in the db ido * Bug #7707: "node wizard" shouldn't crash when SaveCert fails * Bug #7745: Cluster heartbeats need to be more aggressive * Bug #7769: The unit tests still crash sometimes * Bug #7863: execute checks locally if command_endpoint == local endpoint * Bug #7878: Segfault on issuing node update-config * Bug #7882: Improve error reporting when libmysqlclient or libpq are missing * Bug #7891: CLI `icinga2 node update-config` doesn't sync configs from remote clients as expected * Bug #7913: /usr/lib/icinga2 is not owned by a package * Bug #7914: SUSE packages %set_permissions post statement wasn't moved to common * Bug #7917: update_config not updating configuration * Bug #7920: Test Classic UI config file with Apache 2.4 * Bug #7929: Apache 2.2 fails with new apache conf * Bug #8002: typeof() seems to return null for arrays and dictionaries * Bug #8003: SIGABRT while evaluating apply rules * Bug #8028: typeof does not work for numbers * Bug #8039: Livestatus: Replace unixcat with nc -U * Bug #8048: Wrong command in documentation for installing Icinga 2 pretty printers. * Bug #8050: exception during config check * Bug #8051: Update host examples in Dependencies for Network Reachability documentation * Bug #8058: DB IDO: Missing last_hard_state column update in {host,service}status tables * Bug #8059: Unit tests fail on FreeBSD * Bug #8066: Setting a dictionary key to null does not cause the key/value to be removed * Bug #8070: Documentation: Add note on default notification interval in getting started notifications.conf * Bug #8075: No option to specify timeout to check_snmp and snmp manubulon commands ### What's New in Version 2.2.1 #### Changes * Support arrays in [command argument macros](#command-passing-parameters) #6709 * Allows to define multiple parameters for [nrpe -a](#plugin-check-command-nrpe), [nscp -l](#plugin-check-command-nscp), [disk -p](#plugin-check-command-disk), [dns -a](#plugin-check-command-dns). * Bugfixes #### Features * Feature #6709: Support for arrays in macros * Feature #7463: Update spec file to use yajl-devel * Feature #7739: The classicui Apache conf doesn't support Apache 2.4 * Feature #7747: Increase default timeout for NRPE checks * Feature #7867: Document how arrays in macros work #### Bugfixes * Bug #7173: service icinga2 status gives wrong information when run as unprivileged user * Bug #7602: livestatus large amount of submitting unix socket command results in broken pipes * Bug #7613: icinga2 checkconfig should fail if group given for command files does not exist * Bug #7671: object and template with the same name generate duplicate object error * Bug #7708: Built-in commands shouldn't be run on the master instance in remote command execution mode * Bug #7725: Windows wizard uses incorrect CLI command * Bug #7726: Windows wizard is missing --zone argument * Bug #7730: Restart Icinga - Error Restoring program state from file '/var/lib/icinga2/icinga2.state' * Bug #7735: 2.2.0 has out-of-date icinga2 man page * Bug #7738: Systemd rpm scripts are run in wrong package * Bug #7740: /usr/sbin/icinga-prepare-dirs conflicts in the bin and common package * Bug #7741: Icinga 2.2 misses the build requirement libyajl-devel for SUSE distributions * Bug #7743: Icinga2 node add failed with unhandled exception * Bug #7754: Incorrect error message for localhost * Bug #7770: Objects created with node update-config can't be seen in Classic UI * Bug #7786: Move the icinga2-prepare-dirs script elsewhere * Bug #7806: !in operator returns incorrect result * Bug #7828: Verify if master radio box is disabled in the Windows wizard * Bug #7847: Wrong information in section "Linux Client Setup Wizard for Remote Monitoring" * Bug #7862: Segfault in CA handling * Bug #7868: Documentation: Explain how unresolved macros are handled * Bug #7890: Wrong permission in run directory after restart * Bug #7896: Fix Apache config in the Debian package ### What's New in Version 2.2.0 #### Changes * DB IDO schema update to version `1.12.0` * schema files in `lib/db_ido_{mysql,pgsql}/schema` (source) * Table `programstatus`: New column `program_version` * Table `customvariables` and `customvariablestatus`: New column `is_json` (required for custom attribute array/dictionary support) * New features * [GelfWriter](#gelfwriter): Logging check results, state changes, notifications to GELF (graylog2, logstash) #7619 * Agent/Client/Node framework #7249 * Windows plugins for the client/agent parts #7242 #7243 * New CLI commands #7245 * `icinga2 feature {enable,disable}` replaces `icinga2-{enable,disable}-feature` script #7250 * `icinga2 object list` replaces `icinga2-list-objects` script #7251 * `icinga2 pki` replaces` icinga2-build-{ca,key}` scripts #7247 * `icinga2 repository` manages `/etc/icinga2/repository.d` which must be included in `icinga2.conf` #7255 * `icinga2 node` cli command provides node (master, satellite, agent) setup (wizard) and management functionality #7248 * `icinga2 daemon` for existing daemon arguments (`-c`, `-C`). Removed `-u` and `-g` parameters in favor of [init.conf](#init-conf). * bash auto-completion & terminal colors #7396 * Configuration * Former `localhost` example host is now defined in [hosts.conf](#hosts-conf) #7594 * All example services moved into advanced apply rules in [services.conf](#services-conf) * Updated downtimes configuration example in [downtimes.conf](#downtimes-conf) #7472 * Updated notification apply example in [notifications.conf](#notifications-conf) #7594 * Support for object attribute 'zone' #7400 * Support setting [object variables in apply rules](#dependencies-apply-custom-attributes) #7479 * Support arrays and dictionaries in [custom attributes](#custom-attributes-apply) #6544 #7560 * Add [apply for rules](#using-apply-for) for advanced dynamic object generation #7561 * New attribute `accept_commands` for [ApiListener](#objecttype-apilistener) #7559 * New [init.conf](#init-conf) file included first containing new constants `RunAsUser` and `RunAsGroup`. * Cluster * Add [CSR Auto-Signing support](#csr-autosigning-requirements) using generated ticket #7244 * Allow to [execute remote commands](#icinga2-remote-monitoring-client-command-execution) on endpoint clients #7559 * Perfdata * [PerfdataWriter](#writing-performance-data-files): Don't change perfdata, pass through from plugins #7268 * [GraphiteWriter](#graphite-carbon-cache-writer): Add warn/crit/min/max perfdata and downtime_depth stats values #7366 #6946 * Packages * `python-icinga2` package dropped in favor of integrated cli commands #7245 * Windows Installer for the agent parts #7243 > **Note** > > Please remove `conf.d/hosts/localhost*` after verifying your updated configuration! #### Features * Feature #6544: Support for array in custom variable. * Feature #6946: Add downtime depth as statistic metric for GraphiteWriter * Feature #7187: Document how to use multiple assign/ignore statements with logical "and" & "or" * Feature #7199: Cli commands: add filter capability to 'object list' * Feature #7241: Windows Wizard * Feature #7242: Windows plugins * Feature #7243: Windows installer * Feature #7244: CSR auto-signing * Feature #7245: Cli commands * Feature #7246: Cli command framework * Feature #7247: Cli command: pki * Feature #7248: Cli command: Node * Feature #7249: Node Repository * Feature #7250: Cli command: Feature * Feature #7251: Cli command: Object * Feature #7252: Cli command: SCM * Feature #7253: Cli Commands: Node Repository Blacklist & Whitelist * Feature #7254: Documentation: Agent/Satellite Setup * Feature #7255: Cli command: Repository * Feature #7262: macro processor needs an array printer * Feature #7319: Documentation: Add support for locally-scoped variables for host/service in applied Dependency * Feature #7334: GraphiteWriter: Add support for customized metric prefix names * Feature #7356: Documentation: Cli Commands * Feature #7366: GraphiteWriter: Add warn/crit/min/max perfdata values if existing * Feature #7370: CLI command: variable * Feature #7391: Add program_version column to programstatus table * Feature #7396: Implement generic color support for terminals * Feature #7400: Remove zone keyword and allow to use object attribute 'zone' * Feature #7415: CLI: List disabled features in feature list too * Feature #7421: Add -h next to --help * Feature #7423: Cli command: Node Setup * Feature #7452: Replace cJSON with a better JSON parser * Feature #7465: Cli command: Node Setup Wizard (for Satellites and Agents) * Feature #7467: Remove virtual agent name feature for localhost * Feature #7472: Update downtimes.conf example config * Feature #7478: Documentation: Mention 'icinga2 object list' in config validation * Feature #7479: Set host/service variable in apply rules * Feature #7480: Documentation: Add host/services variables in apply rules * Feature #7504: Documentation: Revamp getting started with 1 host and multiple (service) applies * Feature #7514: Documentation: Move troubleshooting after the getting started chapter * Feature #7524: Documentation: Explain how to manage agent config in central repository * Feature #7543: Documentation for arrays & dictionaries in custom attributes and their usage in apply rules for * Feature #7559: Execute remote commands on the agent w/o local objects by passing custom attributes * Feature #7560: Support dictionaries in custom attributes * Feature #7561: Generate objects using apply with foreach in arrays or dictionaries (key => value) * Feature #7566: Implement support for arbitrarily complex indexers * Feature #7594: Revamp sample configuration: add NodeName host, move services into apply rules schema * Feature #7596: Plugin Check Commands: disk is missing '-p', 'x' parameter * Feature #7619: Add GelfWriter for writing log events to graylog2/logstash * Feature #7620: Documentation: Update Icinga Web 2 installation * Feature #7622: Icinga 2 should use less RAM * Feature #7680: Conditionally enable MySQL and PostgresSQL, add support for FreeBSD and DragonFlyBSD #### Bugfixes * Bug #6547: delaying notifications with times.begin should postpone first notification into that window * Bug #7257: default value for "disable_notifications" in service dependencies is set to "false" * Bug #7268: Icinga2 changes perfdata order and removes maximum * Bug #7272: icinga2 returns exponential perfdata format with check_nt * Bug #7275: snmp-load checkcommand has wrong threshold syntax * Bug #7276: SLES (Suse Linux Enterprise Server) 11 SP3 package dependency failure * Bug #7302: ITL: check_procs and check_http are missing arguments * Bug #7324: config parser crashes on unknown attribute in assign * Bug #7327: Icinga2 docs: link supported operators from sections about apply rules * Bug #7331: Error messages for invalid imports missing * Bug #7338: Docs: Default command timeout is 60s not 5m * Bug #7339: Importing a CheckCommand in a NotificationCommand results in an exception without stacktrace. * Bug #7349: Documentation: Wrong check command for snmp-int(erface) * Bug #7351: snmp-load checkcommand has a wrong "-T" param value * Bug #7359: Setting snmp_v2 can cause snmp-manubulon-command derived checks to fail * Bug #7365: Typo for "HTTP Checks" match in groups.conf * Bug #7369: Fix reading perfdata in compat/checkresultreader * Bug #7372: custom attribute name 'type' causes empty vars dictionary * Bug #7373: Wrong usermod command for external command pipe setup * Bug #7378: Commands are auto-completed when they shouldn't be * Bug #7379: failed en/disable feature should return error * Bug #7380: Debian package root permissions interfere with icinga2 cli commands as icinga user * Bug #7392: Schema upgrade files are missing in /usr/share/icinga2-ido-{mysql,pgsql} * Bug #7417: CMake warnings on OS X * Bug #7428: Documentation: 1-about contribute links to non-existing report a bug howto * Bug #7433: Unity build fails on RHEL 5 * Bug #7446: When replaying logs the secobj attribute is ignored * Bug #7473: Performance data via API is broken * Bug #7475: can't assign Service to Host in nested HostGroup * Bug #7477: Fix typos and other small corrections in documentation * Bug #7482: OnStateLoaded isn't called for objects which don't have any state * Bug #7483: Hosts/services should not have themselves as parents * Bug #7495: Utility::GetFQDN doesn't work on OS X * Bug #7503: Icinga2 fails to start due to configuration errors * Bug #7520: Use ScriptVariable::Get for RunAsUser/RunAsGroup * Bug #7536: Object list dump erraneously evaluates template definitions * Bug #7537: Nesting an object in a template causes the template to become non-abstract * Bug #7538: There is no __name available to nested objects * Bug #7573: link missing in documentation about livestatus * Bug #7577: Invalid checkresult object causes Icinga 2 to crash * Bug #7579: only notify users on recovery which have been notified before (not-ok state) * Bug #7585: Nested templates do not work (anymore) * Bug #7586: Exception when executing check * Bug #7597: Compilation Error with boost 1.56 under Windows * Bug #7599: Plugin execution on Windows does not work * Bug #7617: mkclass crashes when called without arguments * Bug #7623: Missing state filter 'OK' must not prevent recovery notifications being sent * Bug #7624: Installation on Windows fails * Bug #7625: IDO module crashes on Windows * Bug #7646: Get rid of static boost::mutex variables * Bug #7648: Unit tests fail to run * Bug #7650: Wrong set of dependency state when a host depends on a service * Bug #7681: CreateProcess fails on Windows 7 * Bug #7688: DebugInfo is missing for nested dictionaries ### What's New in Version 2.1.1 #### Features * Feature #6719: Change log message for checking/sending notifications * Feature #7028: Document how to use @ to escape keywords * Feature #7033: Add include guards for mkclass files * Feature #7034: Ensure that namespaces for INITIALIZE_ONCE and REGISTER_TYPE are truly unique * Feature #7035: Implement support for unity builds * Feature #7039: Figure out a better way to set the version for snapshot builds * Feature #7040: Unity builds: Detect whether __COUNTER__ is available * Feature #7041: Enable unity build for RPM/Debian packages * Feature #7070: Explain event commands and their integration by a real life example (httpd restart via ssh) * Feature #7158: Extend documentation for icinga-web on Debian systems #### Bugfixes * Bug #6147: Link libcJSON against libm * Bug #6696: make test fails on openbsd * Bug #6841: Too many queued messages * Bug #6862: SSL_read errors during restart * Bug #6981: SSL errors with interleaved SSL_read/write * Bug #7029: icinga2.spec: files-attr-not-set for python-icinga2 package * Bug #7032: "Error parsing performance data" in spite of "enable_perfdata = false" * Bug #7036: Remove validator for the Script type * Bug #7037: icinga2-list-objects doesn't work with Python 3 * Bug #7038: Fix rpmlint errors * Bug #7042: icinga2-list-objects complains about Umlauts and stops output * Bug #7044: icinga2 init-script terminates with exit code 0 if $DAEMON is not in place or not executable * Bug #7047: service icinga2 status - prints cat error if the service is stopped * Bug #7058: Exit code is not initialized for some failed checks * Bug #7065: pipe2 returns ENOSYS on GNU Hurd and Debian kfreebsd * Bug #7072: GraphiteWriter should ignore empty perfdata value * Bug #7080: Missing differentiation between service and systemctl * Bug #7096: new SSL Errors with too many queued messages * Bug #7115: Build fails on Haiku * Bug #7123: Manubulon-Plugin conf Filename wrong * Bug #7139: GNUInstallDirs.cmake outdated * Bug #7167: Segfault using cluster in TlsStream::IsEof * Bug #7168: fping4 doesn't work correctly with the shipped command-plugins.conf * Bug #7186: Livestatus hangs from time to time * Bug #7195: fix memory leak ido_pgsql * Bug #7210: clarify on db ido upgrades ### What's New in Version 2.1.0 #### Changes * DB IDO schema upgrade ([MySQL](#upgrading-mysql-db),[PostgreSQL](#upgrading-postgresql-db) required! * new schema version: **1.11.7** * RPMs install the schema files into `/usr/share/icinga2-ido*` instead of `/usr/share/doc/icinga2-ido*` #6881 * [Information for config objects](#list-configuration-objects) using `icinga2-list-objects` script #6702 * Add Python 2.4 as requirement #6702 * Add search path: If `-c /etc/icinga2/icinga2.conf` is omitted, use `SysconfDir + "/icinga2/icinga2.conf"` #6874 * Change log level for failed commands #6751 * Notifications are load-balanced in a [High Availability cluster setup](#high-availability-notifications) #6203 * New config attribute: `enable_ha` * DB IDO "run once" or "run everywhere" mode in a [High Availability cluster setup](#high-availability-db-ido) #6203 #6827 * New config attributes: `enable_ha` and `failover_timeout` * RPMs use the `icingacmd` group for /var/{cache,log,run}/icinga2 #6948 #### Features * Feature #5219: Cluster support for modified attributes * Feature #6066: Better log messages for cluster changes * Feature #6203: Better cluster support for notifications / IDO * Feature #6205: Log replay sends messages to instances which shouldn't get those messages * Feature #6702: Information for config objects * Feature #6704: Release 2.1 * Feature #6751: Change log level for failed commands * Feature #6874: add search path for icinga2.conf * Feature #6898: Enhance logging for perfdata/graphitewriter * Feature #6919: Clean up spec file * Feature #6920: Recommend related packages on SUSE distributions * API - Bug #6998: ApiListener ignores bind_host attribute * DB IDO - Feature #6827: delay ido connect in ha cluster * Documentation - Bug #6870: Wrong object attribute 'enable_flap_detection' * Documentation - Bug #6878: Wrong parent in Load Distribution * Documentation - Bug #6909: clarify on which config tools are available * Documentation - Bug #6968: Update command arguments 'set_if' and beautify error message * Documentation - Bug #6995: Keyword "required" used inconsistently for host and service "icon_image*" attributes * Documentation - Feature #6651: Migration: note on check command timeouts * Documentation - Feature #6703: Documentation for zones and cluster permissions * Documentation - Feature #6743: Better explanation for HA config cluster * Documentation - Feature #6839: Explain how the order attribute works in commands * Documentation - Feature #6864: Add section for reserved keywords * Documentation - Feature #6867: add section about disabling re-notifications * Documentation - Feature #6869: Add systemd options: enable, journal * Documentation - Feature #6922: Enhance Graphite Writer description * Documentation - Feature #6949: Add documentation for icinga2-list-objects * Documentation - Feature #6997: how to add a new cluster node * Documentation - Feature #7018: add example selinux policy for external command pipe * Plugins - Feature #6650: Plugin Check Commands: add manubulon snmp plugins #### Bugfixes * Bug #6881: make install does not install the db-schema * Bug #6915: use _rundir macro for configuring the run directory * Bug #6916: External command pipe: Too many open files * Bug #6917: enforce /usr/lib as base for the cgi path on SUSE distributions * Bug #6942: ExternalCommandListener fails open pipe: Too many open files * Bug #6948: check file permissions in /var/cache/icinga2 * Bug #6962: Commands are processed multiple times * Bug #6964: Host and service checks stuck in "pending" when hostname = localhost a parent/satellite setup * Bug #7001: Build fails with Boost 1.56 * Bug #7016: 64-bit RPMs are not installable ### What's New in Version 2.0.2 #### Changes * DB IDO schema upgrade required (new schema version: 1.11.6) #### Features * Feature #5818: SUSE packages * Feature #6655: Build packages for el7 * Feature #6688: Rename README to README.md * Feature #6698: Require command to be an array when the arguments attribute is used * Feature #6700: Release 2.0.2 * Feature #6783: Print application paths for --version * DB IDO - Bug #6414: objects and their ids are inserted twice * DB IDO - Bug #6608: Two Custom Variables with same name, but Upper/Lowercase creating IDO duplicate entry * DB IDO - Bug #6646: NULL vs empty string * DB IDO - Bug #6850: exit application if ido schema version does not match * Documentation - Bug #6652: clarify on which features are required for classic ui/web/web2 * Documentation - Bug #6708: update installation with systemd usage * Documentation - Bug #6711: icinga Web: wrong path to command pipe * Documentation - Bug #6725: Missing documentation about implicit dependency * Documentation - Bug #6728: wrong path for the file 'localhost.conf' * Migration - Bug #6558: group names quoted twice in arrays * Migration - Bug #6560: Service dependencies aren't getting converted properly * Migration - Bug #6561: $TOTALHOSTSERVICESWARNING$ and $TOTALHOSTSERVICESCRITICAL$ aren't getting converted * Migration - Bug #6563: Check and retry intervals are incorrect * Migration - Bug #6786: Fix notification definition if no host_name / service_description given * Plugins - Feature #6695: Plugin Check Commands: Add expect option to check_http * Plugins - Feature #6791: Plugin Check Commands: Add timeout option to check_ssh #### Bugfixes * Bug #6450: ipmi-sensors segfault due to stack size * Bug #6479: Notifications not always triggered * Bug #6501: Classic UI Debian/Ubuntu: apache 2.4 requires 'a2enmod cgi' & apacheutils installed * Bug #6548: Add cmake constant for PluginDir * Bug #6549: GraphiteWriter regularly sends empty lines * Bug #6550: add log message for invalid performance data * Bug #6589: Command pipe blocks when trying to open it more than once in parallel * Bug #6621: Infinite loop in TlsStream::Close * Bug #6627: Location of the run directory is hard coded and bound to "local_state_dir" * Bug #6659: RPMLint security warning - missing-call-to-setgroups-before-setuid /usr/sbin/icinga2 * Bug #6682: Missing detailed error messages on ApiListener SSL Errors * Bug #6686: Event Commands are triggered in OK HARD state everytime * Bug #6687: Remove superfluous quotes and commas in dictionaries * Bug #6713: sample config: add check commands location hint (itl/plugin check commands) * Bug #6718: "order" attribute doesn't seem to work as expected * Bug #6724: TLS Connections still unstable in 2.0.1 * Bug #6756: GraphiteWriter: Malformatted integer values * Bug #6765: Config validation without filename argument fails with unhandled exception * Bug #6768: Repo Error on RHEL 6.5 * Bug #6773: Order doesn't work in check ssh command * Bug #6782: The "ssl" check command always sets -D * Bug #6790: Service icinga2 reload command does not cause effect * Bug #6809: additional group rights missing when Icinga started with -u and -g * Bug #6810: High Availablity does not synchronise the data like expected * Bug #6820: Icinga 2 crashes during startup * Bug #6821: [Patch] Fix build issue and crash found on Solaris, potentially other Unix OSes * Bug #6825: incorrect sysconfig path on sles11 * Bug #6832: Remove if(NOT DEFINED ICINGA2_SYSCONFIGFILE) in etc/initsystem/CMakeLists.txt * Bug #6840: Missing space in error message * Bug #6849: Error handler for getaddrinfo must use gai_strerror * Bug #6852: Startup logfile is not flushed to disk * Bug #6856: event command execution does not call finish handler * Bug #6861: write startup error messages to error.log ### What's New in Version 2.0.1 #### Features * Feature #6531: Add port option to check imap/pop/smtp and a new dig * Feature #6581: Add more options to snmp check * DB IDO - Bug #5577: PostgreSQL string escaping * DB IDO - Bug #6577: icinga2-ido-pgsql snapshot package missing dependecy dbconfig-common * Documentation - Bug #6506: Array section confusing * Documentation - Bug #6592: Documentation for || and && is missing * Documentation - Feature #6658: change docs.icinga.org/icinga2/latest to git master * Livestatus - Bug #6494: Thruk Panorama View cannot query Host Status * Livestatus - Feature #5312: OutputFormat python * Migration - Bug #6559: $SERVICEDESC$ isn't getting converted correctly #### Bugfixes * Bug #6316: application fails to start on wrong log file permissions but does not tell about it * Bug #6368: Deadlock in ApiListener::RelayMessage * Bug #6373: base64 on CentOS 5 fails to read certificate bundles * Bug #6388: Debian package icinga2-classicui needs versioned dependency of icinga-cgi* * Bug #6488: build warnings * Bug #6492: icinga2.state could not be opened * Bug #6493: Copyright problems * Bug #6498: icinga2 cannot be built with both systemd and init.d files * Bug #6510: Reminder notifications are sent on disabled services * Bug #6526: htpasswd should be installed with icinga2-classicui on Ubuntu * Bug #6529: parsing of double defined command can generate unexpected errors * Bug #6537: Icinga doesn't send SetLogPosition messages when one of the endpoints fails to connect * Bug #6551: Improve systemd service definition * Bug #6565: Dependencies should cache their parent and child object * Bug #6574: Check command result doesn't match * Bug #6576: Remove line number information from stack traces * Bug #6588: Notifications causing segfault from exim * Bug #6605: Please add --sni option to http check command * Bug #6612: Icinga stops updating IDO after a while * Bug #6617: TLS connections are still unstable * Bug #6620: icinga2-build-ca shouldn't prompt for DN * Bug #6622: icinga2-sign-key creates ".crt" and ".key" files when the CA passphrase is invalid * Bug #6657: ICINGA2_SYSCONFIGFILE should use full path using CMAKE_INSTALL_FULL_SYSCONFDIR * Bug #6662: Increase icinga.cmd Limit * Bug #6665: Build fails when MySQL is not installed * Bug #6671: enabled_notification doesn't work as expected * Bug #6672: Icinga crashes after "Too many queued messages" * Bug #6673: enable_notifications = false for users has no effect icinga2-2.4.1/INSTALL.md000066400000000000000000000205461262555626500145070ustar00rootroot00000000000000# Installing Icinga 2 The recommended way of installing Icinga 2 is to use packages. The Icinga project provides both release and development packages for a number of operating systems. Please check the documentation in the [doc/](doc/) directory for a current list of available packages and detailed installation instructions. There are a number of known caveats when installing from source such as incorrect directory and file permissions. So even if you're planning to not use the official packages it is advisable to build your own Debian or RPM packages. ## Build Requirements The following requirements need to be fulfilled in order to build the application using a dist tarball (package names for RHEL and Debian in parentheses): * cmake * GNU make (make) * C++ compiler (gcc-c++ >= 4.7 on RHEL/SUSE, build-essential on Debian, alternatively clang++) * OpenSSL library and header files >= 0.9.8 (openssl-devel on RHEL, libopenssl1-devel on SLES11, libopenssl-devel on SLES12, libssl-dev on Debian) * Boost library and header files (boost-devel on RHEL, libboost-all-dev on Debian) * GNU bison (bison) * GNU flex (flex) >= 2.5.35 * recommended: libexecinfo on FreeBSD (automatically used when Icinga 2 is installed via port or package) * optional: MySQL (mysql-devel on RHEL, libmysqlclient-devel on SUSE, libmysqlclient-dev on Debian); set CMake variable `ICINGA2_WITH_MYSQL` to `OFF` to disable this module * optional: PostgreSQL (postgresql-devel on RHEL, libpq-dev on Debian); set CMake variable `ICINGA2_WITH_PGSQL` to `OFF` to disable this module * optional: YAJL (yajl-devel on RHEL, libyajl-dev on Debian) * optional: libedit (libedit-devel on CentOS (RHEL requires rhel-7-server-optional-rpms repository for el7 e.g.), libedit-dev on Debian) * optional: Termcap (libtermcap-devel on RHEL, not necessary on Debian) - only required if libedit doesn't already link against termcap/ncurses * optional: libwxgtk2.8-dev or newer (wxGTK-devel and wxBase) - only required when building the Icinga 2 Studio Note: RHEL5 ships an ancient flex version. Updated packages are available for example from the repoforge buildtools repository. * x86: http://mirror.hs-esslingen.de/repoforge/redhat/el5/en/i386/buildtools/ * x86\_64: http://mirror.hs-esslingen.de/repoforge/redhat/el5/en/x86\_64/buildtools/ ### User Requirements By default Icinga will run as user 'icinga' and group 'icinga'. Additionally the external command pipe and livestatus features require a dedicated command group 'icingacmd'. You can choose your own user/group names and pass them to CMake using the `ICINGA2_USER`, `ICINGA2_GROUP` and `ICINGA2_COMMAND_GROUP` variables. # groupadd icinga # groupadd icingacmd # useradd -c "icinga" -s /sbin/nologin -G icingacmd -g icinga icinga Add the web server user to the icingacmd group in order to grant it write permissions to the external command pipe and livestatus socket: # usermod -a -G icingacmd www-data Make sure to replace "www-data" with the name of the user your web server is running as. ## Building Icinga 2 Once you have installed all the necessary build requirements you can build Icinga 2 using the following commands: $ mkdir build && cd build $ cmake .. $ make $ make install You can specify an alternative installation prefix using `-DCMAKE_INSTALL_PREFIX`: $ cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/icinga2 In addition to `CMAKE_INSTALL_PREFIX` the following Icinga-specific cmake variables are supported: - `ICINGA2_USER`: The user Icinga 2 should run as; defaults to `icinga` - `ICINGA2_GROUP`: The group Icinga 2 should run as; defaults to `icinga` - `ICINGA2_GIT_VERSION_INFO`: Whether to use Git to determine the version number; defaults to `ON` - `ICINGA2_COMMAND_GROUP`: The command group Icinga 2 should use; defaults to `icingacmd` - `ICINGA2_UNITY_BUILD`: Whether to perform a unity build; defaults to `ON` - `ICINGA2_LTO_BUILD`: Whether to use link time optimization (LTO); defaults to `OFF` - `ICINGA2_PLUGINDIR`: The path for the Monitoring Plugins project binaries; defaults to `/usr/lib/nagios/plugins` - `ICINGA2_RUNDIR`: The location of the "run" directory; defaults to `CMAKE_INSTALL_LOCALSTATEDIR/run` - `CMAKE_INSTALL_SYSCONFDIR`: The configuration directory; defaults to `CMAKE_INSTALL_PREFIX/etc` - `ICINGA2_SYSCONFIGFILE`: Where to put the config file the initscript/systemd pulls it's dirs from; defaults to `CMAKE_INSTALL_PREFIX/etc/sysconfig/icinga2` - `CMAKE_INSTALL_LOCALSTATEDIR`: The state directory; defaults to `CMAKE_INSTALL_PREFIX/var` - `USE_SYSTEMD=ON|OFF`: Use systemd or a classic SysV initscript; defaults to `OFF` - `INSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=ON|OFF` Force install both the systemd service definition file and the SysV initscript in parallel, regardless of how `USE_SYSTEMD` is set. Only use this for special packaging purposes and if you know what you are doing. Defaults to `OFF`. - `ICINGA2_WITH_MYSQL`: Determines whether the MySQL IDO module is built; defaults to `ON` - `ICINGA2_WITH_PGSQL`: Determines whether the PostgreSQL IDO module is built; defaults to `ON` - `ICINGA2_WITH_CHECKER`: Determines whether the checker module is built; defaults to `ON` - `ICINGA2_WITH_COMPAT`: Determines whether the compat module is built; defaults to `ON` - `ICINGA2_WITH_DEMO`: Determines whether the demo module is built; defaults to `OFF` - `ICINGA2_WITH_HELLO`: Determines whether the hello module is built; defaults to `OFF` - `ICINGA2_WITH_LIVESTATUS`: Determines whether the Livestatus module is built; defaults to `ON` - `ICINGA2_WITH_NOTIFICATION`: Determines whether the notification module is built; defaults to `ON` - `ICINGA2_WITH_PERFDATA`: Determines whether the perfdata module is built; defaults to `ON` CMake determines the Icinga 2 version number using `git describe` if the source directory is contained in a Git repository. Otherwise the version number is extracted from the [icinga2.spec](icinga2.spec) file. This behavior can be overridden by creating a file called `icinga-version.h.force` in the source directory. Alternatively the `-DICINGA2_GIT_VERSION_INFO=OFF` option for CMake can be used to disable the usage of `git describe`. ### Building Icinga 2 RPMs Setup your build environment on RHEL/SUSE and copy the generated tarball from your git repository to `rpmbuild/SOURCES`. Copy the icinga2.spec file to `rpmbuild/SPEC` and then run this command: $ rpmbuild -ba SPEC/icinga2.spec ### Building Icinga 2 Debs Setup your build environment on Debian/Ubuntu, copy the 'debian' directory from the Debian packaging Git repository (https://anonscm.debian.org/cgit/pkg-nagios/pkg-icinga2.git) into your source tree and run the following command: $ dpkg-buildpackage -uc -us ### Building Post Install Tasks After building Icinga 2 yourself, your package build system should at least run the following post install requirements: * enable the `checker`, `notification` and `mainlog` feature by default * run 'icinga2 api setup' in order to enable the `api` feature and generate SSL certificates for the node ## Running Icinga 2 Icinga 2 comes with a single binary that takes care of loading all the relevant components (e.g. for check execution, notifications, etc.): # /usr/sbin/icinga2 daemon [2015-03-12 13:25:56 +0100] information/cli: Icinga application loader (version: v2.3.0-20-ga4d3713; debug) [2015-03-12 13:25:56 +0100] information/cli: Loading application type: icinga/IcingaApplication [2015-03-12 13:25:56 +0100] information/Utility: Loading library 'libicinga.dylib' [2015-03-12 13:25:56 +0100] information/ConfigCompiler: Compiling config file: /Users/gunnar/i2/etc/icinga2/icinga2.conf [2015-03-12 13:25:56 +0100] information/ConfigCompiler: Compiling config file: /Users/gunnar/i2/etc/icinga2/constants.conf ... Icinga 2 can be started as a daemon using the provided init script: # /etc/init.d/icinga2 Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status} Or if your distribution uses systemd: # systemctl {start|stop|reload|status|enable|disable} icinga2 Icinga 2 reads a single configuration file which is used to specify all configuration settings (global settings, hosts, services, etc.). The configuration format is explained in detail in the [doc/](doc/) directory. By default `make install` installs example configuration files in `/usr/local/etc/icinga2` unless you have specified a different prefix or sysconfdir. icinga2-2.4.1/NEWS000066400000000000000000000001301262555626500135410ustar00rootroot00000000000000News for this application can be found on the project website at https://www.icinga.org icinga2-2.4.1/README.md000066400000000000000000000014671262555626500143370ustar00rootroot00000000000000# Icinga 2 ## About Icinga 2 is an open source monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting. Scalable and extensible, Icinga 2 can monitor large, complex environments across multiple locations. More details online at [www.icinga.org](https://www.icinga.org/icinga/icinga-2/) and inside the [documentation](doc/1-about.md). ## Installation Read the [INSTALL.md](INSTALL.md) file for more information about how to install it. ## Documentation The documentation is located in the [doc/](doc/) directory. The latest documentation is also available on https://docs.icinga.org ## Support Check the project website at https://www.icinga.org for status updates and https://support.icinga.org if you want to contact us. icinga2-2.4.1/RELEASE.md000066400000000000000000000061221262555626500144530ustar00rootroot00000000000000# Quality Assurance Review and test the changes and issues for this version. https://dev.icinga.org/projects/i2/roadmap # Release Workflow ## Authors Update the [.mailmap](.mailmap) and [AUTHORS](AUTHORS) files: $ git log --use-mailmap | grep ^Author: | cut -f2- -d' ' | sort | uniq > AUTHORS ## Version Update the version number in the following files: * [icinga2.spec]: Version: (.*) * [icinga2.nuspec]: (.*) * [tools/chocolateyInstall.ps1]: Icinga2-v(.*).exe ## Changelog Update the [ChangeLog](ChangeLog), [doc/1-about.md](doc/1-about.md) files using the changelog.py script. Also generate HTML for the wordpress release announcement. Changelog: $ ./changelog.py --version 2.4.0 --project i2 Docs: $ ./changelog.py --version 2.4.0 --project i2 --links Wordpress: $ ./changelog.py --version 2.4.0 --project i2 --html --links ## Git Tag Commit these changes to the "master" branch: $ git commit -v -a -m "Release version " For minor releases: Cherry-pick this commit into the "support" branch. Create a signed tag (tags/v) on the "master" branch (for major releases) or the "support" branch (for minor releases). GB: $ git tag -u EE8E0720 -m "Version " v MF: $ git tag -u D14A1F16 -m "Version " v Push the tag. $ git push --tags For major releases: Create a new "support" branch: $ git checkout master $ git checkout -b support/2.4 $ git push -u origin support/2.4 For minor releases: Push the support branch, cherry-pick the release commit into master and merge the support branch: $ git push -u origin support/2.4 $ git checkout master $ git cherry-pick support/2.4 $ git merge --strategy=ours support/2.4 $ git push origin master # External Dependencies ## Build Server ### Linux * Build the newly created git tag for Debian/RHEL/SuSE. * Provision the vagrant boxes and test the release packages. * Start a new docker container and install/run icinga2 Example for CentOS7: $ sudo docker run -ti centos:latest bash # yum -y install http://packages.icinga.org/epel/7/release/noarch/icinga-rpm-release-7-1.el7.centos.noarch.rpm # yum -y install icinga2 # icinga2 daemon -C # systemctl start icinga2 # tail -f /var/log/icinga2/icinga2.log ### Windows * Build the newly created Git tag for Windows. * Test the [setup wizard](http://packages.icinga.org/windows/) inside a Windows VM. ## GitHub Release Create a new release for the newly created Git tag. https://github.com/Icinga/icinga2/releases ## Online Documentation SSH into the web box, navigate into `icinga2-latest/module/icinga2` and pull the current icinga2 revision to update what's new". ## Announcement * Create a new blog post on www.icinga.org/blog * Send announcement mail to icinga-announce@lists.icinga.org * Social media: [Twitter](https://twitter.com/icinga), [Facebook](https://www.facebook.com/icinga), [G+](http://plus.google.com/+icinga), [Xing](https://www.xing.com/communities/groups/icinga-da4b-1060043), [LinkedIn](https://www.linkedin.com/groups/Icinga-1921830/about) icinga2-2.4.1/agent/000077500000000000000000000000001262555626500141465ustar00rootroot00000000000000icinga2-2.4.1/agent/CMakeLists.txt000066400000000000000000000022251262555626500167070ustar00rootroot00000000000000# Icinga 2 # Copyright (C) 2012-2015 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. if(MSVC) include_external_msproject( icinga2setupagent ${CMAKE_CURRENT_SOURCE_DIR}/windows-setup-agent/Icinga2SetupAgent.csproj TYPE FAE04EC0-301F-11D3-BF4B-00C04F79EFBC PLATFORM Win32 ) install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/windows-setup-agent/bin/\${CMAKE_INSTALL_CONFIG_NAME}/Icinga2SetupAgent.exe DESTINATION ${CMAKE_INSTALL_SBINDIR} ) endif() icinga2-2.4.1/agent/windows-setup-agent/000077500000000000000000000000001262555626500200725ustar00rootroot00000000000000icinga2-2.4.1/agent/windows-setup-agent/.gitignore000066400000000000000000000000071262555626500220570ustar00rootroot00000000000000bin objicinga2-2.4.1/agent/windows-setup-agent/App.config000066400000000000000000000002771262555626500220070ustar00rootroot00000000000000 icinga2-2.4.1/agent/windows-setup-agent/EndpointInputBox.Designer.cs000066400000000000000000000137631262555626500254430ustar00rootroot00000000000000namespace Icinga { partial class EndpointInputBox { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.btnOK = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.txtHost = new System.Windows.Forms.TextBox(); this.txtPort = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.lblHost = new System.Windows.Forms.Label(); this.lblPort = new System.Windows.Forms.Label(); this.lblInstanceName = new System.Windows.Forms.Label(); this.txtInstanceName = new System.Windows.Forms.TextBox(); this.chkConnect = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // btnOK // this.btnOK.Location = new System.Drawing.Point(196, 171); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.TabIndex = 4; this.btnOK.Text = "OK"; this.btnOK.UseVisualStyleBackColor = true; this.btnOK.Click += new System.EventHandler(this.btnOK_Click); // // btnCancel // this.btnCancel.CausesValidation = false; this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Location = new System.Drawing.Point(277, 171); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 5; this.btnCancel.Text = "Cancel"; this.btnCancel.UseVisualStyleBackColor = true; // // txtHost // this.txtHost.Enabled = false; this.txtHost.Location = new System.Drawing.Point(101, 103); this.txtHost.Name = "txtHost"; this.txtHost.Size = new System.Drawing.Size(251, 20); this.txtHost.TabIndex = 2; // // txtPort // this.txtPort.Enabled = false; this.txtPort.Location = new System.Drawing.Point(101, 134); this.txtPort.Name = "txtPort"; this.txtPort.Size = new System.Drawing.Size(100, 20); this.txtPort.TabIndex = 3; this.txtPort.Text = "5665"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(276, 13); this.label1.TabIndex = 4; this.label1.Text = "Please enter the connection details for the new endpoint:"; // // lblHost // this.lblHost.AutoSize = true; this.lblHost.Location = new System.Drawing.Point(15, 106); this.lblHost.Name = "lblHost"; this.lblHost.Size = new System.Drawing.Size(32, 13); this.lblHost.TabIndex = 5; this.lblHost.Text = "Host:"; // // lblPort // this.lblPort.AutoSize = true; this.lblPort.Location = new System.Drawing.Point(15, 137); this.lblPort.Name = "lblPort"; this.lblPort.Size = new System.Drawing.Size(29, 13); this.lblPort.TabIndex = 6; this.lblPort.Text = "Port:"; // // lblInstanceName // this.lblInstanceName.AutoSize = true; this.lblInstanceName.Location = new System.Drawing.Point(15, 41); this.lblInstanceName.Name = "lblInstanceName"; this.lblInstanceName.Size = new System.Drawing.Size(82, 13); this.lblInstanceName.TabIndex = 7; this.lblInstanceName.Text = "Instance Name:"; // // txtInstanceName // this.txtInstanceName.Location = new System.Drawing.Point(101, 37); this.txtInstanceName.Name = "txtInstanceName"; this.txtInstanceName.Size = new System.Drawing.Size(251, 20); this.txtInstanceName.TabIndex = 0; // // chkConnect // this.chkConnect.AutoSize = true; this.chkConnect.Location = new System.Drawing.Point(18, 73); this.chkConnect.Name = "chkConnect"; this.chkConnect.Size = new System.Drawing.Size(141, 17); this.chkConnect.TabIndex = 1; this.chkConnect.Text = "Connect to this endpoint"; this.chkConnect.UseVisualStyleBackColor = true; this.chkConnect.CheckedChanged += new System.EventHandler(this.chkConnect_CheckedChanged); // // EndpointInputBox // this.AcceptButton = this.btnOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnCancel; this.ClientSize = new System.Drawing.Size(360, 202); this.Controls.Add(this.chkConnect); this.Controls.Add(this.txtInstanceName); this.Controls.Add(this.lblInstanceName); this.Controls.Add(this.lblPort); this.Controls.Add(this.lblHost); this.Controls.Add(this.label1); this.Controls.Add(this.txtPort); this.Controls.Add(this.txtHost); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOK); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "EndpointInputBox"; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Add Endpoint"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button btnOK; private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lblHost; private System.Windows.Forms.Label lblPort; public System.Windows.Forms.TextBox txtHost; public System.Windows.Forms.TextBox txtPort; public System.Windows.Forms.TextBox txtInstanceName; private System.Windows.Forms.Label lblInstanceName; public System.Windows.Forms.CheckBox chkConnect; } }icinga2-2.4.1/agent/windows-setup-agent/EndpointInputBox.cs000066400000000000000000000020271262555626500236730ustar00rootroot00000000000000using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Icinga { public partial class EndpointInputBox : Form { public EndpointInputBox() { InitializeComponent(); } private void Warning(string message) { MessageBox.Show(this, message, Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } private void chkConnect_CheckedChanged(object sender, EventArgs e) { txtHost.Enabled = chkConnect.Checked; txtPort.Enabled = chkConnect.Checked; } private void btnOK_Click(object sender, EventArgs e) { if (txtInstanceName.Text.Length == 0) { Warning("Please enter an instance name."); return; } if (chkConnect.Checked) { if (txtHost.Text.Length == 0) { Warning("Please enter a host name."); return; } if (txtPort.Text.Length == 0) { Warning("Please enter a port."); return; } } DialogResult = DialogResult.OK; Close(); } } } icinga2-2.4.1/agent/windows-setup-agent/EndpointInputBox.resx000066400000000000000000000131021262555626500242430ustar00rootroot00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 icinga2-2.4.1/agent/windows-setup-agent/Icinga2SetupAgent.csproj000066400000000000000000000151661262555626500246010ustar00rootroot00000000000000 Debug x86 {A86F1159-66E8-4BDB-BF28-A2BDAF76517C} WinExe Properties Icinga Icinga2SetupAgent v2.0 512 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true x86 true full false bin\Debug\ DEBUG;TRACE prompt 4 x86 pdbonly true bin\Release\ TRACE prompt 4 x86 pdbonly true bin\RelWithDebInfo\ TRACE prompt 4 x86 pdbonly true bin\MinSizeRel\ TRACE prompt 4 icinga.ico app.manifest Form ServiceStatus.cs Form SetupWizard.cs Form EndpointInputBox.cs ServiceStatus.cs SetupWizard.cs EndpointInputBox.cs ResXFileCodeGenerator Resources.Designer.cs Designer True Resources.resx True SettingsSingleFileGenerator Settings.Designer.cs True Settings.settings True False Microsoft .NET Framework 4.5 %28x86 and x64%29 true False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 false icinga2-2.4.1/agent/windows-setup-agent/Program.cs000066400000000000000000000021601262555626500220270ustar00rootroot00000000000000using System; using System.IO; using System.Windows.Forms; using Microsoft.Win32; namespace Icinga { static class Program { public static string Icinga2InstallDir { get { RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Icinga Development Team\\ICINGA2"); if (rk == null) return ""; return (string)rk.GetValue(""); } } public static void FatalError(Form owner, string message) { MessageBox.Show(owner, message, "Icinga 2 Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string installDir = Program.Icinga2InstallDir; if (installDir == "") FatalError(null, "Icinga 2 does not seem to be installed properly."); Form form; if (File.Exists(installDir + "\\etc\\icinga2\\features-enabled\\api.conf")) form = new ServiceStatus(); else form = new SetupWizard(); Application.Run(form); } } } icinga2-2.4.1/agent/windows-setup-agent/Properties/000077500000000000000000000000001262555626500222265ustar00rootroot00000000000000icinga2-2.4.1/agent/windows-setup-agent/Properties/AssemblyInfo.cs000066400000000000000000000026601262555626500251540ustar00rootroot00000000000000using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Icinga 2 Agent Wizard")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Icinga Development Team")] [assembly: AssemblyProduct("Icinga 2")] [assembly: AssemblyCopyright("Copyright © 2014-2015 Icinga Development Team")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("51f4fcaf-8cf8-4d1c-9fde-61526c17a0d8")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] icinga2-2.4.1/agent/windows-setup-agent/Properties/Resources.Designer.cs000066400000000000000000000061231262555626500262700ustar00rootroot00000000000000//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.34011 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Icinga.Properties { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Icinga.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap icinga_banner { get { object obj = ResourceManager.GetObject("icinga-banner", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } } } icinga2-2.4.1/agent/windows-setup-agent/Properties/Resources.resx000066400000000000000000000137001262555626500251040ustar00rootroot00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\icinga-banner.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a icinga2-2.4.1/agent/windows-setup-agent/Properties/Settings.Designer.cs000066400000000000000000000020471262555626500261170ustar00rootroot00000000000000//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.34011 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Icinga.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } icinga2-2.4.1/agent/windows-setup-agent/Properties/Settings.settings000066400000000000000000000003621262555626500256110ustar00rootroot00000000000000 icinga2-2.4.1/agent/windows-setup-agent/ServiceStatus.Designer.cs000066400000000000000000000100741262555626500247660ustar00rootroot00000000000000namespace Icinga { partial class ServiceStatus { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ServiceStatus)); this.picBanner = new System.Windows.Forms.PictureBox(); this.lblStatus = new System.Windows.Forms.Label(); this.txtStatus = new System.Windows.Forms.TextBox(); this.btnReconfigure = new System.Windows.Forms.Button(); this.btnOK = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.picBanner)).BeginInit(); this.SuspendLayout(); // // picBanner // this.picBanner.Image = global::Icinga.Properties.Resources.icinga_banner; this.picBanner.Location = new System.Drawing.Point(0, 0); this.picBanner.Name = "picBanner"; this.picBanner.Size = new System.Drawing.Size(625, 77); this.picBanner.TabIndex = 2; this.picBanner.TabStop = false; // // lblStatus // this.lblStatus.AutoSize = true; this.lblStatus.Location = new System.Drawing.Point(12, 105); this.lblStatus.Name = "lblStatus"; this.lblStatus.Size = new System.Drawing.Size(79, 13); this.lblStatus.TabIndex = 3; this.lblStatus.Text = "Service Status:"; // // txtStatus // this.txtStatus.Location = new System.Drawing.Point(97, 102); this.txtStatus.Name = "txtStatus"; this.txtStatus.ReadOnly = true; this.txtStatus.Size = new System.Drawing.Size(278, 20); this.txtStatus.TabIndex = 2; // // btnReconfigure // this.btnReconfigure.Location = new System.Drawing.Point(219, 143); this.btnReconfigure.Name = "btnReconfigure"; this.btnReconfigure.Size = new System.Drawing.Size(75, 23); this.btnReconfigure.TabIndex = 1; this.btnReconfigure.Text = "Reconfigure"; this.btnReconfigure.UseVisualStyleBackColor = true; this.btnReconfigure.Click += new System.EventHandler(this.btnReconfigure_Click); // // btnOK // this.btnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnOK.Location = new System.Drawing.Point(300, 143); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.TabIndex = 0; this.btnOK.Text = "OK"; this.btnOK.UseVisualStyleBackColor = true; this.btnOK.Click += new System.EventHandler(this.btnOK_Click); // // ServiceStatus // this.AcceptButton = this.btnOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnOK; this.ClientSize = new System.Drawing.Size(391, 186); this.Controls.Add(this.btnOK); this.Controls.Add(this.btnReconfigure); this.Controls.Add(this.txtStatus); this.Controls.Add(this.lblStatus); this.Controls.Add(this.picBanner); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Name = "ServiceStatus"; this.Text = "Icinga 2 Service Status"; ((System.ComponentModel.ISupportInitialize)(this.picBanner)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox picBanner; private System.Windows.Forms.Label lblStatus; private System.Windows.Forms.TextBox txtStatus; private System.Windows.Forms.Button btnReconfigure; private System.Windows.Forms.Button btnOK; } }icinga2-2.4.1/agent/windows-setup-agent/ServiceStatus.cs000066400000000000000000000013121262555626500232220ustar00rootroot00000000000000using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.ServiceProcess; namespace Icinga { public partial class ServiceStatus : Form { public ServiceStatus() { InitializeComponent(); try { ServiceController sc = new ServiceController("icinga2"); txtStatus.Text = sc.Status.ToString(); } catch (InvalidOperationException) { txtStatus.Text = "Not Available"; } } private void btnReconfigure_Click(object sender, EventArgs e) { new SetupWizard().ShowDialog(this); } private void btnOK_Click(object sender, EventArgs e) { Close(); } } } icinga2-2.4.1/agent/windows-setup-agent/ServiceStatus.resx000066400000000000000000000157321262555626500236110ustar00rootroot00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 AAABAAEAICAQAAAABADoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAAAAAAAAAAAAEAAAABAA AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD//wD/AAAA/wD/AP// AAD///8AAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAcAAAcAB3AAAAAAAAAAAAAAcABwB///cA AAAAAAAAAAAAcAAA////AAAAAAAAAAAAAAAAAP///3AAAAAAAAAAAAAAAAD///9wAAAAAAAAAAAAAAAA j//4AAAAB3AAAAAAAAAAAAj/jwAAAA/4AAAAAAAAAAAAAAiAAAAP9wAAAAAAAAAAAAAH9wAAf3AAAAAA AAAAAAAAAH93d/cAAAAAAAAAAAAAAAB////3AAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAB/////9w AAAAAAAAAAAAAAf/////gAAAAAAAAAAAAAAH//////h3AAAAAAAAAAAAB/////+I//h3eHAAAAAAAAD/ ////AAB3j//3AAAAAAB4////9wAAAAf/+AAAAAf/+AB4iPAAAAAAj/cAAAAH//AAAAD3AAAAAAcAAAAA B/+AAAAAjwAAAAAAAAAAAAB3AAAAAA9wAAAAAAAAAAAAAAAAAAAIh3AAAAAAAAAAAAAAAAAAD//wAAAA AAAAAAAAAAAAAH//9wAAAAAAAAAAAAAAAAB///cAAAAAAAcAAAAAAAAACP+AAAAAAHAAcAAAAAAAAAB3 AAAAAAcAAAcAAAAAAAAAAAAAAABwAAAAAAAAAAAAAAAAAAAAAAD/////4AAAB8AAAAOAAAABgAAAAYAA AAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAA AAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAcAAAAPgAAAH/////w== icinga2-2.4.1/agent/windows-setup-agent/SetupWizard.Designer.cs000066400000000000000000000724251262555626500244530ustar00rootroot00000000000000namespace Icinga { partial class SetupWizard { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SetupWizard)); this.btnBack = new System.Windows.Forms.Button(); this.btnNext = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.tabFinish = new System.Windows.Forms.TabPage(); this.lblSetupCompleted = new System.Windows.Forms.Label(); this.tabConfigure = new System.Windows.Forms.TabPage(); this.lblConfigStatus = new System.Windows.Forms.Label(); this.prgConfig = new System.Windows.Forms.ProgressBar(); this.tabParameters = new System.Windows.Forms.TabPage(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.chkAcceptConfig = new System.Windows.Forms.CheckBox(); this.chkAcceptCommands = new System.Windows.Forms.CheckBox(); this.txtTicket = new System.Windows.Forms.TextBox(); this.lblTicket = new System.Windows.Forms.Label(); this.txtInstanceName = new System.Windows.Forms.TextBox(); this.lblInstanceName = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.rdoNoListener = new System.Windows.Forms.RadioButton(); this.txtListenerPort = new System.Windows.Forms.TextBox(); this.lblListenerPort = new System.Windows.Forms.Label(); this.rdoListener = new System.Windows.Forms.RadioButton(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.btnRemoveEndpoint = new System.Windows.Forms.Button(); this.btnAddEndpoint = new System.Windows.Forms.Button(); this.lvwEndpoints = new System.Windows.Forms.ListView(); this.colInstanceName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.colHost = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.colPort = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.rdoNoMaster = new System.Windows.Forms.RadioButton(); this.rdoNewMaster = new System.Windows.Forms.RadioButton(); this.tbcPages = new System.Windows.Forms.TabControl(); this.tabRetrieveCertificate = new System.Windows.Forms.TabPage(); this.lblRetrieveCertificate = new System.Windows.Forms.Label(); this.prgRetrieveCertificate = new System.Windows.Forms.ProgressBar(); this.tabVerifyCertificate = new System.Windows.Forms.TabPage(); this.grpX509Fields = new System.Windows.Forms.GroupBox(); this.txtX509Field = new System.Windows.Forms.TextBox(); this.lvwX509Fields = new System.Windows.Forms.ListView(); this.colField = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.colValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.txtX509Subject = new System.Windows.Forms.TextBox(); this.txtX509Issuer = new System.Windows.Forms.TextBox(); this.lblX509Subject = new System.Windows.Forms.Label(); this.lblX509Issuer = new System.Windows.Forms.Label(); this.lblX509Prompt = new System.Windows.Forms.Label(); this.tabError = new System.Windows.Forms.TabPage(); this.txtError = new System.Windows.Forms.TextBox(); this.lblError = new System.Windows.Forms.Label(); this.picBanner = new System.Windows.Forms.PictureBox(); this.chkInstallNSCP = new System.Windows.Forms.CheckBox(); this.tabFinish.SuspendLayout(); this.tabConfigure.SuspendLayout(); this.tabParameters.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.tbcPages.SuspendLayout(); this.tabRetrieveCertificate.SuspendLayout(); this.tabVerifyCertificate.SuspendLayout(); this.grpX509Fields.SuspendLayout(); this.tabError.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picBanner)).BeginInit(); this.SuspendLayout(); // // btnBack // this.btnBack.Enabled = false; this.btnBack.Location = new System.Drawing.Point(367, 592); this.btnBack.Name = "btnBack"; this.btnBack.Size = new System.Drawing.Size(75, 23); this.btnBack.TabIndex = 1; this.btnBack.Text = "< &Back"; this.btnBack.UseVisualStyleBackColor = true; this.btnBack.Click += new System.EventHandler(this.btnBack_Click); // // btnNext // this.btnNext.Location = new System.Drawing.Point(448, 592); this.btnNext.Name = "btnNext"; this.btnNext.Size = new System.Drawing.Size(75, 23); this.btnNext.TabIndex = 2; this.btnNext.Text = "&Next >"; this.btnNext.UseVisualStyleBackColor = true; this.btnNext.Click += new System.EventHandler(this.btnNext_Click); // // btnCancel // this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Location = new System.Drawing.Point(538, 592); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 3; this.btnCancel.Text = "Cancel"; this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // // tabFinish // this.tabFinish.Controls.Add(this.lblSetupCompleted); this.tabFinish.Location = new System.Drawing.Point(4, 5); this.tabFinish.Name = "tabFinish"; this.tabFinish.Padding = new System.Windows.Forms.Padding(3); this.tabFinish.Size = new System.Drawing.Size(617, 500); this.tabFinish.TabIndex = 5; this.tabFinish.Text = "Finish"; this.tabFinish.UseVisualStyleBackColor = true; // // lblSetupCompleted // this.lblSetupCompleted.AutoSize = true; this.lblSetupCompleted.Location = new System.Drawing.Point(34, 35); this.lblSetupCompleted.Name = "lblSetupCompleted"; this.lblSetupCompleted.Size = new System.Drawing.Size(214, 13); this.lblSetupCompleted.TabIndex = 0; this.lblSetupCompleted.Text = "The Icinga 2 agent was set up successfully."; // // tabConfigure // this.tabConfigure.Controls.Add(this.lblConfigStatus); this.tabConfigure.Controls.Add(this.prgConfig); this.tabConfigure.Location = new System.Drawing.Point(4, 5); this.tabConfigure.Name = "tabConfigure"; this.tabConfigure.Padding = new System.Windows.Forms.Padding(3); this.tabConfigure.Size = new System.Drawing.Size(617, 500); this.tabConfigure.TabIndex = 4; this.tabConfigure.Text = "Configure Icinga 2"; this.tabConfigure.UseVisualStyleBackColor = true; // // lblConfigStatus // this.lblConfigStatus.AutoSize = true; this.lblConfigStatus.Location = new System.Drawing.Point(184, 204); this.lblConfigStatus.Name = "lblConfigStatus"; this.lblConfigStatus.Size = new System.Drawing.Size(141, 13); this.lblConfigStatus.TabIndex = 1; this.lblConfigStatus.Text = "Updating the configuration..."; // // prgConfig // this.prgConfig.Location = new System.Drawing.Point(184, 223); this.prgConfig.Name = "prgConfig"; this.prgConfig.Size = new System.Drawing.Size(289, 23); this.prgConfig.TabIndex = 0; // // tabParameters // this.tabParameters.Controls.Add(this.groupBox3); this.tabParameters.Controls.Add(this.txtTicket); this.tabParameters.Controls.Add(this.lblTicket); this.tabParameters.Controls.Add(this.txtInstanceName); this.tabParameters.Controls.Add(this.lblInstanceName); this.tabParameters.Controls.Add(this.groupBox2); this.tabParameters.Controls.Add(this.groupBox1); this.tabParameters.Location = new System.Drawing.Point(4, 5); this.tabParameters.Name = "tabParameters"; this.tabParameters.Padding = new System.Windows.Forms.Padding(3); this.tabParameters.Size = new System.Drawing.Size(617, 500); this.tabParameters.TabIndex = 3; this.tabParameters.Text = "Agent Parameters"; this.tabParameters.UseVisualStyleBackColor = true; // // groupBox3 // this.groupBox3.Controls.Add(this.chkInstallNSCP); this.groupBox3.Controls.Add(this.chkAcceptConfig); this.groupBox3.Controls.Add(this.chkAcceptCommands); this.groupBox3.Location = new System.Drawing.Point(308, 359); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(301, 111); this.groupBox3.TabIndex = 5; this.groupBox3.TabStop = false; this.groupBox3.Text = "Advanced Options"; // // chkAcceptConfig // this.chkAcceptConfig.AutoSize = true; this.chkAcceptConfig.Location = new System.Drawing.Point(9, 47); this.chkAcceptConfig.Name = "chkAcceptConfig"; this.chkAcceptConfig.Size = new System.Drawing.Size(190, 17); this.chkAcceptConfig.TabIndex = 1; this.chkAcceptConfig.Text = "Accept config updates from master"; this.chkAcceptConfig.UseVisualStyleBackColor = true; // // chkAcceptCommands // this.chkAcceptCommands.AutoSize = true; this.chkAcceptCommands.Location = new System.Drawing.Point(9, 24); this.chkAcceptCommands.Name = "chkAcceptCommands"; this.chkAcceptCommands.Size = new System.Drawing.Size(171, 17); this.chkAcceptCommands.TabIndex = 0; this.chkAcceptCommands.Text = "Accept commands from master"; this.chkAcceptCommands.UseVisualStyleBackColor = true; // // txtTicket // this.txtTicket.Location = new System.Drawing.Point(98, 45); this.txtTicket.Name = "txtTicket"; this.txtTicket.Size = new System.Drawing.Size(340, 20); this.txtTicket.TabIndex = 1; // // lblTicket // this.lblTicket.AutoSize = true; this.lblTicket.Location = new System.Drawing.Point(9, 48); this.lblTicket.Name = "lblTicket"; this.lblTicket.Size = new System.Drawing.Size(71, 13); this.lblTicket.TabIndex = 4; this.lblTicket.Text = "Setup Ticket:"; // // txtInstanceName // this.txtInstanceName.Location = new System.Drawing.Point(98, 16); this.txtInstanceName.Name = "txtInstanceName"; this.txtInstanceName.Size = new System.Drawing.Size(340, 20); this.txtInstanceName.TabIndex = 0; // // lblInstanceName // this.lblInstanceName.AutoSize = true; this.lblInstanceName.Location = new System.Drawing.Point(9, 20); this.lblInstanceName.Name = "lblInstanceName"; this.lblInstanceName.Size = new System.Drawing.Size(82, 13); this.lblInstanceName.TabIndex = 3; this.lblInstanceName.Text = "Instance Name:"; // // groupBox2 // this.groupBox2.Controls.Add(this.rdoNoListener); this.groupBox2.Controls.Add(this.txtListenerPort); this.groupBox2.Controls.Add(this.lblListenerPort); this.groupBox2.Controls.Add(this.rdoListener); this.groupBox2.Location = new System.Drawing.Point(8, 359); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(294, 111); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; this.groupBox2.Text = "TCP Listener"; // // rdoNoListener // this.rdoNoListener.AutoSize = true; this.rdoNoListener.Checked = true; this.rdoNoListener.Location = new System.Drawing.Point(11, 82); this.rdoNoListener.Name = "rdoNoListener"; this.rdoNoListener.Size = new System.Drawing.Size(163, 17); this.rdoNoListener.TabIndex = 9; this.rdoNoListener.TabStop = true; this.rdoNoListener.Text = "Do not listen for connections."; this.rdoNoListener.UseVisualStyleBackColor = true; this.rdoNoListener.CheckedChanged += new System.EventHandler(this.RadioListener_CheckedChanged); // // txtListenerPort // this.txtListenerPort.Enabled = false; this.txtListenerPort.Location = new System.Drawing.Point(132, 51); this.txtListenerPort.Name = "txtListenerPort"; this.txtListenerPort.Size = new System.Drawing.Size(84, 20); this.txtListenerPort.TabIndex = 8; this.txtListenerPort.Text = "5665"; // // lblListenerPort // this.lblListenerPort.AutoSize = true; this.lblListenerPort.Location = new System.Drawing.Point(43, 55); this.lblListenerPort.Name = "lblListenerPort"; this.lblListenerPort.Size = new System.Drawing.Size(29, 13); this.lblListenerPort.TabIndex = 1; this.lblListenerPort.Text = "Port:"; // // rdoListener // this.rdoListener.AutoSize = true; this.rdoListener.Location = new System.Drawing.Point(11, 24); this.rdoListener.Name = "rdoListener"; this.rdoListener.Size = new System.Drawing.Size(250, 17); this.rdoListener.TabIndex = 7; this.rdoListener.Text = "Listen for connections from the master instance:"; this.rdoListener.UseVisualStyleBackColor = true; this.rdoListener.CheckedChanged += new System.EventHandler(this.RadioListener_CheckedChanged); // // groupBox1 // this.groupBox1.Controls.Add(this.btnRemoveEndpoint); this.groupBox1.Controls.Add(this.btnAddEndpoint); this.groupBox1.Controls.Add(this.lvwEndpoints); this.groupBox1.Controls.Add(this.rdoNoMaster); this.groupBox1.Controls.Add(this.rdoNewMaster); this.groupBox1.Location = new System.Drawing.Point(8, 77); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(601, 276); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "Master Instance"; // // btnRemoveEndpoint // this.btnRemoveEndpoint.Enabled = false; this.btnRemoveEndpoint.Location = new System.Drawing.Point(520, 112); this.btnRemoveEndpoint.Name = "btnRemoveEndpoint"; this.btnRemoveEndpoint.Size = new System.Drawing.Size(75, 23); this.btnRemoveEndpoint.TabIndex = 6; this.btnRemoveEndpoint.Text = "Remove"; this.btnRemoveEndpoint.UseVisualStyleBackColor = true; this.btnRemoveEndpoint.Click += new System.EventHandler(this.btnRemoveEndpoint_Click); // // btnAddEndpoint // this.btnAddEndpoint.Location = new System.Drawing.Point(520, 83); this.btnAddEndpoint.Name = "btnAddEndpoint"; this.btnAddEndpoint.Size = new System.Drawing.Size(75, 23); this.btnAddEndpoint.TabIndex = 5; this.btnAddEndpoint.Text = "Add"; this.btnAddEndpoint.UseVisualStyleBackColor = true; this.btnAddEndpoint.Click += new System.EventHandler(this.btnAddEndpoint_Click); // // lvwEndpoints // this.lvwEndpoints.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.colInstanceName, this.colHost, this.colPort}); this.lvwEndpoints.FullRowSelect = true; this.lvwEndpoints.Location = new System.Drawing.Point(11, 83); this.lvwEndpoints.Name = "lvwEndpoints"; this.lvwEndpoints.Size = new System.Drawing.Size(500, 176); this.lvwEndpoints.TabIndex = 4; this.lvwEndpoints.UseCompatibleStateImageBehavior = false; this.lvwEndpoints.View = System.Windows.Forms.View.Details; this.lvwEndpoints.SelectedIndexChanged += new System.EventHandler(this.lvwEndpoints_SelectedIndexChanged); // // colInstanceName // this.colInstanceName.Text = "Instance Name"; this.colInstanceName.Width = 200; // // colHost // this.colHost.Text = "Host"; this.colHost.Width = 200; // // colPort // this.colPort.Text = "Port"; this.colPort.Width = 80; // // rdoNoMaster // this.rdoNoMaster.AutoSize = true; this.rdoNoMaster.Checked = true; this.rdoNoMaster.Location = new System.Drawing.Point(11, 50); this.rdoNoMaster.Name = "rdoNoMaster"; this.rdoNoMaster.Size = new System.Drawing.Size(374, 17); this.rdoNoMaster.TabIndex = 3; this.rdoNoMaster.TabStop = true; this.rdoNoMaster.Text = "This instance should report its check results to an existing Icinga 2 master:"; this.rdoNoMaster.UseVisualStyleBackColor = true; this.rdoNoMaster.CheckedChanged += new System.EventHandler(this.RadioMaster_CheckedChanged); // // rdoNewMaster // this.rdoNewMaster.AutoSize = true; this.rdoNewMaster.Enabled = false; this.rdoNewMaster.Location = new System.Drawing.Point(11, 22); this.rdoNewMaster.Name = "rdoNewMaster"; this.rdoNewMaster.Size = new System.Drawing.Size(167, 17); this.rdoNewMaster.TabIndex = 2; this.rdoNewMaster.TabStop = true; this.rdoNewMaster.Text = "This is a new master instance."; this.rdoNewMaster.UseVisualStyleBackColor = true; this.rdoNewMaster.CheckedChanged += new System.EventHandler(this.RadioMaster_CheckedChanged); // // tbcPages // this.tbcPages.Appearance = System.Windows.Forms.TabAppearance.FlatButtons; this.tbcPages.Controls.Add(this.tabParameters); this.tbcPages.Controls.Add(this.tabRetrieveCertificate); this.tbcPages.Controls.Add(this.tabVerifyCertificate); this.tbcPages.Controls.Add(this.tabConfigure); this.tbcPages.Controls.Add(this.tabFinish); this.tbcPages.Controls.Add(this.tabError); this.tbcPages.ItemSize = new System.Drawing.Size(0, 1); this.tbcPages.Location = new System.Drawing.Point(0, 80); this.tbcPages.Margin = new System.Windows.Forms.Padding(0); this.tbcPages.Name = "tbcPages"; this.tbcPages.SelectedIndex = 0; this.tbcPages.Size = new System.Drawing.Size(625, 509); this.tbcPages.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.tbcPages.TabIndex = 0; this.tbcPages.SelectedIndexChanged += new System.EventHandler(this.tbcPages_SelectedIndexChanged); // // tabRetrieveCertificate // this.tabRetrieveCertificate.Controls.Add(this.lblRetrieveCertificate); this.tabRetrieveCertificate.Controls.Add(this.prgRetrieveCertificate); this.tabRetrieveCertificate.Location = new System.Drawing.Point(4, 5); this.tabRetrieveCertificate.Name = "tabRetrieveCertificate"; this.tabRetrieveCertificate.Padding = new System.Windows.Forms.Padding(3); this.tabRetrieveCertificate.Size = new System.Drawing.Size(617, 500); this.tabRetrieveCertificate.TabIndex = 7; this.tabRetrieveCertificate.Text = "Checking Certificate"; this.tabRetrieveCertificate.UseVisualStyleBackColor = true; // // lblRetrieveCertificate // this.lblRetrieveCertificate.AutoSize = true; this.lblRetrieveCertificate.Location = new System.Drawing.Point(164, 229); this.lblRetrieveCertificate.Name = "lblRetrieveCertificate"; this.lblRetrieveCertificate.Size = new System.Drawing.Size(110, 13); this.lblRetrieveCertificate.TabIndex = 3; this.lblRetrieveCertificate.Text = "Checking certificate..."; // // prgRetrieveCertificate // this.prgRetrieveCertificate.Location = new System.Drawing.Point(164, 248); this.prgRetrieveCertificate.Name = "prgRetrieveCertificate"; this.prgRetrieveCertificate.Size = new System.Drawing.Size(289, 23); this.prgRetrieveCertificate.TabIndex = 2; // // tabVerifyCertificate // this.tabVerifyCertificate.Controls.Add(this.grpX509Fields); this.tabVerifyCertificate.Controls.Add(this.txtX509Subject); this.tabVerifyCertificate.Controls.Add(this.txtX509Issuer); this.tabVerifyCertificate.Controls.Add(this.lblX509Subject); this.tabVerifyCertificate.Controls.Add(this.lblX509Issuer); this.tabVerifyCertificate.Controls.Add(this.lblX509Prompt); this.tabVerifyCertificate.Location = new System.Drawing.Point(4, 5); this.tabVerifyCertificate.Name = "tabVerifyCertificate"; this.tabVerifyCertificate.Padding = new System.Windows.Forms.Padding(3); this.tabVerifyCertificate.Size = new System.Drawing.Size(617, 500); this.tabVerifyCertificate.TabIndex = 6; this.tabVerifyCertificate.Text = "Verify Certificate"; this.tabVerifyCertificate.UseVisualStyleBackColor = true; // // grpX509Fields // this.grpX509Fields.Controls.Add(this.txtX509Field); this.grpX509Fields.Controls.Add(this.lvwX509Fields); this.grpX509Fields.Location = new System.Drawing.Point(11, 115); this.grpX509Fields.Name = "grpX509Fields"; this.grpX509Fields.Size = new System.Drawing.Size(598, 369); this.grpX509Fields.TabIndex = 8; this.grpX509Fields.TabStop = false; this.grpX509Fields.Text = "X509 Fields"; // // txtX509Field // this.txtX509Field.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtX509Field.Location = new System.Drawing.Point(6, 197); this.txtX509Field.Multiline = true; this.txtX509Field.Name = "txtX509Field"; this.txtX509Field.ReadOnly = true; this.txtX509Field.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtX509Field.Size = new System.Drawing.Size(586, 166); this.txtX509Field.TabIndex = 9; // // lvwX509Fields // this.lvwX509Fields.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.colField, this.colValue}); this.lvwX509Fields.Location = new System.Drawing.Point(6, 19); this.lvwX509Fields.Name = "lvwX509Fields"; this.lvwX509Fields.Size = new System.Drawing.Size(586, 172); this.lvwX509Fields.TabIndex = 8; this.lvwX509Fields.UseCompatibleStateImageBehavior = false; this.lvwX509Fields.View = System.Windows.Forms.View.Details; this.lvwX509Fields.SelectedIndexChanged += new System.EventHandler(this.lvwX509Fields_SelectedIndexChanged); // // colField // this.colField.Text = "Field"; this.colField.Width = 200; // // colValue // this.colValue.Text = "Value"; this.colValue.Width = 350; // // txtX509Subject // this.txtX509Subject.Location = new System.Drawing.Point(71, 73); this.txtX509Subject.Name = "txtX509Subject"; this.txtX509Subject.ReadOnly = true; this.txtX509Subject.Size = new System.Drawing.Size(532, 20); this.txtX509Subject.TabIndex = 4; // // txtX509Issuer // this.txtX509Issuer.Location = new System.Drawing.Point(71, 47); this.txtX509Issuer.Name = "txtX509Issuer"; this.txtX509Issuer.ReadOnly = true; this.txtX509Issuer.Size = new System.Drawing.Size(532, 20); this.txtX509Issuer.TabIndex = 3; // // lblX509Subject // this.lblX509Subject.AutoSize = true; this.lblX509Subject.Location = new System.Drawing.Point(8, 77); this.lblX509Subject.Name = "lblX509Subject"; this.lblX509Subject.Size = new System.Drawing.Size(46, 13); this.lblX509Subject.TabIndex = 2; this.lblX509Subject.Text = "Subject:"; // // lblX509Issuer // this.lblX509Issuer.AutoSize = true; this.lblX509Issuer.Location = new System.Drawing.Point(8, 50); this.lblX509Issuer.Name = "lblX509Issuer"; this.lblX509Issuer.Size = new System.Drawing.Size(38, 13); this.lblX509Issuer.TabIndex = 1; this.lblX509Issuer.Text = "Issuer:"; // // lblX509Prompt // this.lblX509Prompt.AutoSize = true; this.lblX509Prompt.Location = new System.Drawing.Point(8, 15); this.lblX509Prompt.Name = "lblX509Prompt"; this.lblX509Prompt.Size = new System.Drawing.Size(201, 13); this.lblX509Prompt.TabIndex = 0; this.lblX509Prompt.Text = "Please verify the master\'s SSL certificate:"; // // tabError // this.tabError.Controls.Add(this.txtError); this.tabError.Controls.Add(this.lblError); this.tabError.Location = new System.Drawing.Point(4, 5); this.tabError.Name = "tabError"; this.tabError.Padding = new System.Windows.Forms.Padding(3); this.tabError.Size = new System.Drawing.Size(617, 500); this.tabError.TabIndex = 8; this.tabError.Text = "Error"; this.tabError.UseVisualStyleBackColor = true; // // txtError // this.txtError.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtError.Location = new System.Drawing.Point(11, 38); this.txtError.Multiline = true; this.txtError.Name = "txtError"; this.txtError.ReadOnly = true; this.txtError.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtError.Size = new System.Drawing.Size(598, 397); this.txtError.TabIndex = 1; // // lblError // this.lblError.AutoSize = true; this.lblError.Location = new System.Drawing.Point(8, 12); this.lblError.Name = "lblError"; this.lblError.Size = new System.Drawing.Size(209, 13); this.lblError.TabIndex = 0; this.lblError.Text = "An error occurred while setting up Icinga 2:"; // // picBanner // this.picBanner.Image = global::Icinga.Properties.Resources.icinga_banner; this.picBanner.Location = new System.Drawing.Point(0, 0); this.picBanner.Name = "picBanner"; this.picBanner.Size = new System.Drawing.Size(625, 77); this.picBanner.TabIndex = 1; this.picBanner.TabStop = false; // // chkInstallNSCP // this.chkInstallNSCP.AutoSize = true; this.chkInstallNSCP.Location = new System.Drawing.Point(9, 70); this.chkInstallNSCP.Name = "chkInstallNSCP"; this.chkInstallNSCP.Size = new System.Drawing.Size(149, 17); this.chkInstallNSCP.TabIndex = 6; this.chkInstallNSCP.Text = "Install/Update NSClient++"; this.chkInstallNSCP.UseVisualStyleBackColor = true; // // SetupWizard // this.AcceptButton = this.btnNext; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnCancel; this.ClientSize = new System.Drawing.Size(625, 624); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnNext); this.Controls.Add(this.btnBack); this.Controls.Add(this.picBanner); this.Controls.Add(this.tbcPages); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Name = "SetupWizard"; this.Text = "Icinga 2 Setup Wizard"; this.Shown += new System.EventHandler(this.AgentWizard_Shown); this.tabFinish.ResumeLayout(false); this.tabFinish.PerformLayout(); this.tabConfigure.ResumeLayout(false); this.tabConfigure.PerformLayout(); this.tabParameters.ResumeLayout(false); this.tabParameters.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.tbcPages.ResumeLayout(false); this.tabRetrieveCertificate.ResumeLayout(false); this.tabRetrieveCertificate.PerformLayout(); this.tabVerifyCertificate.ResumeLayout(false); this.tabVerifyCertificate.PerformLayout(); this.grpX509Fields.ResumeLayout(false); this.grpX509Fields.PerformLayout(); this.tabError.ResumeLayout(false); this.tabError.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.picBanner)).EndInit(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.PictureBox picBanner; private System.Windows.Forms.Button btnBack; private System.Windows.Forms.Button btnNext; private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.TabPage tabFinish; private System.Windows.Forms.Label lblSetupCompleted; private System.Windows.Forms.TabPage tabConfigure; private System.Windows.Forms.Label lblConfigStatus; private System.Windows.Forms.ProgressBar prgConfig; private System.Windows.Forms.TabPage tabParameters; private System.Windows.Forms.TextBox txtInstanceName; private System.Windows.Forms.Label lblInstanceName; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.RadioButton rdoNoListener; private System.Windows.Forms.TextBox txtListenerPort; private System.Windows.Forms.Label lblListenerPort; private System.Windows.Forms.RadioButton rdoListener; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button btnRemoveEndpoint; private System.Windows.Forms.Button btnAddEndpoint; private System.Windows.Forms.ListView lvwEndpoints; private System.Windows.Forms.ColumnHeader colHost; private System.Windows.Forms.ColumnHeader colPort; private System.Windows.Forms.RadioButton rdoNoMaster; private System.Windows.Forms.RadioButton rdoNewMaster; private System.Windows.Forms.TabControl tbcPages; private System.Windows.Forms.TabPage tabVerifyCertificate; private System.Windows.Forms.Label lblX509Prompt; private System.Windows.Forms.TextBox txtX509Subject; private System.Windows.Forms.TextBox txtX509Issuer; private System.Windows.Forms.Label lblX509Subject; private System.Windows.Forms.Label lblX509Issuer; private System.Windows.Forms.GroupBox grpX509Fields; private System.Windows.Forms.ListView lvwX509Fields; private System.Windows.Forms.ColumnHeader colField; private System.Windows.Forms.ColumnHeader colValue; private System.Windows.Forms.TextBox txtX509Field; private System.Windows.Forms.TabPage tabRetrieveCertificate; private System.Windows.Forms.Label lblRetrieveCertificate; private System.Windows.Forms.ProgressBar prgRetrieveCertificate; private System.Windows.Forms.TabPage tabError; private System.Windows.Forms.TextBox txtError; private System.Windows.Forms.Label lblError; private System.Windows.Forms.TextBox txtTicket; private System.Windows.Forms.Label lblTicket; private System.Windows.Forms.ColumnHeader colInstanceName; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.CheckBox chkAcceptConfig; private System.Windows.Forms.CheckBox chkAcceptCommands; private System.Windows.Forms.CheckBox chkInstallNSCP; } } icinga2-2.4.1/agent/windows-setup-agent/SetupWizard.cs000066400000000000000000000333411262555626500227060ustar00rootroot00000000000000using System; using System.IO; using System.Text; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Net.NetworkInformation; using System.IO.Compression; using System.Diagnostics; using System.ServiceProcess; using System.Security.AccessControl; namespace Icinga { public partial class SetupWizard : Form { private string _TrustedFile; public SetupWizard() { InitializeComponent(); txtInstanceName.Text = Icinga2InstanceName; } private void Warning(string message) { MessageBox.Show(this, message, Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } private string Icinga2InstanceName { get { IPGlobalProperties props = IPGlobalProperties.GetIPGlobalProperties(); string fqdn = props.HostName; if (props.DomainName != "") fqdn += "." + props.DomainName; return fqdn; } } private bool GetMasterHostPort(out string host, out string port) { foreach (ListViewItem lvi in lvwEndpoints.Items) { if (lvi.SubItems.Count > 1) { host = lvi.SubItems[1].Text; port = lvi.SubItems[2].Text; return true; } } host = null; port = null; return false; } private void EnableFeature(string feature) { FileStream fp = null; try { fp = File.Open(Program.Icinga2InstallDir + String.Format("\\etc\\icinga2\\features-enabled\\{0}.conf", feature), FileMode.Create); using (StreamWriter sw = new StreamWriter(fp, Encoding.ASCII)) { fp = null; sw.Write(String.Format("include \"../features-available/{0}.conf\"\n", feature)); } } finally { if (fp != null) fp.Dispose(); } } private void SetRetrievalStatus(int pct) { if (InvokeRequired) { Invoke((MethodInvoker)delegate { SetRetrievalStatus(pct); }); return; } prgRetrieveCertificate.Value = pct; } private void SetConfigureStatus(int pct, string message) { if (InvokeRequired) { Invoke((MethodInvoker)delegate { SetConfigureStatus(pct, message); }); return; } prgConfig.Value = pct; lblConfigStatus.Text = message; } private void ShowErrorText(string text) { if (InvokeRequired) { Invoke((MethodInvoker)delegate { ShowErrorText(text); }); return; } txtError.Text = text; tbcPages.SelectedTab = tabError; } private bool RunProcess(string filename, string arguments, out string output) { ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = filename; psi.Arguments = arguments; psi.CreateNoWindow = true; psi.UseShellExecute = false; psi.RedirectStandardOutput = true; psi.RedirectStandardError = true; String result = ""; using (Process proc = Process.Start(psi)) { proc.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs args) { result += args.Data + "\r\n"; }; proc.OutputDataReceived += delegate(object sender, DataReceivedEventArgs args) { result += args.Data + "\r\n"; }; proc.BeginOutputReadLine(); proc.BeginErrorReadLine(); proc.WaitForExit(); output = result; if (proc.ExitCode != 0) return false; } return true; } private void VerifyCertificate(string host, string port) { SetRetrievalStatus(25); string pathPrefix = Program.Icinga2InstallDir + "\\etc\\icinga2\\pki\\" + txtInstanceName.Text; string output; if (!File.Exists(pathPrefix + ".crt")) { if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe", "pki new-cert --cn \"" + txtInstanceName.Text + "\" --key \"" + pathPrefix + ".key\" --cert \"" + pathPrefix + ".crt\"", out output)) { ShowErrorText(output); return; } } SetRetrievalStatus(50); _TrustedFile = Path.GetTempFileName(); if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe", "pki save-cert --host \"" + host + "\" --port \"" + port + "\" --key \"" + pathPrefix + ".key\" --cert \"" + pathPrefix + ".crt\" --trustedcert \"" + _TrustedFile + "\"", out output)) { ShowErrorText(output); return; } SetRetrievalStatus(100); X509Certificate2 cert = new X509Certificate2(_TrustedFile); Invoke((MethodInvoker)delegate { ShowCertificatePrompt(cert); }); } private void ConfigureService() { SetConfigureStatus(0, "Updating configuration files..."); string output; string args = ""; if (rdoNewMaster.Checked) args += " --master"; Invoke((MethodInvoker)delegate { string master_host, master_port; GetMasterHostPort(out master_host, out master_port); args += " --master_host " + master_host + "," + master_port; foreach (ListViewItem lvi in lvwEndpoints.Items) { args += " --endpoint " + lvi.SubItems[0].Text; if (lvi.SubItems.Count > 1) args += "," + lvi.SubItems[1].Text + "," + lvi.SubItems[2].Text; } }); if (rdoListener.Checked) args += " --listen ::," + txtListenerPort.Text; if (chkAcceptConfig.Checked) args += " --accept-config"; if (chkAcceptCommands.Checked) args += " --accept-commands"; args += " --ticket " + txtTicket.Text; args += " --trustedcert " + _TrustedFile; args += " --cn " + txtInstanceName.Text; args += " --zone " + txtInstanceName.Text; if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe", "node setup" + args, out output)) { ShowErrorText(output); return; } SetConfigureStatus(50, "Setting ACLs for the Icinga 2 directory..."); DirectoryInfo di = new DirectoryInfo(Program.Icinga2InstallDir); DirectorySecurity ds = di.GetAccessControl(); FileSystemAccessRule rule = new FileSystemAccessRule("NT AUTHORITY\\NetworkService", FileSystemRights.Modify, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow); ds.AddAccessRule(rule); di.SetAccessControl(ds); SetConfigureStatus(75, "Installing the Icinga 2 service..."); RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe", "--scm-uninstall", out output); if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe", "daemon --validate", out output)) { ShowErrorText(output); return; } if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe", "--scm-install daemon", out output)) { ShowErrorText(output); return; } if (chkInstallNSCP.Checked) { SetConfigureStatus(85, "Waiting for NSClient++ installation to complete..."); Process proc = new Process(); proc.StartInfo.FileName = "msiexec.exe"; proc.StartInfo.Arguments = "/i \"" + Program.Icinga2InstallDir + "\\sbin\\NSCP-Win32.msi\""; proc.Start(); proc.WaitForExit(); } SetConfigureStatus(100, "Finished."); FinishConfigure(); } private void FinishConfigure() { if (InvokeRequired) { Invoke((MethodInvoker)FinishConfigure); return; } tbcPages.SelectedTab = tabFinish; } private void AgentWizard_Shown(object sender, EventArgs e) { string installDir = Program.Icinga2InstallDir; /* TODO: This is something the NSIS installer should do */ Directory.CreateDirectory(installDir + "\\etc\\icinga2\\pki"); Directory.CreateDirectory(installDir + "\\var\\cache\\icinga2"); Directory.CreateDirectory(installDir + "\\var\\lib\\icinga2\\pki"); Directory.CreateDirectory(installDir + "\\var\\lib\\icinga2\\agent\\inventory"); Directory.CreateDirectory(installDir + "\\var\\lib\\icinga2\\api\\config"); Directory.CreateDirectory(installDir + "\\var\\lib\\icinga2\\api\\log"); Directory.CreateDirectory(installDir + "\\var\\lib\\icinga2\\api\\zones"); Directory.CreateDirectory(installDir + "\\var\\log\\icinga2\\compat\\archive"); Directory.CreateDirectory(installDir + "\\var\\log\\icinga2\\crash"); Directory.CreateDirectory(installDir + "\\var\\run\\icinga2\\cmd"); Directory.CreateDirectory(installDir + "\\var\\spool\\icinga2\\perfdata"); Directory.CreateDirectory(installDir + "\\var\\spool\\icinga2\\tmp"); } private void btnBack_Click(object sender, EventArgs e) { if (tbcPages.SelectedTab == tabError) { tbcPages.SelectedIndex = 0; return; } int offset = 1; if (tbcPages.SelectedTab == tabVerifyCertificate) offset++; tbcPages.SelectedIndex -= offset; } private void btnNext_Click(object sender, EventArgs e) { if (tbcPages.SelectedTab == tabParameters) { if (txtInstanceName.Text.Length == 0) { Warning("Please enter an instance name."); return; } if (txtTicket.Text.Length == 0) { Warning("Please enter an agent ticket."); return; } if (rdoNoMaster.Checked) { if (lvwEndpoints.Items.Count == 0) { Warning("You need to add at least one master endpoint."); return; } string host, port; if (!GetMasterHostPort(out host, out port)) { Warning("Please enter a remote host and port for at least one of your endpoints."); return; } } if (rdoListener.Checked && (txtListenerPort.Text == "")) { Warning("You need to specify a listener port."); return; } } if (tbcPages.SelectedTab == tabFinish || tbcPages.SelectedTab == tabError) Application.Exit(); tbcPages.SelectedIndex++; } private void btnCancel_Click(object sender, EventArgs e) { Application.Exit(); } private void tbcPages_SelectedIndexChanged(object sender, EventArgs e) { Refresh(); btnBack.Enabled = (tbcPages.SelectedTab == tabVerifyCertificate || tbcPages.SelectedTab == tabError); btnNext.Enabled = (tbcPages.SelectedTab == tabParameters || tbcPages.SelectedTab == tabVerifyCertificate || tbcPages.SelectedTab == tabFinish); if (tbcPages.SelectedTab == tabFinish) { btnNext.Text = "&Finish >"; btnCancel.Enabled = false; } if (tbcPages.SelectedTab == tabRetrieveCertificate) { ListViewItem lvi = lvwEndpoints.Items[0]; string master_host, master_port; GetMasterHostPort(out master_host, out master_port); Thread thread = new Thread((ThreadStart)delegate { VerifyCertificate(master_host, master_port); }); thread.Start(); } /*if (tbcPages.SelectedTab == tabParameters && !File.Exists(Icinga2InstallDir + "\\etc\\icinga2\\pki\\agent\\agent.crt")) { byte[] bytes = Convert.FromBase64String(txtBundle.Text); MemoryStream ms = new MemoryStream(bytes); GZipStream gz = new GZipStream(ms, CompressionMode.Decompress); MemoryStream ms2 = new MemoryStream(); byte[] buffer = new byte[512]; int rc; while ((rc = gz.Read(buffer, 0, buffer.Length)) > 0) ms2.Write(buffer, 0, rc); ms2.Position = 0; TarReader tr = new TarReader(ms2); tr.ReadToEnd(Icinga2InstallDir + "\\etc\\icinga2\\pki\\agent"); }*/ if (tbcPages.SelectedTab == tabConfigure) { Thread thread = new Thread(ConfigureService); thread.Start(); } } private void RadioMaster_CheckedChanged(object sender, EventArgs e) { lvwEndpoints.Enabled = !rdoNewMaster.Checked; btnAddEndpoint.Enabled = !rdoNewMaster.Checked; btnRemoveEndpoint.Enabled = !rdoNewMaster.Checked && lvwEndpoints.SelectedItems.Count > 0; } private void RadioListener_CheckedChanged(object sender, EventArgs e) { txtListenerPort.Enabled = rdoListener.Checked; } private void AddCertificateField(string name, string shortValue, string longValue = null) { ListViewItem lvi = new ListViewItem(); lvi.Text = name; lvi.SubItems.Add(shortValue); if (longValue == null) longValue = shortValue; lvi.Tag = longValue; lvwX509Fields.Items.Add(lvi); } private string PadText(string input) { string output = ""; for (int i = 0; i < input.Length; i += 2) { if (output != "") output += " "; int len = 2; if (input.Length - i < 2) len = input.Length - i; output += input.Substring(i, len); } return output; } private void ShowCertificatePrompt(X509Certificate2 certificate) { txtX509Issuer.Text = certificate.Issuer; txtX509Subject.Text = certificate.Subject; lvwX509Fields.Items.Clear(); AddCertificateField("Version", "V" + certificate.Version.ToString()); AddCertificateField("Serial number", certificate.SerialNumber); AddCertificateField("Signature algorithm", certificate.SignatureAlgorithm.FriendlyName); AddCertificateField("Valid from", certificate.NotBefore.ToString()); AddCertificateField("Valid to", certificate.NotAfter.ToString()); string pkey = BitConverter.ToString(certificate.PublicKey.EncodedKeyValue.RawData).Replace("-", " "); AddCertificateField("Public key", certificate.PublicKey.Oid.FriendlyName + " (" + certificate.PublicKey.Key.KeySize + " bits)", pkey); string thumbprint = PadText(certificate.Thumbprint); AddCertificateField("Thumbprint", thumbprint); tbcPages.SelectedTab = tabVerifyCertificate; } private void btnAddEndpoint_Click(object sender, EventArgs e) { EndpointInputBox eib = new EndpointInputBox(); if (eib.ShowDialog(this) == DialogResult.Cancel) return; ListViewItem lvi = new ListViewItem(); lvi.Text = eib.txtInstanceName.Text; if (eib.chkConnect.Checked) { lvi.SubItems.Add(eib.txtHost.Text); lvi.SubItems.Add(eib.txtPort.Text); } lvwEndpoints.Items.Add(lvi); } private void lvwEndpoints_SelectedIndexChanged(object sender, EventArgs e) { btnRemoveEndpoint.Enabled = lvwEndpoints.SelectedItems.Count > 0; } private void lvwX509Fields_SelectedIndexChanged(object sender, EventArgs e) { if (lvwX509Fields.SelectedItems.Count == 0) return; ListViewItem lvi = lvwX509Fields.SelectedItems[0]; txtX509Field.Text = (string)lvi.Tag; } private void btnRemoveEndpoint_Click(object sender, EventArgs e) { while (lvwEndpoints.SelectedItems.Count > 0) { lvwEndpoints.Items.Remove(lvwEndpoints.SelectedItems[0]); } } } } icinga2-2.4.1/agent/windows-setup-agent/SetupWizard.resx000066400000000000000000000157321262555626500232660ustar00rootroot00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 AAABAAEAICAQAAAABADoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAAAAAAAAAAAAEAAAABAA AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD//wD/AAAA/wD/AP// AAD///8AAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAcAAAcAB3AAAAAAAAAAAAAAcABwB///cA AAAAAAAAAAAAcAAA////AAAAAAAAAAAAAAAAAP///3AAAAAAAAAAAAAAAAD///9wAAAAAAAAAAAAAAAA j//4AAAAB3AAAAAAAAAAAAj/jwAAAA/4AAAAAAAAAAAAAAiAAAAP9wAAAAAAAAAAAAAH9wAAf3AAAAAA AAAAAAAAAH93d/cAAAAAAAAAAAAAAAB////3AAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAB/////9w AAAAAAAAAAAAAAf/////gAAAAAAAAAAAAAAH//////h3AAAAAAAAAAAAB/////+I//h3eHAAAAAAAAD/ ////AAB3j//3AAAAAAB4////9wAAAAf/+AAAAAf/+AB4iPAAAAAAj/cAAAAH//AAAAD3AAAAAAcAAAAA B/+AAAAAjwAAAAAAAAAAAAB3AAAAAA9wAAAAAAAAAAAAAAAAAAAIh3AAAAAAAAAAAAAAAAAAD//wAAAA AAAAAAAAAAAAAH//9wAAAAAAAAAAAAAAAAB///cAAAAAAAcAAAAAAAAACP+AAAAAAHAAcAAAAAAAAAB3 AAAAAAcAAAcAAAAAAAAAAAAAAABwAAAAAAAAAAAAAAAAAAAAAAD/////4AAAB8AAAAOAAAABgAAAAYAA AAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAA AAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAcAAAAPgAAAH/////w== icinga2-2.4.1/agent/windows-setup-agent/app.manifest000066400000000000000000000053631262555626500224110ustar00rootroot00000000000000 icinga2-2.4.1/agent/windows-setup-agent/icinga-banner.png000066400000000000000000000611161262555626500233020ustar00rootroot00000000000000PNG  IHDRqMFȥsRGBgAMA a pHYsodaIDATx^݉e/~5#t'=wg&#(x8A\=xPAQ C!@& $d"@aܟOժ.+wwHS}~]5﻾WPB o _Ůxg|pΜ97|,Xy_=F( dvߴiӪU~{n={+=֭[evYK{j4Lr#FF {ؔu= ܨmwS+TP.Hۼ]륗^ڼy j"͛sL"E ,pwt馛ǩDbI (6ٽ'~5ǚZL˜={6+ĝ_s%"ٺI|/>.">VP![^* bֳ٘Qqj *H;;v S]"*NPB,MrP˓O>!Npofg7P"zoVzj2u4 I QG?s6٧3ύ7+VDOo3gdn/ItNu0J,h ^4SC[TZB 5!e/RKVjP NE$ٽ._<^$}L%[H4˖/4PiӦ0AIa@{O?4o*qɄP5JXܹ>E06sq%NjQqj *wggGbboYv"/5gZӿ&>}:fBK8 dBKRe[n<(6FB>dW ,n=ӬƠn7o6PX\&{G&Z@ũ*T.FV i~a3sLT%n ?>o5ⳢB((Bx:W$ $ Rҙ_߶mvDen`e;o 6fU^2GO"4r%VP»xHfQy뭷Ξ={ś7oF'^y+ӿaΟzuKQΝ;G!Q͢NaRYLЃ*1'ԛZE{a"?wn h=Ipt ѣ;>#Rv޼nP}ch]/ũ>B * h4tMd cǎ5kh[1mݦőO7K3w"QȢE8F^1%21s*Di賧6Z y^ L~inpG -KC_ut ^Jq!KDSԔt N-TP"|IOχH{(z>GiCvQ2*f4cƍF& 6LXAQQ]pF2I ;]z g_v8oz3f09szȣ:Ǭ{0JB 6wVrٲ{SlUP 2J׭[*K=ٽv܉BЉDKZPQN+FU4 #z˄RUXb\B3("04 /ɤAIgI[L ۔tܗ#fSO=, FIx! BOw ?= #G67_?[n!WB 3굦JB'Heɒ%TE\D:;Ul4]9],E!xT32nhW^y31(b3vܹ:E4 Kf^RP!`4h:iʔoj%ewG.X8 8LzOBN¦-w б~mϼ&wb*TG;ߴi5k.[]ˑЭdۻhѢGu~wzg_|XBYAHN'jl&4"{]/]݉~j qk?-"+z! L P^Y\ EY ͜?dIc~mCni1ą]]ҧ?]zB ( PM1YgJ$DJ?Jn£:W !C/ʌWpE j#È6hQXn N^wx7@{ _',.MߙҦ4H={L/xyK Nu׍߿a让ӦL6mF5(VsǎٍI^@|}"+VDwJQu[Rܳe˖O F+n:%Z* sñ:V%єmp'gpg0{lѧ$&-%p+,B~ދϩg>tȄMGz}wqmLM *E*zARM.jEwUHx놮N__;ћ@NOw_j a/K]g7J:9:]b ]z]w]fB ޙ(.$xb&֊VP+ٽ.>b\j>9#_q]J?C?XG˻ăsP<{ ҀZ%^ue {Az]xSr GǮƷt&{DO1vOr'ڲN||F?,G_ERB {*C/jp?!`A5d8#:v 􆭗-[o4cm$@Q0bbRÇĞ@qa7h"R,a{8)._).!G\[9{{SK;ycN;pꘖK^]bW?N@ QzYB {Ųj#deĈk֬)A$ S| Qp-Uٽn1jɒ%XĬWø+sѼmڴ MfB50 v5zAf,D׈q3-ްw>#<%ѳ7 XMjݯY"E̯[%&[ߓzõ׶ p|GU54Y7fI'钅 ?dg*TPa/C*V_~YS~Ty.j-DRb5٠.=e@O Ɨޱ.H9<0J=ҏ"l~ GAFDQ DX+W#TuzE2L숇*7nܸVG2;Y-AJ K <4GAcqKxȼ\.?w g{;J;{ٱ};>E?K_9~Di?IywhˀÆt64tclXέ^B JUI,]F<Ų3fh" z+VP)i."Ā<4ȃ=}vF(zhgqc5^ݦ6X3{8ڄ& M)zbl˛h exJD7٢=aN-}7_G?8Cѯ~4g?~v{ɾ[ Q];zI'K+TP# N"2)!tg7v*zVu_G N'z \~}|yex-aCi8FZ["0} G8\^j<%Ѐk3`x]uKr+'=RD= 0PuD+V7¨<(jÜ~pŃON?c?ATڲ>mCk:mCڇ iw_WXJ1;>G57M2|x)F^{Un WPBQ!M'Ϛ5KG{vg~.-e7x.jJ|f,X>b:+?R .D.f @9я*<3KG֕OU|#}mZv66v1jdѰ~:i?oOBCW_}r1>1ڇ8~ܴiS=s>ځ*T[QϟtiK.nfR]f Һ뮻U3o== ݺ;0Sq 1N ͸(nL[J6UKllEaąьzh}mZŻ 9Vقbb'[Zu5(YPs ?;[j|5 *N.d/ulIU>xB_0g EN\;g~iP:m\gm-#:d]{16 ~wfOgK/=p5;j_y WPB*}!Jp{/2ݕ+WRUEI߉]_=}Ϟ=[ӆJ])/7i92'E$YڵkΔR9AľFFQ"b 8YAbG|E&d,3\;^UۙJcBx\uxGy%! di|'HZ<|@~"^q`q 7^XOI5OGj{1]&|ƍJ׈FfAyYm<+.>㞋w0.Z?;.@vi!ӛ"ƑFvB {-X b*jvDwt\vzW `n+~ \A9nc)~Uv7xNVZ Pp/*@DP[ a`G<~CFfN #..><pI,%E]Y/ dIEl l:D<0_sxLzڻ}*G?6q~چ >|Tkӄѣ&M8M2u$:)8uyiH+>}g(dvr$zJBГ@O^n *";RbQ7lؐ38CvWTࢻeRͨ %7bBK!DSd&`]B X]2e'1Gf[tmb~gvv߯m萎c[';9!iS6uڴS&0n֮Ɔ}M7фRdl~jႇ-Vcwl߾eK۶[DсO%Uɷ{ svBBxGA !KL9k,uE.hRpWDU狱] dF2 09shI 2]@?։&NB_"ڞ KL0zj!v4OM~O"rY+CBP.suJ0G00/3^;Bnw9uMj׿}ƆmRT|z42e}ظ AvBO]xd{:b%8ѩ???i؆q c//\T.aͪsnG ^󛟟s_=d̴q; :}W?{/󥋖L]偸+N[N;_889S?zߺ?n{z'V?~_y*Txo*m=|36U1Jv/WNE)xwiņ)>. Oo-@A{ε."ZR`uQEdr `pa%71>f IO7k{%_I/ &otdl|w?O>rN=`)'N:u4'N0zԘ}j~lҤ}#q8IGWV 3[?8bLۀ-4'ƶ#7K~wQ][ohͮ8d́4A'ͩJ;ܗ^y<}$Jvqr~_sfC]?rhkO~f7*TxUw܉0,mC"B4drsd$d-,wW3K/޹tiQKnKn 7Kb 7jٲeF kW^u}yU>ѝe͚5Tk.bNn#pTxBdoWf4c9_`~KIh3)O穎gG#ׯ4c'O8iƌ>yDWCC>R"B 위6sŁpGյ:hcXAKsi?F<ř~Sخ.ןO׭-Sj<#Ks;1ɶM Hh5aTQCۯO^y n;goU}^툚9pNN&b\m\t1৵k<[iqpի.[l(ԢvhUK O?f":p'`CLA`/PhMM (oT|܋DC6 h*%7Gq9jTy)-1ʆ|SJ2L9O ^jsp 8qWJCCK~zyp|C0D%&DXȶ/~ cFPuwll>$9nHO9} { ц7pUGb'?+ӶI-`+m3&͛6O9e}5줉L5I12vo?u*NJ|k?2j L4_ڧwys=AG}ꈶ#X8_9|Vn^R:U7[믣iL򍄲iרЇTIz{)pc^*CnNL-.rH@us6΋A%߳EsĮ%ZG~O#5=ЃJ?E()ᢄhveUx2K] dQC-E+,(K`ѹGʥ=H)ڻ+_Cj<8 G9etk˨> oC}邏bTyZb]sC_\ί>ڿ\3N!jI+Hl{ ٴ~ĦM##..̻knSy᠎I?>_//~pc)o[ _hXڄScoGQfGctܿ=:SV1'm_=qqnSݺ߻cˇҧtX|'iN}C?}Ә{C Rf-s^.fzۇGOq7sC{(<[ ]tUU/ -<Np )s=G@5:_"(pW^7 #|rM 585ږ.\2vxgCiC+kg_:#3.Lރ1]C͓9@9l{n)ܯsp7Vq展G i *uX8cR8Y;Bw,.W\%7(zgz5lA@רcM=؃X4 h w =J9bÂZҫ4/~_޻> ^ͩͩ:?t1>5mGQ9Br;/"}sG7mé4W^ryzjks1(od#3] 7vl~؁} ;/Ks ށHd:k*gH 0@*]q=kTƼ[`]Rb@3RU 60RKw=C<23nwv$ \U! 6hCchU}@X|)3(Y"S%V&E33I47"xήiR@-Wc3.9\-˛897\d%񅆞@s ;0$qkxJ:>9묳.0s[_ 's)S'u.ƭc>4Iđ8<S3=S'G?bX˩}PS~9$S)cOC[:'5kدg7B 4?S/nyz4GX߲)Msxb֤(F!+Tx = )ldUzj4* E\U/˗TfO)b… =:-::v5X'Hߩ8ҙ1U@%n] nEN f)P:Kipцpn$Cp;鑢xq!*aI27XDG0q7\?<}M"+ Db.3h܁Y;pCF|i.-hqn-@.\+>3 p  95)e_~y!^{_pA\pj(oRKƯܙ _Y7rj(? ѱoB~4'pjzF]`a-'-31~O)0D|'[\juWT ðnPUܑC,҃VF |Q e[R[ F0dTgR^|]Qͱ kȽRF Pz2<Pjo6x]`T܅hj9sLl<mC&ny#x&@ )@*" !R_ " (3<= @thأIjg.)nxło8N"HȖ[g9EQؤ&' FQT穑qq`q*J3ǜ};)>E SO+"Bm/}ꑟBNiʩ_-|w@]N yimq*ԏ3y, D*pj_y7jAlڔ|ޙuᅥؒLvO?5lnaH;;ОWa/AIf ?)LQArs ErG_jb@g)#laN( K BEFWp^XAK @p7sQ4\(GhP.]C|7jTF˙hr% Gy$+)ǘh8"%P|wLji ^ Tyĝ/NO9+yξϷ3Sb2Wz}Ta2q6 S)?tZֺ֧ũxU HOt͟#^0}7$ho~~N)q MEv1|Pao dS` O(ʚXQ`MZ;ϟ^T44c;=l!,? Jfd -rVV+eEAW.ܠG7Ʊs$ ZP '`dNNh#LyϞ6/ʻXnh3 ߔeL >4 ģtMMb&'NJ@27"8y@qR{ &"7S=Ž_|79C=þwϝ{х^qL]DrW.[6jذ cGO0W^_E@'NKENk]}j©B~W%#E??O?gZSчиOnJo׳*9XWuOU(Rq$.Ě挘6(Z+GjFkģ: tCƭ9-ËmGm>Q0Mgk9㏇gXb +4RPq:Gy[HW\2C(St @|޲e`G0LOtI ԓκ;̗@x neL1ܤ[$S!,/|V%|"'q>&sgYʤXLg/6~#o8y ÿJf"~uԧV>|S!sݜ:ȩu'=9c'}nauoμMo#q |Kǵ=}Պ.R%]-fDZNMjr#*x4 ] jS&(^nJMEp]PUS^A]xHu@k `kcmG>s M O(%+m3Zu2dlZa ֏՜M}~wWqˑ)m0njB>Jk$}GGL.ՀS5,ԅ$x u9J)t{\Q2H"dF(j~9FUvԂ2kxE[yNxHy?ڮh[ /yWX!%}6:dT,RH1J!yO RK A"4 @' %UBפD>VeD3`$pbmgjTBx,"|u͎%N}ann>`)SL:ec:1tȣK$ړEDً r=է/6>O>5s]p7>C1&my~sk&ԛEǸD3*l7}vYT[QXу:!)jktĢ="Yj"CW!HB5v B;D{Ѷ"h[-\Cf-m(]wMKWXQ,fE B-X?aeLxe'|8s3hv $Wq9&~zA8zy)-@SOmпq؎ɓ'"ԩ2ą; ]pZ\SKz'@3 qԧHCs]sO9[<W?6mBwmn8s{ST:C5bLƇxŘ?_~ݦhC4'^fl.?k X}XWRJyT4EEʼnBe"T]fϞ+Uʴb]L$(և$fl.Aj[ղL(]j=YIr&y|{t8CD( (*$R49n+|aK@6h4gd%Lyt~Ļy5|CK!r, ]"/'Y9nz/1&iSR*X4(gZ0fDDAc4[$rICd (oYñݍ Bx$zK1?aCG4M5e)S&0niYN Z:-ΈAwv\.A(YŕSi86>e'=񫖠!%=piAt nZ$Rph; _<1G?<"%](m7Z^JdWwE|HMWJ%CuC VO'P;HBX1X|(1^*n+SʍC RkA=zĦt"{@+ 1+h*¡Fc+TyMhx \w9 3vw@JyP;P9.,TEz3pZ%X'L32!EjA`S'1 QI`i"ɹt ֤.n("qYVDg"1 qcML+p8- b[qD] uvк>7\s @hrN F{C?N>dX:0-_#rͣ5m?u/qj񍣏yoG{ۿ83Z4zXS>.w)n7~opwײٍ !X<*.uhYp;NT[PWcl(-:+ѶTFGQعRE,*E-ڸ"xjN +ЩR 1q6%OșDJbq*U%Jdƴ瀢bP;=d)O+!&^.˧,J]&+\gE*MAV;"0fY!,nIA!z䍉x,=VB"L͢ S8Ɔ!?/]mo{Saӆ vhˠAC߿caCsfX,b:ԧb]n=F&A=w;6k>,'ZS]+~ꈺxס#LO\K.ԔLVn~:{+XзϘzo']?:Vxw!f-fpxSKSq i %^V8oKhJuJҏY80&P@# F$3sL+NOD$箪(6B̈́R1B6$RŊ[&Atը( r0牁Q%TjFo'JmcD<8߂2]!WigEԑvs.K iP̾"Hdif̘24 Z X [AE\qVQ ٍn@ /3)5Ed7 –O_~i~rʌoQq1ٿ{ Z??x߂+[[r6lMOX7?8NEѧkOKo"ڑ|4)Nj]|a秧~pgms}+Hlw. Rh51D?U,DKц*H":PRbȫh ?Q q+*,L4/R!kfRih@ᨂDE@G!բPu!IC ,q$F8X{P0 sIf1+(E $1BrςZŽbt]@Ʃ٫n@^xuO6jIHƔF!EECMhq΍UB@ .Cc6B7(8/ZL"^dGVko5=g q&BF|6$4W/"Er%19:)-:xd)B4d0wv;+dmmv+RtXIɉ#r'r%c2Yz2 jcPoZ*hdqE,N d7 rHr AKpX TEa%۳>kŭ >PwRk!}4ڋ2{e+O%S~,;562$v gI:!c"ٹoM/2cu\ܯ9^0ɓ_] y '݋Q c&&ܩ}L{n/]i<t j䟊n|߿ɏ: [% =}`ӯ~MWg`: OɆʮc{ꊋFEPǃb 2ҍ#jMtc*BX$2!&9J 4h:qi-VԣRR룖w^ůՌ)/ЬJCHc]n PZX1rȜ|[!(djɓܢO svo,:熈E)E] :@X\\^>鎮x*\uejA 0+dRܰLe;BG)Usz=.L LPLnW\X {+G}vQĆQhpÃo'r̸m}xJ "4 oh2;|G$"oX[_'''~sC۟-?Wſp쐎 5u䫶E.ZriMuŗbM91ޘ\KwϾ방o(* <`Ĕ 5gݓFk$qC="3锁['>0~Wv;›ݨAXI3tc{V|VkmPMm9lvF1DɈ!P#>+(AT+ :HL4T7MmREXJ^iz)hFլ 栖$J!0!L^Ng&Q2^ZDh\K sO$Zѕʣ heP, | Y Ԓr)m-xc,E' RɃAp1F.[!cNˌϦYE,oEHV$Гcnʏ(,AI5#L  ^zwy.?OW_}o϶ ln Mg!V]u%p-٥Bpuo9 cu [5|kʿ~n[>뼳zŪR7?sΛ3^6r,~pg{%ޭO=}ѯ/aG6~O{Y:<|Oξ>_B QK1Ug=D+: =iCz"hߪ$@qHN$Uy;YQ!Z٘ʢPSU zVib : ^T%E2?V(ȫ$mFFł5K[Fm6PT+L(pūvs)Vc΃$rj('@IFRa{ Y=ĔZ%DBT D~Lde er3.@E<`ٺEm_'(9m9Ul!K1L ⑺XuӗGV7l YIcã\p8G(+kꪫ.J?֒_3jMXL)2}Ȉ0]Cf[o1cKBs۞}oywݳ qkgEL#vUhFDc*Jڄo<S!e[Jbm)ĸSPy5֦+x)Ahan U9I-"BRku!ʳ!E)dyce)84J3bJ(2rHXTQȞ? %JjO)D )O<|XqB)Gʟ 5Z&"8DQe)/#oAFy*bdvd0"V^?rɜ kIS ro/E;E8#ĭ"BB]=}G(B NlGĩUţX$ NHu] džݿ/7x/_jL11]7olQ۠!nB˄v܂LijJD{E` {gd,HSBnZkTwV_4h'o蹮b† 8P+2k*ӆD6%6P9`,Spq6v=@I!!a+FUʱ⣧q-U%^A*r*#/"q t&YP.yb=?$P*,#{tFg4^JJdd6)]NלfA9ړ[ unԦw-H/7b:$x*}0DX<+8ʅ ޛe 3bOIy0T*Ņћ:K'uK<npѐ;6馛w/bu1ؚIiq3Z7UhvCk ];Idp )q%~ 3?Bv›E1 }̪bᩌGaR=xeZd4 J (9!m*Jrf-%*ʮ3PcxP" 5@4|ruwm4ۊ8Ay,!R()"]TńgIEVJ}`)*Qf焑JN)5#n\ V 1GPM8OqKbE%2 6$>R`,]JnD ̪d٣6Ңaʕ)UR@^6P `o͎\ y&'(v4Ƽy!|x1%9wm@ '<Ѥ!k H=(ŋ'Aq"flyuivc}ka KoD[o~2pQ,M{an`})=PiX7yXTK )ϐ,i'(njjVlT-c6xE]ꝽgWT)JX(ڶ-\*zj[r]{`CEۊc<nt'b䖨-T de#J<XVqj;KKrɘ!| 79NƂI/%E]JFGΙ @x"b@?uNtϒCT.Uo9\Q -^7 ƾ]p |sJURJL"e Zn}Vhv,Ƴ*IWh(,H*ʭɀeBO)4 tC$tҜpݨٰhL$n-c,_&X,Ed~mq)aK,W! 0w\b7Nq9{}F 1*] !ְXo$|'0yE+M&=\ђFl n N,ܚ#&6nQBI_F3jZcYs~ڄ 2+5<;ƉrFȫ/%yF@h q7*K*N,D;Gf-=lwIkK[֠Ai{a8e@2*yCA ^ʼ3/&+ eRd`[ a5db'^bTX9SLIlT'nTo%TQ+̈4L+O&c36=E*ܦMB81cK;u+=Cb݆KU5\bW% w xvKifMQP{kYuYփKa+ * Td $JGl~MSVi0JB0Ae]}e1;w,$$* [V IPBy[]My ]2 {e:FWZJryx"X$+'X}&$vmaLP.Yyy+C А!˲gEfBRyA[ UB')"^zp4R*LD7,HZ]eֶlHdXIg)TbmkҵG4 C%T'MBbQsJm`) Gy GblF-{kZD膜[-plǴڼ[iI!4ն7YyFi]veV(6{jsѧ\Bs k#ʲ$Ȏ5D[Y1(wQ Dm&*i9124 = c v䶱$K`€+mcm9x֜ڀy%C9y+ Gp#Y*ԅb Mq 8iXISbW"kc/mxX=`k䉙5Nb'7@XMgpj9&[F{2LQKl`pQLˮ eպ-|"(տo=#G Ϯ Ӧ@ -2aShUۺ/ChfH4\ύLd)v!#/!y.I XqqH ;7hRJ#u]&-* F'=M,3-3&6/4!{+y)U* 9OAx"(yspGHoB]+ȄTE$B()Tp o"&")1b& V$EL̕Z?# FC: IENDB`icinga2-2.4.1/agent/windows-setup-agent/icinga.ico000066400000000000000000000013761262555626500220270ustar00rootroot00000000000000 ( @ppwpppppwwpwwxpwxxwppppwpicinga2-2.4.1/changelog.py000077500000000000000000000125031262555626500153550ustar00rootroot00000000000000#!/usr/bin/env python #/****************************************************************************** # * Icinga 2 * # * Copyright (C) 2012-2015 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. * # ******************************************************************************/ import urllib2, json, sys, string from argparse import ArgumentParser DESCRIPTION="update release changes" VERSION="1.0.0" ISSUE_URL= "https://dev.icinga.org/issues/" ISSUE_PROJECT="i2" arg_parser = ArgumentParser(description= "%s (Version: %s)" % (DESCRIPTION, VERSION)) arg_parser.add_argument('-V', '--version', required=True, type=str, help="define version to query") arg_parser.add_argument('-p', '--project', type=str, help="add urls to issues") arg_parser.add_argument('-l', '--links', action='store_true', help="add urls to issues") arg_parser.add_argument('-H', '--html', action='store_true', help="print html output (defaults to markdown)") args = arg_parser.parse_args(sys.argv[1:]) ftype = "md" if not args.html else "html" def format_header(text, lvl, ftype = ftype): if ftype == "html": return "%s" % (lvl, text, lvl) if ftype == "md": return "#" * lvl + " " + text def format_logentry(log_entry, args = args, issue_url = ISSUE_URL): if args.links: if args.html: return "
  • {0} {1}: {2}
  • ".format(log_entry[0], log_entry[1], log_entry[2], issue_url) else: return "* {0} [{1}]({3}{1} \"{0} {1}\"): {2}".format(log_entry[0], log_entry[1], log_entry[2], issue_url) else: if args.html: return "
  • %s %d: %s
  • " % log_entry else: return "* %s %d: %s" % log_entry def print_category(category, entries): if len(entries) > 0: print "" print format_header(category, 4) print "" if args.html: print "
      " for entry in sorted(entries): print format_logentry(entry) if args.html: print "
    " print "" version_name = args.version if args.project: ISSUE_PROJECT=args.project rsp = urllib2.urlopen("https://dev.icinga.org/projects/%s/versions.json" % (ISSUE_PROJECT)) versions_data = json.loads(rsp.read()) version_id = None for version in versions_data["versions"]: if version["name"] == version_name: version_id = version["id"] break if version_id == None: print "Version '%s' not found." % (version_name) sys.exit(1) changes = "" if "custom_fields" in version: for field in version["custom_fields"]: if field["id"] == 14: changes = field["value"] break changes = string.join(string.split(changes, "\r\n"), "\n") print format_header("What's New in Version %s" % (version_name), 3) print "" if changes: print format_header("Changes", 4) print "" print changes print "" offset = 0 features = [] bugfixes = [] support = [] while True: # We could filter using &cf_13=1, however this doesn't currently work because the custom field isn't set # for some of the older tickets: rsp = urllib2.urlopen("https://dev.icinga.org/projects/%s/issues.json?offset=%d&status_id=closed&fixed_version_id=%d" % (ISSUE_PROJECT, offset, version_id)) issues_data = json.loads(rsp.read()) issues_count = len(issues_data["issues"]) offset = offset + issues_count if issues_count == 0: break for issue in issues_data["issues"]: ignore_issue = False if "custom_fields" in issue: for field in issue["custom_fields"]: if field["id"] == 13 and "value" in field and field["value"] == "0": ignore_issue = True break if ignore_issue: continue entry = (issue["tracker"]["name"], issue["id"], issue["subject"].strip()) if issue["tracker"]["name"] == "Feature": features.append(entry) elif issue["tracker"]["name"] == "Bug": bugfixes.append(entry) elif issue["tracker"]["name"] == "Support": support.append(entry) print_category("Feature", features) print_category("Bugfixes", bugfixes) print_category("Support", support) sys.exit(0) icinga2-2.4.1/cmake/000077500000000000000000000000001262555626500141305ustar00rootroot00000000000000icinga2-2.4.1/cmake/FindYAJL.cmake000066400000000000000000000017571262555626500165040ustar00rootroot00000000000000# - Try to find libyajl # Once done this will define # YAJL_FOUND - System has YAJL # YAJL_INCLUDE_DIRS - The YAJL include directories # YAJL_LIBRARIES - The libraries needed to use YAJL # YAJL_DEFINITIONS - Compiler switches required for using YAJL find_package(PkgConfig) pkg_check_modules(PC_YAJL QUIET yajl) set(YAJL_DEFINITIONS ${PC_YAJL_CFLAGS_OTHER}) find_path(YAJL_INCLUDE_DIR yajl/yajl_version.h HINTS ${PC_YAJL_INCLUDEDIR} ${PC_YAJL_INCLUDE_DIRS} PATH_SUFFIXES libyajl) find_library(YAJL_LIBRARY NAMES yajl libyajl HINTS ${PC_YAJL_LIBDIR} ${PC_YAJL_LIBRARY_DIRS}) set(YAJL_LIBRARIES ${YAJL_LIBRARY} ) set(YAJL_INCLUDE_DIRS ${YAJL_INCLUDE_DIR}) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set YAJL_FOUND to TRUE # if all listed variables are TRUE find_package_handle_standard_args(yajl DEFAULT_MSG YAJL_LIBRARY YAJL_INCLUDE_DIR) mark_as_advanced(YAJL_INCLUDE_DIR YAJL_LIBRARY) icinga2-2.4.1/cmake/InstallConfig.cmake000066400000000000000000000042251262555626500176710ustar00rootroot00000000000000# Icinga 2 # Copyright (C) 2012-2015 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. function(install_if_not_exists src dest) set(real_dest "${dest}") if(NOT IS_ABSOLUTE "${src}") set(src "${CMAKE_CURRENT_SOURCE_DIR}/${src}") endif() get_filename_component(src_name "${src}" NAME) if (NOT IS_ABSOLUTE "${dest}") set(dest "${CMAKE_INSTALL_PREFIX}/${dest}") endif() get_filename_component(basename_dest "${src}" NAME) string(REPLACE "/" "\\\\" nsis_src "${src}") string(REPLACE "/" "\\\\" nsis_dest_dir "${real_dest}") string(REPLACE "/" "\\\\" nsis_dest "${real_dest}/${basename_dest}") set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} SetOverwrite off CreateDirectory '$INSTDIR\\\\${nsis_dest_dir}' File '/oname=${nsis_dest}' '${nsis_src}' SetOverwrite on " PARENT_SCOPE) install(CODE " if(NOT EXISTS \"\$ENV{DESTDIR}${dest}/${src_name}\") #file(INSTALL \"${src}\" DESTINATION \"${dest}\") message(STATUS \"Installing: \$ENV{DESTDIR}${dest}/${src_name}\") execute_process(COMMAND \${CMAKE_COMMAND} -E copy \"${src}\" \"\$ENV{DESTDIR}${dest}/${src_name}\" RESULT_VARIABLE copy_result ERROR_VARIABLE error_output) if(copy_result) message(FATAL_ERROR \${error_output}) endif() else() message(STATUS \"Skipping : \$ENV{DESTDIR}${dest}/${src_name}\") endif() ") endfunction(install_if_not_exists) icinga2-2.4.1/config.h.cmake000066400000000000000000000014151262555626500155460ustar00rootroot00000000000000#ifndef CONFIG_H #define CONFIG_H #cmakedefine HAVE_COUNTER_MACRO #cmakedefine HAVE_BACKTRACE_SYMBOLS #cmakedefine HAVE_PIPE2 #cmakedefine HAVE_VFORK #cmakedefine HAVE_DLADDR #cmakedefine HAVE_LIBEXECINFO #cmakedefine HAVE_CXXABI_H #cmakedefine HAVE_NICE #cmakedefine HAVE_EDITLINE #cmakedefine ICINGA2_UNITY_BUILD #define ICINGA_PREFIX "${CMAKE_INSTALL_PREFIX}" #define ICINGA_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}" #define ICINGA_RUNDIR "${ICINGA2_RUNDIR}" #define ICINGA_LOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}" #define ICINGA_PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/icinga2" #define ICINGA_INCLUDECONFDIR "${CMAKE_INSTALL_FULL_DATADIR}/icinga2/include" #define ICINGA_USER "${ICINGA2_USER}" #define ICINGA_GROUP "${ICINGA2_GROUP}" #endif /* CONFIG_H */ icinga2-2.4.1/contrib/000077500000000000000000000000001262555626500145105ustar00rootroot00000000000000icinga2-2.4.1/contrib/GPLHeader000066400000000000000000000026421262555626500161720ustar00rootroot00000000000000/****************************************************************************** * Icinga 2 * * Copyright (C) 2012-2015 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. * ******************************************************************************/ icinga2-2.4.1/contrib/README000066400000000000000000000003461262555626500153730ustar00rootroot00000000000000Icinga 2 Contrib files ====================== This directory contains various unsupported scripts. Chances are that they're either completely broken or at least need some changes to work with the most recent version of Icinga 2. icinga2-2.4.1/contrib/discover-api.py000077500000000000000000000113571262555626500174610ustar00rootroot00000000000000#!/usr/bin/env python #/****************************************************************************** # * Icinga 2 * # * Copyright (C) 2012-2015 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. * # ******************************************************************************/ import sys import subprocess import socket import urlparse import requests import json from xml.dom.minidom import parse api_url = "https://localhost:5665/" api_user = "root" api_password = "root" if len(sys.argv) < 2: print "Syntax: %s [ ...]" % (sys.argv[0]) sys.exit(1) tcp_service_commands = { 'ssh': 'ssh', 'http': 'http', 'smtp': 'smtp', 'ssmtp': 'ssmtp' } udp_service_commands = { 'ntp': 'ntp_time', 'snmp': 'snmp-uptime' } hosts = {} def process_host(host_element): global hosts status = "down" for status_element in host_element.getElementsByTagName("status"): status = status_element.getAttribute("state") if status != "up": return for address_element in host_element.getElementsByTagName("address"): if not address_element.getAttribute("addrtype") in [ "ipv4", "ipv6" ]: continue address = address_element.getAttribute("addr") break name = address for hostname_element in host_element.getElementsByTagName("hostname"): name = hostname_element.getAttribute("name") try: services = hosts[name]["services"] except: services = {} for port_element in host_element.getElementsByTagName("port"): state = "closed" for state_element in port_element.getElementsByTagName("state"): state = state_element.getAttribute("state") if state != "open": continue port = int(port_element.getAttribute("portid")) protocol = port_element.getAttribute("protocol") try: serv = socket.getservbyport(port, protocol) except: serv = str(port) try: if protocol == "tcp": command = tcp_service_commands[serv] elif protocol == "udp": command = udp_service_commands[serv] else: raise "Unknown protocol." except: command = protocol if command == "udp": continue services[serv] = { "command": command, "port": port } hosts[name] = { "name": name, "address": address, "services": services } def create_host(host): global api_url, api_user, api_password req = { "templates": [ "discovered-host" ], "attrs": { "address": host["address"] } } headers = {"Accept": "application/json"} url = urlparse.urljoin(api_url, "v1/objects/hosts/%s" % (host["name"])) requests.put(url, headers=headers, auth=(api_user, api_password), data=json.dumps(req), verify=False) for serv, service in host["services"].iteritems(): req = { "templates": [ "discovered-service" ], "attrs": { "vars.%s_port" % (service["command"]): service["port"], "check_command": service["command"], } } headers = {"Accept": "application/json"} url = urlparse.urljoin(api_url, "v1/objects/services/%s!%s" % (host["name"], serv)) requests.put(url, headers=headers, auth=(api_user, api_password), data=json.dumps(req), verify=False) for arg in sys.argv[1:]: # Expects XML output from 'nmap -oX' dom = parse(arg) for host in dom.getElementsByTagName("host"): process_host(host) for host in hosts.values(): create_host(host) icinga2-2.4.1/contrib/discover.py000077500000000000000000000104601262555626500167040ustar00rootroot00000000000000#!/usr/bin/env python #/****************************************************************************** # * Icinga 2 * # * Copyright (C) 2012-2015 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. * # ******************************************************************************/ import sys import subprocess import socket from xml.dom.minidom import parse if len(sys.argv) < 2: print "Syntax: %s [ ...]" % (sys.argv[0]) sys.exit(1) tcp_service_commands = { 'ssh': 'ssh', 'http': 'http_ip', 'https': 'https_ip', 'smtp': 'smtp', 'ssmtp': 'ssmtp' } udp_service_commands = { 'ntp': 'ntp_time', 'snmp': 'snmp-uptime' } hosts = {} def process_host(host_element): global hosts status = "down" for status_element in host_element.getElementsByTagName("status"): status = status_element.getAttribute("state") if status != "up": return for address_element in host_element.getElementsByTagName("address"): if not address_element.getAttribute("addrtype") in [ "ipv4", "ipv6" ]: continue address = address_element.getAttribute("addr") break name = address for hostname_element in host_element.getElementsByTagName("hostname"): name = hostname_element.getAttribute("name") try: services = hosts[name]["services"] except: services = {} for port_element in host_element.getElementsByTagName("port"): state = "closed" for state_element in port_element.getElementsByTagName("state"): state = state_element.getAttribute("state") if state != "open": continue port = int(port_element.getAttribute("portid")) protocol = port_element.getAttribute("protocol") try: serv = socket.getservbyport(port, protocol) except: serv = str(port) try: if protocol == "tcp": command = tcp_service_commands[serv] elif protocol == "udp": command = udp_service_commands[serv] else: raise "Unknown protocol." except: command = protocol if command == "udp": continue services[serv] = { "command": command, "port": port } hosts[name] = { "name": name, "address": address, "services": services } def print_host(host): print "object Host \"%s\" {" % (host["name"]) print "\timport \"discovered-host\"," print "" print "\taddress = \"%s\"," % (host["address"]) print "}" print "" for serv, service in host["services"].iteritems(): print "object Service \"%s\" {" % (serv) print "\timport \"discovered-service\"," print "" print "\thost_name = \"%s\"" % (host["name"]) print "\tcheck_command = \"%s\"," % (service["command"]) print "" print "\tvars.port = %s" % (service["port"]) print "}" print "" for arg in sys.argv[1:]: # Expects XML output from 'nmap -oX' dom = parse(arg) for host in dom.getElementsByTagName("host"): process_host(host) for host in hosts.values(): print_host(host) icinga2-2.4.1/contrib/i2eval/000077500000000000000000000000001262555626500156725ustar00rootroot00000000000000icinga2-2.4.1/contrib/i2eval/Makefile000066400000000000000000000004421262555626500173320ustar00rootroot00000000000000i2tcl.so: i2tcl.cpp i2tcl.hpp swig -c++ -o i2tcl_wrap.cpp i2tcl.hpp g++ -g -DI2_DEBUG -I/usr/include/tcl8.5 -shared -fpic -Iicinga2/lib -Iicinga2/build -Iicinga2/build/lib -L/opt/icinga2/lib/icinga2 -lbase -lconfig -Wl,-rpath=/opt/icinga2/lib/icinga2 -o i2tcl.so i2tcl_wrap.cpp i2tcl.cpp icinga2-2.4.1/contrib/i2eval/README000066400000000000000000000001261262555626500165510ustar00rootroot00000000000000This is the source code for the 'i2eval' IRC bot that's on #icinga and #icinga-devel. icinga2-2.4.1/contrib/i2eval/i2tcl.cpp000066400000000000000000000107601262555626500174170ustar00rootroot00000000000000#include "i2tcl.hpp" #include "config/configcompiler.hpp" #include "config/configcompilercontext.hpp" #include "base/function.hpp" #include "base/json.hpp" #include "base/application.hpp" #include using namespace icinga; static bool l_Init_Called; static Tcl_Interp *l_Interp; static Tcl_Encoding l_Encoding; static std::map l_Lines; static int l_NextLine = 1; static Value i2_call_tcl(const String& command, const String& mtype, const std::vector& args) { Tcl_Obj **objv = new Tcl_Obj *[args.size() + 1]; objv[0] = Tcl_NewStringObj(command.CStr(), -1); Tcl_IncrRefCount(objv[0]); for (size_t i = 0; i < args.size(); i++) { Tcl_DString dsText; String arg = static_cast(args[i]); Tcl_ExternalToUtfDString(l_Encoding, arg.CStr(), -1, &dsText); objv[i + 1] = Tcl_NewStringObj(Tcl_DStringValue(&dsText), Tcl_DStringLength(&dsText)); Tcl_DStringFree(&dsText); Tcl_IncrRefCount(objv[i + 1]); } int code = Tcl_EvalObjv(l_Interp, args.size() + 1, objv, TCL_EVAL_GLOBAL); Tcl_Obj *result = Tcl_GetObjResult(l_Interp); for (size_t i = 0; i < args.size() + 1; i++) Tcl_DecrRefCount(objv[i]); delete [] objv; if (code == TCL_ERROR) BOOST_THROW_EXCEPTION(std::runtime_error("An error occured in the TCL script")); Value vresult; if (mtype == "list") { Array::Ptr arr = new Array(); int len; if (Tcl_ListObjLength(l_Interp, result, &len) != TCL_OK) BOOST_THROW_EXCEPTION(std::invalid_argument("TCL proc returned something that is not a list")); for (size_t i = 0; i < len; i++) { Tcl_Obj *obj; Tcl_ListObjIndex(l_Interp, result, i, &obj); const char* strObj = Tcl_GetString(obj); Tcl_DString dsObj; arr->Add(Tcl_UtfToExternalDString(l_Encoding, strObj, -1, &dsObj)); Tcl_DStringFree(&dsObj); } vresult = arr; } else if (mtype == "null") { /* Nothing to do here */ } else if (mtype == "number") { const char* strResult = Tcl_GetString(result); vresult = Convert::ToDouble(strResult); } else if (mtype == "bool") { const char* strResult = Tcl_GetString(result); vresult = Convert::ToBool(Convert::ToLong(strResult)); } else { const char* strResult = Tcl_GetString(result); Tcl_DString dsResult; vresult = Tcl_UtfToExternalDString(l_Encoding, strResult, -1, &dsResult); Tcl_DStringFree(&dsResult); } return vresult; } void i2_register_command(const char *icmd, const char *tcmd, const char *mtype, Tcl_Interp *interp) { Function::Ptr sf = new Function(boost::bind(i2_call_tcl, String(tcmd), String(mtype), _1)); ScriptGlobal::Set(icmd, sf); } void *i2_new_frame(Tcl_Interp *interp) { if (!l_Init_Called) { l_Init_Called = true; l_Encoding = Tcl_GetEncoding(l_Interp, "ISO8859-1"); Application::InitializeBase(); } ScriptFrame *frame = new ScriptFrame(); frame->Self = ScriptGlobal::GetGlobals(); return frame; } void i2_free_frame(void *frame, Tcl_Interp *interp) { delete reinterpret_cast(frame); } char *i2_eval(void *uframe, const char *text, Tcl_Interp *interp) { std::ostringstream msgbuf; Expression *expr; ScriptFrame *frame = reinterpret_cast(uframe); l_Interp = interp; try { String lineNum = Convert::ToString(l_NextLine); l_NextLine++; String fileName = "<" + lineNum + ">"; l_Lines[fileName] = text; expr = ConfigCompiler::CompileText(fileName, text); if (expr) { Value result = expr->Evaluate(*frame); if (!result.IsObject() || result.IsObjectType() || result.IsObjectType()) msgbuf << JsonEncode(result); else msgbuf << result; } } catch (const ScriptError& ex) { DebugInfo di = ex.GetDebugInfo(); if (di.FirstLine != 0) { String text = l_Lines[di.Path]; std::vector lines; boost::algorithm::split(lines, text, boost::is_any_of("\n")); for (int i = di.FirstLine; i <= di.LastLine; i++) { int start, len; if (i == di.FirstLine) start = di.FirstColumn; else start = 0; if (i == di.LastLine) len = di.LastColumn - di.FirstColumn + 1; else len = lines[i].GetLength(); String pathInfo = di.Path; if (i != 1) pathInfo += "(" + Convert::ToString(i) + ")"; pathInfo += ": "; msgbuf << pathInfo << lines[i - 1] << "\n"; msgbuf << String(pathInfo.GetLength(), ' '); msgbuf << String(start, ' ') << String(len, '^') << "\n"; } } msgbuf << ex.what(); } catch (const std::exception& ex) { msgbuf << "Error: " << DiagnosticInformation(ex); } delete expr; std::string str = msgbuf.str(); return strdup(str.c_str()); } icinga2-2.4.1/contrib/i2eval/i2tcl.hpp000066400000000000000000000007271262555626500174260ustar00rootroot00000000000000#ifdef SWIG %module i2tcl %{ #include "i2tcl.hpp" %} %typemap(in,numinputs=0) Tcl_Interp *interp { $1 = interp; } #endif /* SWIG */ #include #ifndef I2TCL_H #define I2TCL_H void i2_register_command(const char *icmd, const char *tcmd, const char *mtype, Tcl_Interp *interp); void *i2_new_frame(Tcl_Interp *interp); void i2_free_frame(void *frame, Tcl_Interp *interp); char *i2_eval(void *frame, const char *text, Tcl_Interp *interp); #endif /* I2TCL_H */ icinga2-2.4.1/contrib/i2eval/i2tcl.tcl000066400000000000000000000047421262555626500174220ustar00rootroot00000000000000package require http package require tls http::register https 443 [list ::tls::socket -tls1 1] load /home/gunnar/i2tcl.so i2tcl bind pub - > i2tcl bind pub - >u i2tcl_url bind pub - ^ i2tcl bind pub - ^u i2tcl_url if {![info exists ::i2frame]} { set ::i2frame [i2_new_frame] } set ::i2chan "" set ::i2nick "" i2_register_command irc i2_irc null i2_register_command channels channels list i2_register_command chanlist internalchanlist list i2_register_command getnick getcurrentnick string i2_register_command onchan onchan bool i2_register_command topic topic string i2_register_command topicnick topicnick string i2_register_command topicstamp topicstamp number i2_register_command chanmodes getchanmode string i2_register_command isop isop bool i2_register_command isvoice isvoice bool i2_register_command ishop ishop bool i2_register_command chanhost getchanhost string i2_register_command chanbans chanbans list i2_register_command getnick i2_getnick string i2_register_command getchan i2_getchan string i2_register_command __commit i2_null null i2_register_command commit_objects i2_null null i2_register_command exit i2_null null proc i2_null {} { } proc i2_getnick {} { global i2nick return $i2nick } proc i2_getchan {} { global i2chan return $i2chan } proc i2_irc {message} { global i2chan if {[string first "\n" $message] != -1 || [string first "\r" $message] != -1} { return } putserv "PRIVMSG $i2chan :$message" } proc i2tcl {nick host hand chan arg} { global i2frame i2chan i2nick set i2chan $chan set i2nick $nick set result [i2_eval $i2frame $arg] if {$result == ""} { set result "" } foreach sline [split $result \n] { putserv "PRIVMSG $chan :( $arg ) = $sline" } } proc i2tcl_url {nick host hand chan arg} { global i2frame i2chan i2nick set i2chan $chan set i2nick $nick if {[catch {set token [http::geturl $arg]} msg]} { putserv "PRIVMSG $chan :HTTP request failed: $msg" http::cleanup $token return } if {[http::status $token] != "ok"} { putserv "PRIVMSG $chan :HTTP request failed: [http::error $token]" http::cleanup $token return } set rpl [split [http::code $token] " "] if {[lindex $rpl 1] != 200} { putserv "PRIVMSG $chan :HTTP request failed: [join [lrange $rpl 1 end]]" http::cleanup $token return } set code [http::data $token] http::cleanup $token set result [i2_eval $i2frame $code] if {$result == ""} { set result "" } foreach sline [split $result \n] { putserv "PRIVMSG $chan :( $arg ) = $sline" } } icinga2-2.4.1/contrib/icinga2clr.cs000066400000000000000000000034101262555626500170520ustar00rootroot00000000000000/****************************************************************************** * Icinga 2 * * Copyright (C) 2012-2015 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. * ******************************************************************************/ using System; using System.Collections; namespace Icinga { public enum ServiceState { ServiceOK, ServiceWarning, ServiceCritical, ServiceUnknown } public class CheckResult { public ServiceState State; public String Output; public String PerformanceData; } public interface ICheckPlugin { CheckResult Check(Hashtable args); } } icinga2-2.4.1/contrib/make-agent-config.py000077500000000000000000000047721262555626500203530ustar00rootroot00000000000000#!/usr/bin/env python # Icinga 2 # Copyright (C) 2012-2015 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. import subprocess, json inventory_json = subprocess.check_output(["icinga2", "agent", "list", "--batch"]) inventory = json.loads(inventory_json) for agent, agent_info in inventory.items(): print "object Endpoint \"%s\" {" % (agent) print " host = \"%s\"" % (agent) print "}" print "" print "object Zone \"%s\" {" % (agent_info["zone"]) if "parent_zone" in agent_info: print " parent = \"%s\"" % (agent_info["parent_zone"]) print " endpoints = [ \"%s\" ]" % (agent) print "}" print "" print "object Host \"%s\" {" % (agent_info["zone"]) print " check_command = \"cluster-zone\"" print "}" print "" print "apply Dependency \"host-zone-%s\" to Host {" % (agent_info["zone"]) print " parent_host_name = \"%s\"" % (agent_info["zone"]) print " assign where host.zone == \"%s\"" % (agent_info["zone"]) print "}" print "" print "apply Dependency \"service-zone-%s\" to Service {" % (agent_info["zone"]) print " parent_host_name = \"%s\"" % (agent_info["zone"]) print " assign where service.zone == \"%s\"" % (agent_info["zone"]) print "}" print "" for host, services in agent_info["repository"].items(): if host != agent_info["zone"]: print "object Host \"%s\" {" % (host) print " check_command = \"dummy\"" print " zone = \"%s\"" % (agent_info["zone"]) print "}" print "" for service in services: print "object Service \"%s\" {" % (service) print " check_command = \"dummy\"" print " host_name = \"%s\"" % (host) print " zone = \"%s\"" % (agent_info["zone"]) print "}" print "" icinga2-2.4.1/doc/000077500000000000000000000000001262555626500136155ustar00rootroot00000000000000icinga2-2.4.1/doc/.gitignore000066400000000000000000000000141262555626500156000ustar00rootroot00000000000000build *.rst icinga2-2.4.1/doc/1-about.md000066400000000000000000001033151262555626500154120ustar00rootroot00000000000000# About Icinga 2 ## What is Icinga 2? Icinga 2 is an open source monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting. Scalable and extensible, Icinga 2 can monitor large, complex environments across multiple locations. ## Licensing Icinga 2 and the Icinga 2 documentation are licensed under the terms of the GNU General Public License Version 2, you will find a copy of this license in the LICENSE file included in the source package. ## Support Support for Icinga 2 is available in a number of ways. Please have a look at the [support overview page](https://support.icinga.org). ## Contribute There are many ways to contribute to Icinga - whether it be sending patches, testing, reporting bugs, or reviewing and updating the documentation. Every contribution is appreciated! Please get in touch with the Icinga team at https://www.icinga.org/community/. If you want to help update this documentation please read [this howto](https://wiki.icinga.org/display/community/Update+the+Icinga+2+documentation). ### Icinga 2 Development You can follow Icinga 2's development closely by checking out these resources: * [Development Bug Tracker](https://dev.icinga.org/projects/i2): [How to report a bug?](https://www.icinga.org/icinga/faq/) * Git Repositories: [main mirror on icinga.org](https://git.icinga.org/?p=icinga2.git;a=summary) [release mirror at github.com](https://github.com/Icinga/icinga2) * [Git Checkins Mailinglist](https://lists.icinga.org/mailman/listinfo/icinga-checkins) * [Development](https://lists.icinga.org/mailman/listinfo/icinga-devel) and [Users](https://lists.icinga.org/mailman/listinfo/icinga-users) Mailinglists * [#icinga-devel on irc.freenode.net](http://webchat.freenode.net/?channels=icinga-devel) including a Git Commit Bot For general support questions, please refer to the [community support channels](https://support.icinga.org). ### How to Report a Bug or Feature Request More details in the [Icinga FAQ](https://www.icinga.org/icinga/faq/). * [Register](https://accounts.icinga.org/register) an Icinga account. * Create a new issue at the [Icinga 2 Development Tracker](https://dev.icinga.org/projects/i2). * When reporting a bug, please include the details described in the [Troubleshooting](16-troubleshooting.md#troubleshooting-information-required) chapter (version, configs, logs, etc). ## What's New ### What's New in Version 2.4.1 #### Changes * ITL * Add running_kernel_use_sudo option for the running_kernel check * Configuration * Add global constants: `PlatformName`. `PlatformVersion`, `PlatformKernel` and `PlatformKernelVersion` * CLI * Use NodeName and ZoneName constants for 'node setup' and 'node wizard' #### Feature * Feature [10622](https://dev.icinga.org/issues/10622 "Feature 10622"): Add by_ssh_options argument for the check_by_ssh plugin * Feature [10693](https://dev.icinga.org/issues/10693 "Feature 10693"): Add running_kernel_use_sudo option for the running_kernel check * Feature [10716](https://dev.icinga.org/issues/10716 "Feature 10716"): Use NodeName and ZoneName constants for 'node setup' and 'node wizard' #### Bugfixes * Bug [10528](https://dev.icinga.org/issues/10528 "Bug 10528"): Documentation example in "Access Object Attributes at Runtime" doesn't work correctly * Bug [10615](https://dev.icinga.org/issues/10615 "Bug 10615"): Build fails on SLES 11 SP3 with GCC 4.8 * Bug [10632](https://dev.icinga.org/issues/10632 "Bug 10632"): "node wizard" does not ask user to verify SSL certificate * Bug [10641](https://dev.icinga.org/issues/10641 "Bug 10641"): API setup command incorrectly overwrites existing certificates * Bug [10643](https://dev.icinga.org/issues/10643 "Bug 10643"): Icinga 2 crashes when ScheduledDowntime objects are used * Bug [10645](https://dev.icinga.org/issues/10645 "Bug 10645"): Documentation for schedule-downtime is missing required paremeters * Bug [10648](https://dev.icinga.org/issues/10648 "Bug 10648"): lib/base/process.cpp SIGSEGV on Debian squeeze / RHEL 6 * Bug [10661](https://dev.icinga.org/issues/10661 "Bug 10661"): Incorrect web inject URL in documentation * Bug [10663](https://dev.icinga.org/issues/10663 "Bug 10663"): Incorrect redirect for stderr in /usr/lib/icinga2/prepare-dirs * Bug [10667](https://dev.icinga.org/issues/10667 "Bug 10667"): Indentation in command-plugins.conf * Bug [10677](https://dev.icinga.org/issues/10677 "Bug 10677"): node wizard checks for /var/lib/icinga2/ca directory but not the files * Bug [10690](https://dev.icinga.org/issues/10690 "Bug 10690"): CLI command 'repository add' doesn't work * Bug [10692](https://dev.icinga.org/issues/10692 "Bug 10692"): Fix typos in the documentation * Bug [10708](https://dev.icinga.org/issues/10708 "Bug 10708"): Windows setup wizard crashes when InstallDir registry key is not set * Bug [10710](https://dev.icinga.org/issues/10710 "Bug 10710"): Incorrect path for icinga2 binary in development documentation * Bug [10720](https://dev.icinga.org/issues/10720 "Bug 10720"): Remove --master_zone from --help because it is currently not implemented ### What's New in Version 2.4.0 #### Changes * API * RESTful API with basic auth or client certificates * Filters, types, permissions * configuration package management * query/create/modify/delete config objects at runtime * status queries for global stats * actions (e.g. acknowledge all service problems) * event streams * ITL and Plugin Check Command definitions * The 'running_kernel' check command was moved to the plugins-contrib section. You have to update your config to include 'plugins-contrib' * Configuration * The global constants Enable* and Vars have been removed. Use the IcingaApplication object attributes instead. * Features * New Graphite tree. Please check the documentation how enable the legacy schema. * IcingaStatusWriter feature has been deprecated and will be removed in future versions. * Modified attributes are not exposed as bit mask to external interfaces anymore (api related changes). External commands like CHANGE_*_MODATTR have been removed. #### Feature * Feature [7709](https://dev.icinga.org/issues/7709 "Feature 7709"): Validators should be implemented in (auto-generated) native code * Feature [8093](https://dev.icinga.org/issues/8093 "Feature 8093"): Add icinga, cluster, cluster-zone check information to the ApiListener status handler * Feature [8149](https://dev.icinga.org/issues/8149 "Feature 8149"): graphite writer should pass "-" in host names and "." in perf data * Feature [8666](https://dev.icinga.org/issues/8666 "Feature 8666"): Allow some of the Array and Dictionary methods to be inlined by the compiler * Feature [8688](https://dev.icinga.org/issues/8688 "Feature 8688"): Add embedded DB IDO version health check * Feature [8689](https://dev.icinga.org/issues/8689 "Feature 8689"): Add support for current and current-1 db ido schema version * Feature [8690](https://dev.icinga.org/issues/8690 "Feature 8690"): 'icinga2 console' should serialize temporary attributes (rather than just config + state) * Feature [8738](https://dev.icinga.org/issues/8738 "Feature 8738"): Implement support for CLIENT_MULTI_STATEMENTS * Feature [8741](https://dev.icinga.org/issues/8741 "Feature 8741"): Deprecate IcingaStatusWriter feature * Feature [8775](https://dev.icinga.org/issues/8775 "Feature 8775"): Move the base command templates into libmethods * Feature [8776](https://dev.icinga.org/issues/8776 "Feature 8776"): Implement support for libedit * Feature [8791](https://dev.icinga.org/issues/8791 "Feature 8791"): Refactor the startup process * Feature [8832](https://dev.icinga.org/issues/8832 "Feature 8832"): Implement constructor-style casts * Feature [8842](https://dev.icinga.org/issues/8842 "Feature 8842"): Add support for the C++11 keyword 'override' * Feature [8867](https://dev.icinga.org/issues/8867 "Feature 8867"): Use DebugHint information when reporting validation errors * Feature [8890](https://dev.icinga.org/issues/8890 "Feature 8890"): Move implementation code from thpp files into separate files * Feature [8922](https://dev.icinga.org/issues/8922 "Feature 8922"): Avoid unnecessary dictionary lookups * Feature [9044](https://dev.icinga.org/issues/9044 "Feature 9044"): Remove the ScopeCurrent constant * Feature [9068](https://dev.icinga.org/issues/9068 "Feature 9068"): Implement sandbox mode for the config parser * Feature [9074](https://dev.icinga.org/issues/9074 "Feature 9074"): Basic API framework * Feature [9076](https://dev.icinga.org/issues/9076 "Feature 9076"): Reflection support for the API * Feature [9077](https://dev.icinga.org/issues/9077 "Feature 9077"): Implement filters for the API * Feature [9078](https://dev.icinga.org/issues/9078 "Feature 9078"): Event stream support for the API * Feature [9079](https://dev.icinga.org/issues/9079 "Feature 9079"): Implement status queries for the API * Feature [9080](https://dev.icinga.org/issues/9080 "Feature 9080"): Add commands (actions) for the API * Feature [9081](https://dev.icinga.org/issues/9081 "Feature 9081"): Add modified attribute support for the API * Feature [9082](https://dev.icinga.org/issues/9082 "Feature 9082"): Runtime configuration for the API * Feature [9083](https://dev.icinga.org/issues/9083 "Feature 9083"): Configuration file management for the API * Feature [9084](https://dev.icinga.org/issues/9084 "Feature 9084"): Enable the ApiListener by default * Feature [9085](https://dev.icinga.org/issues/9085 "Feature 9085"): Certificate-based authentication for the API * Feature [9086](https://dev.icinga.org/issues/9086 "Feature 9086"): Password-based authentication for the API * Feature [9087](https://dev.icinga.org/issues/9087 "Feature 9087"): Create default administrative user * Feature [9088](https://dev.icinga.org/issues/9088 "Feature 9088"): API permissions * Feature [9091](https://dev.icinga.org/issues/9091 "Feature 9091"): API status queries * Feature [9093](https://dev.icinga.org/issues/9093 "Feature 9093"): Changelog for modified attributes * Feature [9095](https://dev.icinga.org/issues/9095 "Feature 9095"): Disallow changes for certain config attributes at runtime * Feature [9096](https://dev.icinga.org/issues/9096 "Feature 9096"): Dependency tracking for objects * Feature [9098](https://dev.icinga.org/issues/9098 "Feature 9098"): Update modules to support adding and removing objects at runtime * Feature [9099](https://dev.icinga.org/issues/9099 "Feature 9099"): Implement support for writing configuration files * Feature [9100](https://dev.icinga.org/issues/9100 "Feature 9100"): Multiple sources for zone configuration tree * Feature [9101](https://dev.icinga.org/issues/9101 "Feature 9101"): Commands for adding and removing objects * Feature [9102](https://dev.icinga.org/issues/9102 "Feature 9102"): Support validating configuration changes * Feature [9103](https://dev.icinga.org/issues/9103 "Feature 9103"): Staging for configuration validation * Feature [9104](https://dev.icinga.org/issues/9104 "Feature 9104"): Implement config file management commands * Feature [9105](https://dev.icinga.org/issues/9105 "Feature 9105"): API Documentation * Feature [9175](https://dev.icinga.org/issues/9175 "Feature 9175"): Move 'running_kernel' check command to plugins-contrib 'operating system' section * Feature [9286](https://dev.icinga.org/issues/9286 "Feature 9286"): DB IDO/Livestatus: Add zone object table w/ endpoint members * Feature [9414](https://dev.icinga.org/issues/9414 "Feature 9414"): "-Wno-deprecated-register" compiler option breaks builds on SLES 11 * Feature [9447](https://dev.icinga.org/issues/9447 "Feature 9447"): Implement support for HTTP * Feature [9448](https://dev.icinga.org/issues/9448 "Feature 9448"): Define RESTful url schema * Feature [9461](https://dev.icinga.org/issues/9461 "Feature 9461"): New Graphite schema * Feature [9470](https://dev.icinga.org/issues/9470 "Feature 9470"): Implement URL parser * Feature [9471](https://dev.icinga.org/issues/9471 "Feature 9471"): Implement ApiUser type * Feature [9594](https://dev.icinga.org/issues/9594 "Feature 9594"): Implement base64 de- and encoder * Feature [9614](https://dev.icinga.org/issues/9614 "Feature 9614"): Register ServiceOK, ServiceWarning, HostUp, etc. as constants * Feature [9647](https://dev.icinga.org/issues/9647 "Feature 9647"): Move url to /lib/remote from /lib/base * Feature [9689](https://dev.icinga.org/issues/9689 "Feature 9689"): Add exceptions for Utility::MkDir{,P} * Feature [9693](https://dev.icinga.org/issues/9693 "Feature 9693"): Add Array::FromVector() method * Feature [9698](https://dev.icinga.org/issues/9698 "Feature 9698"): Implement support for X-HTTP-Method-Override * Feature [9704](https://dev.icinga.org/issues/9704 "Feature 9704"): String::Trim() should return a new string rather than modifying the current string * Feature [9705](https://dev.icinga.org/issues/9705 "Feature 9705"): Add real path sanity checks to provided file paths * Feature [9723](https://dev.icinga.org/issues/9723 "Feature 9723"): Documentation for config management API * Feature [9768](https://dev.icinga.org/issues/9768 "Feature 9768"): Update the url parsers behaviour * Feature [9777](https://dev.icinga.org/issues/9777 "Feature 9777"): Make Comments and Downtime types available as ConfigObject type in the API * Feature [9794](https://dev.icinga.org/issues/9794 "Feature 9794"): Setting global variables with i2tcl doesn't work * Feature [9849](https://dev.icinga.org/issues/9849 "Feature 9849"): Validation for modified attributes * Feature [9850](https://dev.icinga.org/issues/9850 "Feature 9850"): Re-implement events for attribute changes * Feature [9851](https://dev.icinga.org/issues/9851 "Feature 9851"): Remove GetModifiedAttributes/SetModifiedAttributes * Feature [9852](https://dev.icinga.org/issues/9852 "Feature 9852"): Implement support for . in modify_attribute * Feature [9859](https://dev.icinga.org/issues/9859 "Feature 9859"): Implement global modified attributes * Feature [9866](https://dev.icinga.org/issues/9866 "Feature 9866"): Implement support for attaching GDB to the Icinga process on crash * Feature [9914](https://dev.icinga.org/issues/9914 "Feature 9914"): Rename DynamicObject/DynamicType to ConfigObject/ConfigType * Feature [9919](https://dev.icinga.org/issues/9919 "Feature 9919"): Allow comments when parsing JSON * Feature [9921](https://dev.icinga.org/issues/9921 "Feature 9921"): Implement the 'base' field for the Type class * Feature [9926](https://dev.icinga.org/issues/9926 "Feature 9926"): Ensure that runtime config objects are persisted on disk * Feature [9927](https://dev.icinga.org/issues/9927 "Feature 9927"): Figure out how to sync dynamically created objects inside the cluster * Feature [9929](https://dev.icinga.org/issues/9929 "Feature 9929"): Add override keyword for all relevant methods * Feature [9930](https://dev.icinga.org/issues/9930 "Feature 9930"): Document Object#clone * Feature [9931](https://dev.icinga.org/issues/9931 "Feature 9931"): Implement Object#clone and rename Array/Dictionary#clone to shallow_clone * Feature [9933](https://dev.icinga.org/issues/9933 "Feature 9933"): Implement support for indexers in ConfigObject::RestoreAttribute * Feature [9935](https://dev.icinga.org/issues/9935 "Feature 9935"): Implement support for restoring modified attributes * Feature [9937](https://dev.icinga.org/issues/9937 "Feature 9937"): Add package attribute for ConfigObject and set its origin * Feature [9940](https://dev.icinga.org/issues/9940 "Feature 9940"): Implement support for filter_vars * Feature [9944](https://dev.icinga.org/issues/9944 "Feature 9944"): Add String::ToLower/ToUpper * Feature [9946](https://dev.icinga.org/issues/9946 "Feature 9946"): Remove debug messages in HttpRequest class * Feature [9953](https://dev.icinga.org/issues/9953 "Feature 9953"): Rename config/modules to config/packages * Feature [9960](https://dev.icinga.org/issues/9960 "Feature 9960"): Implement ignore_on_error keyword * Feature [10017](https://dev.icinga.org/issues/10017 "Feature 10017"): Use an AST node for the 'library' keyword * Feature [10038](https://dev.icinga.org/issues/10038 "Feature 10038"): Add plural_name field to /v1/types * Feature [10039](https://dev.icinga.org/issues/10039 "Feature 10039"): URL class improvements * Feature [10042](https://dev.icinga.org/issues/10042 "Feature 10042"): Implement a demo API client: Icinga Studio * Feature [10060](https://dev.icinga.org/issues/10060 "Feature 10060"): Implement joins for status queries * Feature [10116](https://dev.icinga.org/issues/10116 "Feature 10116"): Add global status handler for the API * Feature [10186](https://dev.icinga.org/issues/10186 "Feature 10186"): Make ConfigObject::{G,S}etField() method public * Feature [10194](https://dev.icinga.org/issues/10194 "Feature 10194"): Sanitize error status codes and messages * Feature [10202](https://dev.icinga.org/issues/10202 "Feature 10202"): Add documentation for api-users.conf and app.conf * Feature [10209](https://dev.icinga.org/issues/10209 "Feature 10209"): Rename statusqueryhandler to objectqueryhandler * Feature [10212](https://dev.icinga.org/issues/10212 "Feature 10212"): Move /v1/ to /v1/objects/ * Feature [10243](https://dev.icinga.org/issues/10243 "Feature 10243"): Provide keywords to retrieve the current file name at parse time * Feature [10257](https://dev.icinga.org/issues/10257 "Feature 10257"): Change object version to timestamps for diff updates on config sync * Feature [10329](https://dev.icinga.org/issues/10329 "Feature 10329"): Pretty-print arrays and dictionaries when converting them to strings * Feature [10368](https://dev.icinga.org/issues/10368 "Feature 10368"): Document that modified attributes require accept_config for cluster/clients * Feature [10374](https://dev.icinga.org/issues/10374 "Feature 10374"): Add check command nginx_status * Feature [10383](https://dev.icinga.org/issues/10383 "Feature 10383"): DB IDO should provide its connected state via /v1/status * Feature [10385](https://dev.icinga.org/issues/10385 "Feature 10385"): Add 'support' tracker to changelog.py * Feature [10387](https://dev.icinga.org/issues/10387 "Feature 10387"): Use the API for "icinga2 console" * Feature [10388](https://dev.icinga.org/issues/10388 "Feature 10388"): Log a warning message on unauthorized http request * Feature [10392](https://dev.icinga.org/issues/10392 "Feature 10392"): Original attributes list in IDO * Feature [10393](https://dev.icinga.org/issues/10393 "Feature 10393"): Hide internal attributes * Feature [10394](https://dev.icinga.org/issues/10394 "Feature 10394"): Add getter for endpoint 'connected' attribute * Feature [10407](https://dev.icinga.org/issues/10407 "Feature 10407"): Remove api.cpp, api.hpp * Feature [10409](https://dev.icinga.org/issues/10409 "Feature 10409"): Add documentation for apply+for in the language reference chapter * Feature [10423](https://dev.icinga.org/issues/10423 "Feature 10423"): Ability to set port on SNMP Checks * Feature [10431](https://dev.icinga.org/issues/10431 "Feature 10431"): Add the name for comments/downtimes next to legacy_id to DB IDO * Feature [10441](https://dev.icinga.org/issues/10441 "Feature 10441"): Rewrite man page * Feature [10479](https://dev.icinga.org/issues/10479 "Feature 10479"): Use ZoneName variable for parent_zone in node update-config * Feature [10482](https://dev.icinga.org/issues/10482 "Feature 10482"): Documentation: Reorganize Livestatus and alternative frontends * Feature [10503](https://dev.icinga.org/issues/10503 "Feature 10503"): Missing parameters for check jmx4perl * Feature [10507](https://dev.icinga.org/issues/10507 "Feature 10507"): Add check command negate * Feature [10509](https://dev.icinga.org/issues/10509 "Feature 10509"): Change GetLastStateUp/Down to host attributes * Feature [10511](https://dev.icinga.org/issues/10511 "Feature 10511"): Add check command mysql * Feature [10513](https://dev.icinga.org/issues/10513 "Feature 10513"): Add ipv4/ipv6 only to tcp and http CheckCommand * Feature [10522](https://dev.icinga.org/issues/10522 "Feature 10522"): Change output format for 'icinga2 console' * Feature [10547](https://dev.icinga.org/issues/10547 "Feature 10547"): Icinga 2 script debugger * Feature [10548](https://dev.icinga.org/issues/10548 "Feature 10548"): Implement CSRF protection for the API * Feature [10549](https://dev.icinga.org/issues/10549 "Feature 10549"): Change 'api setup' into a manual step while configuring the API * Feature [10551](https://dev.icinga.org/issues/10551 "Feature 10551"): Change object query result set * Feature [10566](https://dev.icinga.org/issues/10566 "Feature 10566"): Enhance programmatic examples for the API docs * Feature [10574](https://dev.icinga.org/issues/10574 "Feature 10574"): Mention wxWidget (optional) requirement in INSTALL.md * Feature [10575](https://dev.icinga.org/issues/10575 "Feature 10575"): Documentation for /v1/console * Feature [10576](https://dev.icinga.org/issues/10576 "Feature 10576"): Explain variable names for joined objects in filter expressions * Feature [10577](https://dev.icinga.org/issues/10577 "Feature 10577"): Documentation for the script debugger * Feature [10591](https://dev.icinga.org/issues/10591 "Feature 10591"): Explain DELETE for config stages/packages * Feature [10630](https://dev.icinga.org/issues/10630 "Feature 10630"): Update wxWidgets documentation for Icinga Studio #### Bugfixes * Bug [8822](https://dev.icinga.org/issues/8822 "Bug 8822"): Update OpenSSL for the Windows builds * Bug [8823](https://dev.icinga.org/issues/8823 "Bug 8823"): Don't allow users to instantiate the StreamLogger class * Bug [8830](https://dev.icinga.org/issues/8830 "Bug 8830"): Make default notifications include users from host.vars.notification.mail.users * Bug [8865](https://dev.icinga.org/issues/8865 "Bug 8865"): Failed assertion in IdoMysqlConnection::FieldToEscapedString * Bug [8907](https://dev.icinga.org/issues/8907 "Bug 8907"): Validation fails even though field is not required * Bug [8924](https://dev.icinga.org/issues/8924 "Bug 8924"): Specify pidfile for status_of_proc in the init script * Bug [8952](https://dev.icinga.org/issues/8952 "Bug 8952"): Crash in VMOps::FunctionCall * Bug [8989](https://dev.icinga.org/issues/8989 "Bug 8989"): pgsql driver does not have latest mysql changes synced * Bug [9015](https://dev.icinga.org/issues/9015 "Bug 9015"): Compiler warnings with latest HEAD 5ac5f98 * Bug [9027](https://dev.icinga.org/issues/9027 "Bug 9027"): PostgreSQL schema sets default timestamps w/o time zone * Bug [9053](https://dev.icinga.org/issues/9053 "Bug 9053"): icinga demo module can not be built * Bug [9188](https://dev.icinga.org/issues/9188 "Bug 9188"): Remove incorrect 'ignore where' expression from 'ssh' apply example * Bug [9455](https://dev.icinga.org/issues/9455 "Bug 9455"): Fix incorrect datatype for the check_source column in icinga_statehistory table * Bug [9547](https://dev.icinga.org/issues/9547 "Bug 9547"): Wrong vars changed handler in api events * Bug [9576](https://dev.icinga.org/issues/9576 "Bug 9576"): Overflow in freshness_threshold column (smallint) w/ DB IDO MySQL * Bug [9590](https://dev.icinga.org/issues/9590 "Bug 9590"): 'node wizard/setup' should always generate new CN certificates * Bug [9703](https://dev.icinga.org/issues/9703 "Bug 9703"): Problem with child nodes in http url registry * Bug [9735](https://dev.icinga.org/issues/9735 "Bug 9735"): Broken cluster config sync w/o include_zones * Bug [9778](https://dev.icinga.org/issues/9778 "Bug 9778"): Accessing field ID 0 ("prototype") fails * Bug [9793](https://dev.icinga.org/issues/9793 "Bug 9793"): Operator - should not work with "" and numbers * Bug [9795](https://dev.icinga.org/issues/9795 "Bug 9795"): ScriptFrame's 'Self' attribute gets corrupted when an expression throws an exception * Bug [9813](https://dev.icinga.org/issues/9813 "Bug 9813"): win32 build: S_ISDIR is undefined * Bug [9843](https://dev.icinga.org/issues/9843 "Bug 9843"): console autocompletion should take into account parent classes' prototypes * Bug [9868](https://dev.icinga.org/issues/9868 "Bug 9868"): Crash in ScriptFrame::~ScriptFrame * Bug [9872](https://dev.icinga.org/issues/9872 "Bug 9872"): Color codes in console prompt break line editing * Bug [9876](https://dev.icinga.org/issues/9876 "Bug 9876"): Crash during cluster log replay * Bug [9879](https://dev.icinga.org/issues/9879 "Bug 9879"): Missing conf.d or zones.d cause parse failure * Bug [9911](https://dev.icinga.org/issues/9911 "Bug 9911"): Do not let API users create objects with invalid names * Bug [9966](https://dev.icinga.org/issues/9966 "Bug 9966"): Fix formatting in mkclass * Bug [9968](https://dev.icinga.org/issues/9968 "Bug 9968"): Implement support for '.' when persisting modified attributes * Bug [9987](https://dev.icinga.org/issues/9987 "Bug 9987"): Crash in ConfigCompiler::RegisterZoneDir * Bug [10008](https://dev.icinga.org/issues/10008 "Bug 10008"): Don't parse config files for branches not taken * Bug [10012](https://dev.icinga.org/issues/10012 "Bug 10012"): Unused variable 'dobj' in configobject.tcpp * Bug [10024](https://dev.icinga.org/issues/10024 "Bug 10024"): HTTP keep-alive does not work with .NET WebClient * Bug [10027](https://dev.icinga.org/issues/10027 "Bug 10027"): Filtering by name doesn't work * Bug [10034](https://dev.icinga.org/issues/10034 "Bug 10034"): Unused variable console_type in consolecommand.cpp * Bug [10041](https://dev.icinga.org/issues/10041 "Bug 10041"): build failure: demo module * Bug [10048](https://dev.icinga.org/issues/10048 "Bug 10048"): Error handling in HttpClient/icinga-studio * Bug [10110](https://dev.icinga.org/issues/10110 "Bug 10110"): Add object_id where clause for icinga_downtimehistory * Bug [10180](https://dev.icinga.org/issues/10180 "Bug 10180"): API actions do not follow REST guidelines * Bug [10198](https://dev.icinga.org/issues/10198 "Bug 10198"): Detect infinite recursion in user scripts * Bug [10210](https://dev.icinga.org/issues/10210 "Bug 10210"): Move the Collection status handler to /v1/status * Bug [10211](https://dev.icinga.org/issues/10211 "Bug 10211"): PerfdataValue is not properly serialised in status queries * Bug [10224](https://dev.icinga.org/issues/10224 "Bug 10224"): URL parser is cutting off last character * Bug [10234](https://dev.icinga.org/issues/10234 "Bug 10234"): ASCII NULs don't work in string values * Bug [10238](https://dev.icinga.org/issues/10238 "Bug 10238"): Use a temporary file for modified-attributes.conf updates * Bug [10241](https://dev.icinga.org/issues/10241 "Bug 10241"): Properly encode URLs in Icinga Studio * Bug [10249](https://dev.icinga.org/issues/10249 "Bug 10249"): Config Sync shouldn't send updates for objects the client doesn't have access to * Bug [10253](https://dev.icinga.org/issues/10253 "Bug 10253"): /v1/objects/ returns an HTTP error when there are no objects of that type * Bug [10255](https://dev.icinga.org/issues/10255 "Bug 10255"): Config sync does not set endpoint syncing and plays disconnect-sync ping-pong * Bug [10256](https://dev.icinga.org/issues/10256 "Bug 10256"): ConfigWriter::EmitValue should format floating point values properly * Bug [10326](https://dev.icinga.org/issues/10326 "Bug 10326"): icinga2 repository host add does not work * Bug [10350](https://dev.icinga.org/issues/10350 "Bug 10350"): Remove duplicated text in section "Apply Notifications to Hosts and Services" * Bug [10355](https://dev.icinga.org/issues/10355 "Bug 10355"): Version updates are not working properly * Bug [10360](https://dev.icinga.org/issues/10360 "Bug 10360"): Icinga2 API performance regression * Bug [10371](https://dev.icinga.org/issues/10371 "Bug 10371"): Ensure that modified attributes work with clients with local config and no zone attribute * Bug [10386](https://dev.icinga.org/issues/10386 "Bug 10386"): restore_attribute does not work in clusters * Bug [10403](https://dev.icinga.org/issues/10403 "Bug 10403"): Escaping $ not documented * Bug [10406](https://dev.icinga.org/issues/10406 "Bug 10406"): Misleading wording in generated zones.conf * Bug [10410](https://dev.icinga.org/issues/10410 "Bug 10410"): OpenBSD: hang during ConfigItem::ActivateItems() in daemon startup * Bug [10417](https://dev.icinga.org/issues/10417 "Bug 10417"): 'which' isn't available in a minimal CentOS container * Bug [10422](https://dev.icinga.org/issues/10422 "Bug 10422"): Changing a group's attributes causes duplicate rows in the icinga_*group_members table * Bug [10433](https://dev.icinga.org/issues/10433 "Bug 10433"): 'dig_lookup' custom attribute for the 'dig' check command isn't optional * Bug [10436](https://dev.icinga.org/issues/10436 "Bug 10436"): Custom variables aren't removed from the IDO database * Bug [10439](https://dev.icinga.org/issues/10439 "Bug 10439"): "Command options" is empty when executing icinga2 without any argument. * Bug [10440](https://dev.icinga.org/issues/10440 "Bug 10440"): Improve --help output for the --log-level option * Bug [10455](https://dev.icinga.org/issues/10455 "Bug 10455"): Improve error handling during log replay * Bug [10456](https://dev.icinga.org/issues/10456 "Bug 10456"): Incorrect attribute name in the documentation * Bug [10457](https://dev.icinga.org/issues/10457 "Bug 10457"): Don't allow scripts to access FANoUserView attributes in sandbox mode * Bug [10461](https://dev.icinga.org/issues/10461 "Bug 10461"): Line continuation is broken in 'icinga2 console' * Bug [10466](https://dev.icinga.org/issues/10466 "Bug 10466"): Crash in IndexerExpression::GetReference when attempting to set an attribute on an object other than the current one * Bug [10473](https://dev.icinga.org/issues/10473 "Bug 10473"): IDO tries to execute empty UPDATE queries * Bug [10491](https://dev.icinga.org/issues/10491 "Bug 10491"): Unique constraint violation with multiple comment inserts in DB IDO * Bug [10495](https://dev.icinga.org/issues/10495 "Bug 10495"): Incorrect JSON-RPC message causes Icinga 2 to crash * Bug [10498](https://dev.icinga.org/issues/10498 "Bug 10498"): IcingaStudio: Accessing non-ConfigObjects causes ugly exception * Bug [10501](https://dev.icinga.org/issues/10501 "Bug 10501"): Plural name rule not treating edge case correcly * Bug [10504](https://dev.icinga.org/issues/10504 "Bug 10504"): Increase the default timeout for OS checks * Bug [10508](https://dev.icinga.org/issues/10508 "Bug 10508"): Figure out whether we need the Checkable attributes state_raw, last_state_raw, hard_state_raw * Bug [10510](https://dev.icinga.org/issues/10510 "Bug 10510"): CreatePipeOverlapped is not thread-safe * Bug [10512](https://dev.icinga.org/issues/10512 "Bug 10512"): Mismatch on {comment,downtime}_id vs internal name in the API * Bug [10517](https://dev.icinga.org/issues/10517 "Bug 10517"): Circular reference between *Connection and TlsStream objects * Bug [10518](https://dev.icinga.org/issues/10518 "Bug 10518"): Crash in ConfigWriter::GetKeywords * Bug [10527](https://dev.icinga.org/issues/10527 "Bug 10527"): Fix indentation for Dictionary::ToString * Bug [10529](https://dev.icinga.org/issues/10529 "Bug 10529"): Change session_token to integer timestamp * Bug [10535](https://dev.icinga.org/issues/10535 "Bug 10535"): Spaces do not work in command arguments * Bug [10538](https://dev.icinga.org/issues/10538 "Bug 10538"): Crash in ConfigWriter::EmitIdentifier * Bug [10539](https://dev.icinga.org/issues/10539 "Bug 10539"): Don't validate custom attributes that aren't strings * Bug [10540](https://dev.icinga.org/issues/10540 "Bug 10540"): Async mysql queries aren't logged in the debug log * Bug [10545](https://dev.icinga.org/issues/10545 "Bug 10545"): Broken build - unresolved external symbol "public: void __thiscall icinga::ApiClient::ExecuteScript... * Bug [10555](https://dev.icinga.org/issues/10555 "Bug 10555"): Don't try to use --gc-sections on Solaris * Bug [10556](https://dev.icinga.org/issues/10556 "Bug 10556"): Update OpenSSL for the Windows builds * Bug [10558](https://dev.icinga.org/issues/10558 "Bug 10558"): There's a variable called 'string' in filter expressions * Bug [10559](https://dev.icinga.org/issues/10559 "Bug 10559"): Autocompletion doesn't work in the debugger * Bug [10560](https://dev.icinga.org/issues/10560 "Bug 10560"): 'api setup' should create a user even when api feature is already enabled * Bug [10561](https://dev.icinga.org/issues/10561 "Bug 10561"): 'remove-comment' action does not support filters * Bug [10562](https://dev.icinga.org/issues/10562 "Bug 10562"): Documentation should not reference real host names * Bug [10563](https://dev.icinga.org/issues/10563 "Bug 10563"): /v1/console should only use a single permission * Bug [10568](https://dev.icinga.org/issues/10568 "Bug 10568"): Improve location information for errors in API filters * Bug [10569](https://dev.icinga.org/issues/10569 "Bug 10569"): Icinga 2 API Docs * Bug [10578](https://dev.icinga.org/issues/10578 "Bug 10578"): API call doesn't fail when trying to use a template that doesn't exist * Bug [10580](https://dev.icinga.org/issues/10580 "Bug 10580"): Detailed error message is missing when object creation via API fails * Bug [10583](https://dev.icinga.org/issues/10583 "Bug 10583"): modify_attribute: object cannot be cloned * Bug [10588](https://dev.icinga.org/issues/10588 "Bug 10588"): Documentation for /v1/types * Bug [10596](https://dev.icinga.org/issues/10596 "Bug 10596"): Deadlock in MacroProcessor::EvaluateFunction * Bug [10601](https://dev.icinga.org/issues/10601 "Bug 10601"): Don't allow users to set state attributes via PUT * Bug [10602](https://dev.icinga.org/issues/10602 "Bug 10602"): API overwrites (and then deletes) config file when trying to create an object that already exists * Bug [10604](https://dev.icinga.org/issues/10604 "Bug 10604"): Group memberships are not updated for runtime created objects * Bug [10629](https://dev.icinga.org/issues/10629 "Bug 10629"): Download URL for NSClient++ is incorrect * Bug [10637](https://dev.icinga.org/issues/10637 "Bug 10637"): Utility::FormatErrorNumber fails when error message uses arguments icinga2-2.4.1/doc/10-monitoring-remote-systems.md000066400000000000000000000100011262555626500215300ustar00rootroot00000000000000# Monitoring Remote Systems ## Overview There's a variety of possibilities to monitor remote servers and services. First off you should decide how your primary monitoring master is able to reach these hosts and services. * direct connection querying the service interface (for example `http`), so-called [agent-less checks](10-monitoring-remote-systems.md#agent-less-checks) * local checks requiring an additional daemon as communication device for your monitoring server ## Agent-less Checks If the remote service is available using a network protocol and port, and a [check plugin](2-getting-started.md#setting-up-check-plugins) is available, you don't necessarily need a local client installed. Rather choose a plugin and configure all parameters and thresholds. The [Icinga 2 Template Library](7-icinga-template-library.md#icinga-template-library) already ships various examples like * [ping4](7-icinga-template-library.md#plugin-check-command-ping4), [ping6](7-icinga-template-library.md#plugin-check-command-ping6), [fping4](7-icinga-template-library.md#plugin-check-command-fping4), [fping6](7-icinga-template-library.md#plugin-check-command-fping6), [hostalive](7-icinga-template-library.md#plugin-check-command-hostalive) * [tcp](7-icinga-template-library.md#plugin-check-command-tcp), [udp](7-icinga-template-library.md#plugin-check-command-udp), [ssl](7-icinga-template-library.md#plugin-check-command-ssl) * [http](7-icinga-template-library.md#plugin-check-command-http), [ftp](7-icinga-template-library.md#plugin-check-command-ftp) * [smtp](7-icinga-template-library.md#plugin-check-command-smtp), [ssmtp](7-icinga-template-library.md#plugin-check-command-ssmtp), [imap](7-icinga-template-library.md#plugin-check-command-imap), [simap](7-icinga-template-library.md#plugin-check-command-simap), [pop](7-icinga-template-library.md#plugin-check-command-pop), [spop](7-icinga-template-library.md#plugin-check-command-spop) * [ntp_time](7-icinga-template-library.md#plugin-check-command-ntp-time) * [ssh](7-icinga-template-library.md#plugin-check-command-ssh) * [dns](7-icinga-template-library.md#plugin-check-command-dns), [dig](7-icinga-template-library.md#plugin-check-command-dig), [dhcp](7-icinga-template-library.md#plugin-check-command-dhcp) There are numerous check plugins contributed by community members available on the internet. If you found one for your requirements, [integrate them into Icinga 2](3-monitoring-basics.md#command-plugin-integration). Start your search at * [Icinga Exchange](https://exchange.icinga.org) * [Icinga Wiki](https://wiki.icinga.org) An example is provided in the sample configuration in the getting started section provided by Icinga 2 ([hosts.conf](4-configuring-icinga-2.md#hosts-conf), [services.conf](4-configuring-icinga-2.md#services-conf)). ## Agent-based Checks If the remote services are not directly accessible through the network, a local agent installation exposing the results to check queries can become handy. Icinga 2 itself can be used as agent (client, satellite) in this scenario, but there are also a couple of addons available for this task. The most famous ones are listed below. ## Agent-based Checks for Linux/Unix The agent runs as daemon and communicates with the master requesting a check being executed or local stored information (SNMP OID). The Icinga 2 client continues to execute checks when the connection dies, and does not need the master as check scheduler like the other listed agents. * Icinga 2 Client * SSH * SNMP * NRPE ## Agent-based Checks for Windows The Windows agent runs as administrative service and offers direct plugin execution and/or local check result being sent to the master instance. * Icinga 2 Client * NSClient++ SNMP could also be used, but was deprecated in Windows Server 2012. Alternatively you can look into the WMI interface. icinga2-2.4.1/doc/11-icinga2-client.md000066400000000000000000001012141262555626500171450ustar00rootroot00000000000000# Icinga 2 Client ## Introduction Icinga 2 uses its own unique and secure communitication protol amongst instances. Be it an High-Availability cluster setup, distributed load-balanced setup or just a single agent [monitoring a remote client](11-icinga2-client.md#icinga2-client). All communication is secured by TLS with certificates, and fully supports IPv4 and IPv6. If you are planning to use the native Icinga 2 cluster feature for distributed monitoring and high-availability, please continue reading in [this chapter](distributed-monitoring-high-availability). > **Tip** > > Don't panic - there are CLI commands available, including setup wizards for easy installation > with SSL certificates. > If you prefer to use your own CA (for example Puppet) you can do that as well. ## Client Scenarios * Clients with [local configuration](11-icinga2-client.md#icinga2-client-configuration-local), sending their inventory to the master * Clients as [command execution bridge](11-icinga2-client.md#icinga2-client-configuration-command-bridge) without local configuration * Clients receive their configuration from the master ([Cluster config sync](11-icinga2-client.md#icinga2-client-configuration-master-config-sync)) Keep the [naming convention](13-distributed-monitoring-ha.md#cluster-naming-convention) for nodes in mind. > **Tip** > > If you're looking for troubleshooting clients problems, check the general > [cluster troubleshooting](16-troubleshooting.md#troubleshooting-cluster) section. ### Combined Client Scenarios If your setup consists of remote clients with local configuration but also command execution bridges and probably syncing global templates through the cluster config sync, you should take a deep breath and take pen and paper to draw your design before starting over. Keep the following hints in mind: * You can blacklist remote nodes entirely. They are then ignored on `node update-config` on the master. * Your remote instance can have local configuration **and** act as remote command execution bridge. * You can use the `global` cluster zones to sync check commands, templates, etc to your remote clients. Be it just for command execution or for helping the local configuration. * If your remote clients shouldn't have local configuration, remove `conf.d` inclusion from `icinga2` and simply use the cluster configuration sync. * `accept_config` and `accept_commands` are disabled by default in the `api` feature If you are planning to use the Icinga 2 client inside a distributed setup, refer to [this chapter](13-distributed-monitoring-ha.md#cluster-scenarios-master-satellite-clients) with detailed instructions. ## Installation ### Configure the Firewall Icinga 2 master, satellite and client instances communicate using the default tcp port `5665`. Communication between zones requires one of these connection directions: * The parent zone nodes are able to connect to the child zone nodes (`parent => child`). * The child zone nodes are able to connect to the parent zone nodes (`parent <= child`). * Both connnection directions work. If you are going to use CSR-Autosigning, you must (temporarly) allow the client connecting to the master instance and open the firewall port. Once the client install is done, you can close the port and use a different communication direction (master-to-client). In case of a [multiple hierarchy setup](13-distributed-monitoring-ha.md#cluster-scenarios-master-satellite-clients) (master, satellite, client) you will need to manually deploy your [client certificates](11-icinga2-client.md#certificates-manual-creation) and zone configuration. ### Setup the Master for Remote Clients If you are planning to use the [remote Icinga 2 clients](11-icinga2-client.md#icinga2-client) you'll first need to update your master setup. Your master setup requires the following * SSL CA and signed certificate for the master * Enabled API feature, and a local Endpoint and Zone object configuration * Firewall ACLs for the communication port (default 5665) You can use the [CLI command](8-cli-commands.md#cli-command-node) `node wizard` for setting up a new node on the master. The command must be run as root, all Icinga 2 specific files will be updated to the icinga user the daemon is running as (certificate files for example). Make sure to answer the first question with `n` (no). nbmif /etc/icinga2 # icinga2 node wizard Welcome to the Icinga 2 Setup Wizard! We'll guide you through all required configuration details. Please specify if this is a satellite setup ('n' installs a master setup) [Y/n]: n Starting the Master setup routine... Please specifiy the common name (CN) [icinga2-node1.localdomain]: Checking the 'api' feature... 'api' feature not enabled, running 'api setup' now. information/cli: Generating new CA. information/base: Writing private key to '/var/lib/icinga2/ca/ca.key'. information/base: Writing X509 certificate to '/var/lib/icinga2/ca/ca.crt'. information/cli: Initializing serial file in '/var/lib/icinga2/ca/serial.txt'. information/cli: Generating new CSR in '/etc/icinga2/pki/icinga2-node1.localdomain.csr'. information/base: Writing private key to '/etc/icinga2/pki/icinga2-node1.localdomain.key'. information/base: Writing certificate signing request to '/etc/icinga2/pki/icinga2-node1.localdomain.csr'. information/cli: Signing CSR with CA and writing certificate to '/etc/icinga2/pki/icinga2-node1.localdomain.crt'. information/cli: Copying CA certificate to '/etc/icinga2/pki/ca.crt'. information/cli: Adding new ApiUser 'root' in '/etc/icinga2/conf.d/api-users.conf'. information/cli: Enabling the ApiListener feature. Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect. information/cli: Dumping config items to file '/etc/icinga2/zones.conf'. Please specify the API bind host/port (optional): Bind Host []: Bind Port []: information/cli: Updating constants.conf. information/cli: Updating constants file '/etc/icinga2/constants.conf'. information/cli: Updating constants file '/etc/icinga2/constants.conf'. Done. Now restart your Icinga 2 daemon to finish the installation! The setup wizard will do the following: * Check if the `api` feature is already enabled, and if not: * Generate a local CA in `/var/lib/icinga2/ca` or use the existing one * Generate a new CSR, sign it with the local CA and copying it into `/etc/icinga2/pki` * Enabling the API feature, and setting optional `bind_host` and `bind_port` * Generate a local zone and endpoint configuration for this master based on FQDN * Setting the `NodeName` and `TicketSalt` constants in [constants.conf](4-configuring-icinga-2.md#constants-conf) The setup wizard does not automatically restart Icinga 2. Verify the modified configuration: # egrep 'NodeName|TicketSalt' /etc/icinga2/constants.conf # cat /etc/icinga2/zones.conf /* * Generated by Icinga 2 node setup commands * on 2015-02-09 15:21:49 +0100 */ object Endpoint "icinga2-node1.localdomain" { } object Zone "master" { //this is the local node master named = "master" endpoints = [ "icinga2-node1.localdomain" ] } Validate the configuration and restart Icinga 2. > **Note** > > This setup wizard will install a standalone master, HA cluster scenarios are currently > not supported and require manual modifications afterwards. ## Client Setup for Remote Monitoring Icinga 2 can be installed on Linux/Unix and Windows. While [Linux/Unix](11-icinga2-client.md#icinga2-client-installation-client-setup-linux) will be using the [CLI command](8-cli-commands.md#cli-command-node) `node wizard` for a guided setup, you will need to use the graphical installer for Windows based client setup. Your client setup requires the following * A ready configured and installed [master node](11-icinga2-client.md#icinga2-client-installation-master-setup) * SSL signed certificate for communication with the master (Use [CSR auto-signing](11-icinga2-client.md#csr-autosigning-requirements)). * Enabled API feature, and a local Endpoint and Zone object configuration * Firewall ACLs for the communication port (default 5665) ### Requirements for CSR Auto-Signing If your remote clients are capable of connecting to the central master, Icinga 2 supports CSR auto-signing. First you'll need to define a secure ticket salt in the [constants.conf](4-configuring-icinga-2.md#constants-conf). The [setup wizard for the master setup](11-icinga2-client.md#icinga2-client-installation-master-setup) will create one for you already. > **Note** > > **Never** expose the ticket salt to your clients. This is the master's private key > and must remain on the master providing the CSR Auto-Signing functionality for security reasons. The client setup wizard will ask you to generate a valid ticket number using its CN. If you already know your remote client's Common Names (CNs) - usually the FQDN - you can generate all ticket numbers on-demand. This is also reasonable if you are not capable of installing the remote client, but a colleague of yours, or a customer. Example for a client: # icinga2 pki ticket --cn icinga2-node2.localdomain ### Manual SSL Certificate Generation This is described separately in the [cluster setup chapter](13-distributed-monitoring-ha.md#manual-certificate-generation). > **Note** > > If you're using [CSR Auto-Signing](11-icinga2-client.md#csr-autosigning-requirements), skip this step. ### Setup the Client on Linux There is no extra client binary or package required. Install Icinga 2 from your distribution's package repository as described in the general [installation instructions](2-getting-started.md#setting-up-icinga2). Please make sure that either [CSR Auto-Signing](11-icinga2-client.md#csr-autosigning-requirements) requirements are fulfilled, or that you're using [manual SSL certificate generation](13-distributed-monitoring-ha.md#manual-certificate-generation). > **Note** > > You don't need any features (DB IDO, Livestatus) or user interfaces on the remote client. > Install them only if you're planning to use them. Once the package installation succeeded, use the `node wizard` CLI command to install a new Icinga 2 node as client setup. You'll need the following configuration details: * The client common name (CN). Defaults to FQDN. * The client's local zone name. Defaults to FQDN. * The master endpoint name. Look into your master setup `zones.conf` file for the proper name. * The master endpoint connection information. Your master's IP address and port (port defaults to 5665) * The [request ticket number](11-icinga2-client.md#csr-autosigning-requirements) generated on your master for CSR Auto-Signing * Bind host/port for the Api feature (optional) The command must be run as root, all Icinga 2 specific files will be updated to the icinga user the daemon is running as (certificate files for example). The wizard creates backups of configuration and certificate files if already existing. Capitalized options in square brackets (e.g. `[Y/n]`) signal the default value and allow you to continue pressing `Enter` instead of entering a value. # icinga2 node wizard Welcome to the Icinga 2 Setup Wizard! We'll guide you through all required configuration details. Please specify if this is a satellite setup ('n' installs a master setup) [Y/n]: Starting the Node setup routine... Please specifiy the common name (CN) [icinga2-node2.localdomain]: Please specifiy the local zone name [icinga2-node2.localdomain]: Please specify the master endpoint(s) this node should connect to: Master Common Name (CN from your master setup): icinga2-node1.localdomain Please fill out the master connection information: Master endpoint host (optional, your master's IP address or FQDN): 192.168.56.101 Master endpoint port (optional) []: Add more master endpoints? [y/N] Please specify the master connection for CSR auto-signing (defaults to master endpoint host): Host [192.168.56.101]: Port [5665]: information/base: Writing private key to '/etc/icinga2/pki/icinga2-node2.localdomain.key'. information/base: Writing X509 certificate to '/etc/icinga2/pki/icinga2-node2.localdomain.crt'. information/cli: Generating self-signed certifiate: information/cli: Fetching public certificate from master (192.168.56.101, 5665): information/cli: Writing trusted certificate to file '/etc/icinga2/pki/trusted-master.crt'. information/cli: Stored trusted master certificate in '/etc/icinga2/pki/trusted-master.crt'. Please specify the request ticket generated on your Icinga 2 master. (Hint: # icinga2 pki ticket --cn 'icinga2-node2.localdomain'): ead2d570e18c78abf285d6b85524970a0f69c22d information/cli: Processing self-signed certificate request. Ticket 'ead2d570e18c78abf285d6b85524970a0f69c22d'. information/cli: Writing signed certificate to file '/etc/icinga2/pki/icinga2-node2.localdomain.crt'. information/cli: Writing CA certificate to file '/etc/icinga2/pki/ca.crt'. Please specify the API bind host/port (optional): Bind Host []: Bind Port []: information/cli: Disabling the Notification feature. Disabling feature notification. Make sure to restart Icinga 2 for these changes to take effect. information/cli: Enabling the Apilistener feature. Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect. information/cli: Created backup file '/etc/icinga2/features-available/api.conf.orig'. information/cli: Generating local zones.conf. information/cli: Dumping config items to file '/etc/icinga2/zones.conf'. information/cli: Created backup file '/etc/icinga2/zones.conf.orig'. information/cli: Updating constants.conf. information/cli: Created backup file '/etc/icinga2/constants.conf.orig'. information/cli: Updating constants file '/etc/icinga2/constants.conf'. information/cli: Updating constants file '/etc/icinga2/constants.conf'. Done. Now restart your Icinga 2 daemon to finish the installation! The setup wizard will do the following: * Generate a new self-signed certificate and copy it into `/etc/icinga2/pki` * Store the master's certificate as trusted certificate for requesting a new signed certificate (manual step when using `node setup`). * Request a new signed certificate from the master and store updated certificate and master CA in `/etc/icinga2/pki` * Generate a local zone and endpoint configuration for this client and the provided master information (based on FQDN) * Disabling the `notification` feature for this client * Enabling the `api` feature, and setting optional `bind_host` and `bind_port` * Setting the `NodeName` constant in [constants.conf](4-configuring-icinga-2.md#constants-conf) The setup wizard does not automatically restart Icinga 2. Verify the modified configuration: # grep 'NodeName' /etc/icinga2/constants.conf # cat /etc/icinga2/zones.conf /* * Generated by Icinga 2 node setup commands * on 2015-02-09 16:56:10 +0100 */ object Endpoint "icinga2-node1.localdomain" { host = "192.168.56.101" } object Zone "master" { endpoints = [ "icinga2-node1.localdomain" ] } object Endpoint "icinga2-node2.localdomain" { } object Zone "icinga2-node2.localdomain" { //this is the local node = "icinga2-node2.localdomain" endpoints = [ "icinga2-node2.localdomain" ] parent = "master" } Validate the configuration and restart Icinga 2. If you are getting an error when requesting the ticket number, please check the following: * Can your client connect to the master instance? * Is the CN the same (from pki ticket on the master and setup node on the client)? * Is the ticket expired? #### Manual Setup without Wizard Instead of using the `node wizard` cli command, there is an alternative `node setup` cli command available which has some pre-requisites. Make sure that the `/etc/icinga2/pki` exists and is owned by the `icinga` user (or the user Icinga 2 is running as). `icinga2-node1.localdomain` is the already installed master instance while `icinga2-node2.localdomain` is the instance where the installation cli commands are executed. Required information: * The client common name (CN). Use the FQDN, e.g. `icinga2-node2.localdomain`. * The master host and zone name. Pass that to `pki save-cert` as `--host` parameter for example. * The client ticket number generated on the master (`icinga2 pki ticket --cn icinga2-node2.localdomain`) Generate a new local self-signed certificate. # icinga2 pki new-cert --cn icinga2-node2.localdomain \ --key /etc/icinga2/pki/icinga2-node2.localdomain.key \ --cert /etc/icinga2/pki/icinga2-node2.localdomain.crt Request the master certificate from the master host (`icinga2-node1.localdomain`) and store it as `trusted-master.crt`. Review it and continue. # icinga2 pki save-cert --key /etc/icinga2/pki/icinga2-node2.localdomain.key \ --cert /etc/icinga2/pki/icinga2-node2.localdomain.crt \ --trustedcert /etc/icinga2/pki/trusted-master.crt \ --host icinga2-node1.localdomain Send the self-signed certificate to the master host using the ticket number and receive a CA signed certificate and the master's `ca.crt` certificate. Specify the path to the previously stored trusted master certificate. # icinga2 pki request --host icinga2-node1.localdomain \ --port 5665 \ --ticket ead2d570e18c78abf285d6b85524970a0f69c22d \ --key /etc/icinga2/pki/icinga2-node2.localdomain.key \ --cert /etc/icinga2/pki/icinga2-node2.localdomain.crt \ --trustedcert /etc/icinga2/pki/trusted-master.crt \ --ca /etc/icinga2/pki/ca.crt Continue with the additional node setup steps. Specify a local endpoint and zone name (`icinga2-node2.localdomain`) and set the master host (`icinga2-node1.localdomain`) as parent zone configuration. Specify the path to the previously stored trusted master certificate. # icinga2 node setup --ticket ead2d570e18c78abf285d6b85524970a0f69c22d \ --endpoint icinga2-node1.localdomain \ --zone icinga2-node2.localdomain \ --master_host icinga2-node1.localdomain \ --trustedcert /etc/icinga2/pki/trusted-master.crt Restart Icinga 2 once complete. # service icinga2 restart ### Setup the Client on Windows Download the MSI-Installer package from [http://packages.icinga.org/windows/](http://packages.icinga.org/windows/). Requirements: * Windows Vista/Server 2008 or higher * [Microsoft .NET Framework 2.0](http://www.microsoft.com/de-de/download/details.aspx?id=1639) if not already installed. The setup wizard will install Icinga 2 and then continue with SSL certificate generation, CSR-Autosigning and configuration setup. You'll need the following configuration details: * The client common name (CN). Defaults to FQDN. * The client's local zone name. Defaults to FQDN. * The master endpoint name. Look into your master setup `zones.conf` file for the proper name. * The master endpoint connection information. Your master's IP address and port (defaults to 5665) * The [request ticket number](11-icinga2-client.md#csr-autosigning-requirements) generated on your master for CSR Auto-Signing * Bind host/port for the Api feature (optional) Once install is done, Icinga 2 is automatically started as a Windows service. The Icinga 2 configuration is located inside the installation path and can be edited with your favorite editor. Configuration validation is done similar to the linux pendant on the Windows shell: C:> icinga2.exe daemon -C ## Client Configuration Modes * Clients with [local configuration](11-icinga2-client.md#icinga2-client-configuration-local), sending their inventory to the master * Clients as [command execution bridge](11-icinga2-client.md#icinga2-client-configuration-command-bridge) without local configuration * Clients receive their configuration from the master ([Cluster config sync](11-icinga2-client.md#icinga2-client-configuration-master-config-sync)) ### Clients with Local Configuration This is considered as independant satellite using a local scheduler, configuration and the possibility to add Icinga 2 features on demand. There is no difference in the configuration syntax on clients to any other Icinga 2 installation. You can also use additional features like notifications directly on the remote client, if you are required to. Basically everything a single Icinga 2 instance provides by default. The following convention applies to remote clients: * The hostname in the default host object should be the same as the Common Name (CN) used for SSL setup * Add new services and check commands locally Local configured checks are transferred to the central master. There are additional `node` cli commands available which allow you to list/add/remove/blacklist remote clients and generate the configuration on the master. #### Discover Client Services on the Master Icinga 2 clients will sync their locally defined objects to the defined master node. That way you can list, add, filter and remove nodes based on their `node`, `zone`, `host` or `service` name. List all discovered nodes (satellites, agents) and their hosts/services: # icinga2 node list Node 'icinga2-node2.localdomain' (last seen: Mon Feb 9 16:58:21 2015) * Host 'icinga2-node2.localdomain' * Service 'ping4' * Service 'ping6' * Service 'ssh' * Service 'http' * Service 'disk' * Service 'disk /' * Service 'icinga' * Service 'load' * Service 'procs' * Service 'swap' * Service 'users' Listing the node and its host(s) and service(s) does not modify the master configuration yet. You need to generate the configuration in the next step. ### Generate Configuration for Client Services on the Master There is a dedicated Icinga 2 CLI command for updating the client services on the master, generating all required configuration. # icinga2 node update-config The generated configuration of all nodes is stored in the `repository.d/` directory. By default, the following additional configuration is generated: * add `Endpoint` and `Zone` objects for the newly added node * add `cluster-zone` health check for the master host for reachability and dependencies * use the default templates `satellite-host` and `satellite-service` defined in `/etc/icinga2/conf.d/satellite.conf` * apply a dependency for all other hosts on the remote satellite prevening failure checks/notifications If hosts or services disappeared from the client discovery, it will remove the existing configuration objects from the config repository. If there are existing hosts/services defined or modified, the CLI command will not overwrite these (modified) configuration files. After updating the configuration repository, make sure to reload Icinga 2. # service icinga2 reload Using systemd: # systemctl reload icinga2 The `update-config` CLI command will fail, if there are uncommitted changes for the configuration repository or if your master is part of a HA setup (see https://dev.icinga.org/issues/8292 for details). Please review these changes manually, or clear the commit and try again. This is a safety hook to prevent unwanted manual changes to be committed by a updating the client discovered objects only. # icinga2 repository commit --simulate # icinga2 repository clear-changes # icinga2 repository commit ### Clients as Command Execution Bridge Similar to other addons (NRPE, NSClient++, etc) the remote Icinga 2 client will only execute commands the master instance is sending. There are no local host or service objects configured, only the check command definitions must be configured. > **Note** > > Remote clients must explicitely accept commands in a similar > fashion as cluster nodes [accept configuration](13-distributed-monitoring-ha.md#cluster-zone-config-sync). > This is due to security reasons. Edit the `api` feature configuration in `/etc/icinga2/features-enabled/api.conf` on your client and set `accept_commands` to `true`. object ApiListener "api" { cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt" key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key" ca_path = SysconfDir + "/icinga2/pki/ca.crt" accept_commands = true } Icinga 2 on the remote client does not schedule checks locally, or keep checking hosts/services on connection loss. This mode also does not allow to use features for backend data writing (DB IDO, Perfdata, etc.) as the client does not have local objects configured. Icinga 2 already provides a variety of `CheckCommand` definitions using the Plugin Check Commands, but you should also modify the local configuration inside `commands.conf` for example. If you're wondering why you need to keep the same command configuration on the master and remote client: Icinga 2 calculates all required runtime macros used as command arguments on the master and sends that information to the client. In case you want to limit command arguments or handles values in a different manner, you can modify the check command configuration on the remote client only. See [this issue](https://dev.icinga.org/issues/8221#note-3) for more details. ### Master Configuration for Clients as Command Execution Bridge This step involves little knowledge about the way the Icinga 2 nodes communication and trust each other. Each client is configured as `Endpoint` object providing connection information. As a matter of trust the client `Endpoint` is a member of its own `Zone` object which gets the master zone configured as parent. That way the master knows how to connect to the client and where to execute the check commands. Add an `Endpoint` and `Zone` configuration object for the remote client in `/etc/icinga2/zones.conf` and define a trusted master zone as `parent`. object Endpoint "icinga2-node2.localdomain" { host = "192.168.56.102" } object Zone "icinga2-node2.localdomain" { parent = "master" endpoints = [ "icinga2-node2.localdomain" ] } More details here: * [configure endpoints](13-distributed-monitoring-ha.md#configure-cluster-endpoints) * [configure zones](13-distributed-monitoring-ha.md#configure-cluster-zones) Once you have configured the required `Endpoint` and `Zone` object definition, you can start configuring your host and service objects. The configuration is simple: If the `command_endpoint` attribute is set, Icinga 2 calculcates all required runtime macros and sends that over to the defined endpoint. The check result is then received asynchronously through the cluster protocol. object Host "host-remote" { import "generic-host" address = "127.0.0.1" address6 = "::1" vars.os = "Linux" } apply Service "users-remote" { import "generic-service" check_command = "users" command_endpoint = "icinga2-node2.localdomain" vars.users_wgreater = 10 vars.users_cgreater = 20 /* assign where a remote client pattern is matched */ assign where match("*-remote", host.name) } If there is a failure on execution (for example, the local check command configuration or the plugin is missing), the check will return `UNKNOWN` and populate the check output with the error message. This will happen in a similar fashion if you forgot to enable the `accept_commands` attribute inside the `api` feature. If you don't want to define the endpoint name inside the service apply rule everytime, you can also easily inherit this from a host's custom attribute like shown in the example below. object Host "host-remote" { import "generic-host" address = "127.0.0.1" address6 = "::1" vars.os = "Linux" vars.remote_client = "icinga2-node2.localdomain" /* host specific check arguments */ vars.users_wgreater = 10 vars.users_cgreater = 20 } apply Service "users-remote" { import "generic-service" check_command = "users" command_endpoint = host.vars.remote_client /* override (remote) command arguments with host settings */ vars.users_wgreater = host.vars.users_wgreater vars.users_cgreater = host.vars.users_cgreater /* assign where a remote client is set */ assign where host.vars.remote_client } That way your generated host object is the information provider and the service apply rules must only be configured once. > **Tip** > > [Event commands](3-monitoring-basics.md#event-commands) are executed on the > remote command endpoint as well. You do not need > an additional transport layer such as SSH or similar. ### Clients with Master Config Sync This is an advanced configuration mode which requires knowledge about the Icinga 2 cluster configuration and its object relation (Zones, Endpoints, etc) and the way you will be able to sync the configuration from the master to the remote satellite or client. Please continue reading in the [distributed monitoring chapter](13-distributed-monitoring-ha.md#distributed-monitoring-high-availability), especially the [configuration synchronisation](13-distributed-monitoring-ha.md#cluster-zone-config-sync) and [best practices](13-distributed-monitoring-ha.md#zone-config-sync-best-practice). ### Advanced Node Cli Actions #### Blacklist/Whitelist for Clients on the Master It's sometimes necessary to `blacklist` an entire remote client, or specific hosts or services provided by this client. While it's reasonable for the local admin to configure for example an additional ping check, you're not interested in that on the master sending out notifications and presenting the dashboard to your support team. Blacklisting an entire set might not be sufficient for excluding several objects, be it a specific remote client with one ping servie you're interested in. Therefore you can `whitelist` clients, hosts, services in a similar manner Example for blacklisting all `ping*` services, but allowing only `probe` host with `ping4`: # icinga2 node blacklist add --zone "*" --host "*" --service "ping*" # icinga2 node whitelist add --zone "*" --host "probe" --service "ping*" You can `list` and `remove` existing blacklists: # icinga2 node blacklist list Listing all blacklist entries: blacklist filter for Node: '*' Host: '*' Service: 'ping*'. # icinga2 node whitelist list Listing all whitelist entries: whitelist filter for Node: '*' Host: 'probe' Service: 'ping*'. > **Note** > > The blacklist feature only prevents future updates from creating and removing objects, but it does not remove already existing objects. > The `--zone` and `--host` arguments are required. A zone is always where the remote client is in. > If you are unsure about it, set a wildcard (`*`) for them and filter only by host/services. #### Manually Discover Clients on the Master Add a to-be-discovered client to the master: # icinga2 node add my-remote-client Set the connection details, and the Icinga 2 master will attempt to connect to this node and sync its object repository. # icinga2 node set my-remote-client --host 192.168.33.101 --port 5665 You can control that by calling the `node list` command: # icinga2 node list Node 'my-remote-client' (host: 192.168.33.101, port: 5665, log duration: 1 day, last seen: Sun Nov 2 17:46:29 2014) #### Remove Discovered Clients If you don't require a connected agent, you can manually remove it and its discovered hosts and services using the following CLI command: # icinga2 node remove my-discovered-agent > **Note** > > Better use [blacklists and/or whitelists](11-icinga2-client.md#icinga2-remote-monitoring-master-discovery-blacklist-whitelist) > to control which clients and hosts/services are integrated into your master configuration repository. icinga2-2.4.1/doc/12-agent-based-checks.md000066400000000000000000000304071262555626500177730ustar00rootroot00000000000000# Additional Agent-based Checks If the remote services are not directly accessible through the network, a local agent installation exposing the results to check queries can become handy. ## SNMP The SNMP daemon runs on the remote system and answers SNMP queries by plugin binaries. The [Monitoring Plugins package](2-getting-started.md#setting-up-check-plugins) ships the `check_snmp` plugin binary, but there are plenty of [existing plugins](14-addons-plugins.md#plugins) for specific use cases already around, for example monitoring Cisco routers. The following example uses the [SNMP ITL](7-icinga-template-library.md#plugin-check-command-snmp) `CheckCommand` and just overrides the `snmp_oid` custom attribute. A service is created for all hosts which have the `snmp-community` custom attribute. apply Service "uptime" { import "generic-service" check_command = "snmp" vars.snmp_oid = "1.3.6.1.2.1.1.3.0" vars.snmp_miblist = "DISMAN-EVENT-MIB" assign where host.vars.snmp_community != "" } Additional SNMP plugins are available using the [Manubulon SNMP Plugins](7-icinga-template-library.md#snmp-manubulon-plugin-check-commands). If no `snmp_miblist` is specified the plugin will default to `ALL`. As the number of available MIB files on the system increases so will the load generated by this plugin if no `MIB` is specified. As such, it is recommended to always specify at least one `MIB`. ## SSH Calling a plugin using the SSH protocol to execute a plugin on the remote server fetching its return code and output. The `by_ssh` command object is part of the built-in templates and requires the `check_by_ssh` check plugin which is available in the [Monitoring Plugins package](2-getting-started.md#setting-up-check-plugins). object CheckCommand "by_ssh_swap" { import "by_ssh" vars.by_ssh_command = "/usr/lib/nagios/plugins/check_swap -w $by_ssh_swap_warn$ -c $by_ssh_swap_crit$" vars.by_ssh_swap_warn = "75%" vars.by_ssh_swap_crit = "50%" } object Service "swap" { import "generic-service" host_name = "remote-ssh-host" check_command = "by_ssh_swap" vars.by_ssh_logname = "icinga" } ## NRPE [NRPE](http://docs.icinga.org/latest/en/nrpe.html) runs as daemon on the remote client including the required plugins and command definitions. Icinga 2 calls the `check_nrpe` plugin binary in order to query the configured command on the remote client. > **Note** > > The NRPE protocol is considered insecure and has multiple flaws in its > design. Upstream is not willing to fix these issues. > > In order to stay safe, please use the native [Icinga 2 client](11-icinga2-client.md#icinga2-client) > instead. The NRPE daemon uses its own configuration format in nrpe.cfg while `check_nrpe` can be embedded into the Icinga 2 `CheckCommand` configuration syntax. You can use the `check_nrpe` plugin from the NRPE project to query the NRPE daemon. Icinga 2 provides the [nrpe check command](7-icinga-template-library.md#plugin-check-command-nrpe) for this: Example: object Service "users" { import "generic-service" host_name = "remote-nrpe-host" check_command = "nrpe" vars.nrpe_command = "check_users" } nrpe.cfg: command[check_users]=/usr/local/icinga/libexec/check_users -w 5 -c 10 If you are planning to pass arguments to NRPE using the `-a` command line parameter, make sure that your NRPE daemon has them supported and enabled. > **Note** > > Enabling command arguments in NRPE is considered harmful > and exposes a security risk allowing attackers to execute > commands remotely. Details at [seclists.org](http://seclists.org/fulldisclosure/2014/Apr/240). The plugin check command `nrpe` provides the `nrpe_arguments` custom attribute which expects either a single value or an array of values. Example: object Service "nrpe-disk-/" { import "generic-service" host_name = "remote-nrpe-host" check_command = "nrpe" vars.nrpe_command = "check_disk" vars.nrpe_arguments = [ "20%", "10%", "/" ] } Icinga 2 will execute the nrpe plugin like this: /usr/lib/nagios/plugins/check_nrpe -H -c 'check_disk' -a '20%' '10%' '/' NRPE expects all additional arguments in an ordered fashion and interprets the first value as `$ARG1$` macro, the second value as `$ARG2$`, and so on. nrpe.cfg: command[check_disk]=/usr/local/icinga/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ Using the above example with `nrpe_arguments` the command executed by the NRPE daemon looks similar to that: /usr/local/icinga/libexec/check_disk -w 20% -c 10% -p / You can pass arguments in a similar manner to [NSClient++](12-agent-based-checks.md#agent-based-checks-nsclient) when using its NRPE supported check method. ## NSClient++ [NSClient++](http://nsclient.org) works on both Windows and Linux platforms and is well known for its magnificent Windows support. There are alternatives like the WMI interface, but using `NSClient++` will allow you to run local scripts similar to check plugins fetching the required output and performance counters. You can use the `check_nt` plugin from the Monitoring Plugins project to query NSClient++. Icinga 2 provides the [nscp check command](7-icinga-template-library.md#plugin-check-command-nscp) for this: Example: object Service "disk" { import "generic-service" host_name = "remote-windows-host" check_command = "nscp" vars.nscp_variable = "USEDDISKSPACE" vars.nscp_params = "c" vars.nscp_warn = 70 vars.nscp_crit = 80 } For details on the `NSClient++` configuration please refer to the [official documentation](http://www.nsclient.org/nscp/wiki/doc/configuration/0.4.x). ## NSCA-NG [NSCA-ng](http://www.nsca-ng.org) provides a client-server pair that allows the remote sender to push check results into the Icinga 2 `ExternalCommandListener` feature. > **Note** > > This addon works in a similar fashion like the Icinga 1.x distributed model. If you > are looking for a real distributed architecture with Icinga 2, scroll down. ## Passive Check Results and SNMP Traps SNMP Traps can be received and filtered by using [SNMPTT](http://snmptt.sourceforge.net/) and specific trap handlers passing the check results to Icinga 2. Following the SNMPTT [Format](http://snmptt.sourceforge.net/docs/snmptt.shtml#SNMPTT.CONF-FORMAT) documentation and the Icinga external command syntax found [here](23-appendix.md#external-commands-list-detail) we can create generic services that can accommodate any number of hosts for a given scenario. ### Simple SNMP Traps A simple example might be monitoring host reboots indicated by an SNMP agent reset. Building the event to auto reset after dispatching a notification is important. Setup the manual check parameters to reset the event from an initial unhandled state or from a missed reset event. Add a directive in `snmptt.conf` EVENT coldStart .1.3.6.1.6.3.1.1.5.1 "Status Events" Normal FORMAT Device reinitialized (coldStart) EXEC echo "[$@] PROCESS_SERVICE_CHECK_RESULT;$A;Coldstart;2;The snmp agent has reinitialized." >> /var/run/icinga2/cmd/icinga2.cmd SDESC A coldStart trap signifies that the SNMPv2 entity, acting in an agent role, is reinitializing itself and that its configuration may have been altered. EDESC 1. Define the `EVENT` as per your need. 2. Construct the `EXEC` statement with the service name matching your template applied to your _n_ hosts. The host address inferred by SNMPTT will be the correlating factor. You can have snmptt provide host names or ip addresses to match your Icinga convention. Add an `EventCommand` configuration object for the passive service auto reset event. object EventCommand "coldstart-reset-event" { import "plugin-event-command" command = [ SysconfDir + "/icinga2/conf.d/custom/scripts/coldstart_reset_event.sh" ] arguments = { "-i" = "$service.state_id$" "-n" = "$host.name$" "-s" = "$service.name$" } } Create the `coldstart_reset_event.sh` shell script to pass the expanded variable data in. The `$service.state_id$` is important in order to prevent an endless loop of event firing after the service has been reset. #!/bin/bash SERVICE_STATE_ID="" HOST_NAME="" SERVICE_NAME="" show_help() { cat <<-EOF Usage: ${0##*/} [-h] -n HOST_NAME -s SERVICE_NAME Writes a coldstart reset event to the Icinga command pipe. -h Display this help and exit. -i SERVICE_STATE_ID The associated service state id. -n HOST_NAME The associated host name. -s SERVICE_NAME The associated service name. EOF } while getopts "hi:n:s:" opt; do case "$opt" in h) show_help exit 0 ;; i) SERVICE_STATE_ID=$OPTARG ;; n) HOST_NAME=$OPTARG ;; s) SERVICE_NAME=$OPTARG ;; '?') show_help exit 0 ;; esac done if [ -z "$SERVICE_STATE_ID" ]; then show_help printf "\n Error: -i required.\n" exit 1 fi if [ -z "$HOST_NAME" ]; then show_help printf "\n Error: -n required.\n" exit 1 fi if [ -z "$SERVICE_NAME" ]; then show_help printf "\n Error: -s required.\n" exit 1 fi if [ "$SERVICE_STATE_ID" -gt 0 ]; then echo "[`date +%s`] PROCESS_SERVICE_CHECK_RESULT;$HOST_NAME;$SERVICE_NAME;0;Auto-reset (`date +"%m-%d-%Y %T"`)." >> /var/run/icinga2/cmd/icinga2.cmd fi Finally create the `Service` and assign it: apply Service "Coldstart" { import "generic-service-custom" check_command = "dummy" event_command = "coldstart-reset-event" enable_notifications = 1 enable_active_checks = 0 enable_passive_checks = 1 enable_flapping = 0 volatile = 1 enable_perfdata = 0 vars.dummy_state = 0 vars.dummy_text = "Manual reset." vars.sla = "24x7" assign where (host.vars.os == "Linux" || host.vars.os == "Windows") } ### Complex SNMP Traps A more complex example might be passing dynamic data from a traps varbind list for a backup scenario where the backup software dispatches status updates. By utilizing active and passive checks, the older freshness concept can be leveraged. By defining the active check as a hard failed state, a missed backup can be reported. As long as the most recent passive update has occurred, the active check is bypassed. Add a directive in `snmptt.conf` EVENT enterpriseSpecific "Status Events" Normal FORMAT Enterprise specific trap EXEC echo "[$@] PROCESS_SERVICE_CHECK_RESULT;$A;$1;$2;$3" >> /var/run/icinga2/cmd/icinga2.cmd SDESC An enterprise specific trap. The varbinds in order denote the Icinga service name, state and text. EDESC 1. Define the `EVENT` as per your need using your actual oid. 2. The service name, state and text are extracted from the first three varbinds. This has the advantage of accommodating an unlimited set of use cases. Create a `Service` for the specific use case associated to the host. If the host matches and the first varbind value is `Backup`, SNMPTT will submit the corresponding passive update with the state and text from the second and third varbind: object Service "Backup" { import "generic-service-custom" host_name = "host.domain.com" check_command = "dummy" enable_notifications = 1 enable_active_checks = 1 enable_passive_checks = 1 enable_flapping = 0 volatile = 1 max_check_attempts = 1 check_interval = 87000 enable_perfdata = 0 vars.sla = "24x7" vars.dummy_state = 2 vars.dummy_text = "No passive check result received." } icinga2-2.4.1/doc/13-distributed-monitoring-ha.md000066400000000000000000001115361262555626500214620ustar00rootroot00000000000000# Distributed Monitoring and High Availability Building distributed environments with high availability included is fairly easy with Icinga 2. The cluster feature is built-in and allows you to build many scenarios based on your requirements: * [High Availability](13-distributed-monitoring-ha.md#cluster-scenarios-high-availability). All instances in the `Zone` run as Active/Active cluster. * [Distributed Zones](13-distributed-monitoring-ha.md#cluster-scenarios-distributed-zones). A master zone and one or more satellites in their zones. * [Load Distribution](13-distributed-monitoring-ha.md#cluster-scenarios-load-distribution). A configuration master and multiple checker satellites. You can combine these scenarios into a global setup fitting your requirements. Each instance got their own event scheduler, and does not depend on a centralized master coordinating and distributing the events. In case of a cluster failure, all nodes continue to run independently. Be alarmed when your cluster fails and a Split-Brain-scenario is in effect - all alive instances continue to do their job, and history will begin to differ. ## Cluster Requirements Before you start deploying, keep the following things in mind: Your [SSL CA and certificates](13-distributed-monitoring-ha.md#manual-certificate-generation) are mandatory for secure communication. Communication between zones requires one of these connection directions: * The parent zone nodes are able to connect to the child zone nodes (`parent => child`). * The child zone nodes are able to connect to the parent zone nodes (`parent <= child`). * Both connnection directions work. Update firewall rules and ACLs. * Icinga 2 master, satellite and client instances communicate using the default tcp port `5665`. Get pen and paper or a drawing board and design your nodes and zones! * Keep the [naming convention](13-distributed-monitoring-ha.md#cluster-naming-convention) for nodes in mind. * All nodes (endpoints) in a cluster zone provide high availability functionality and trust each other. * Cluster zones can be built in a Top-Down-design where the child trusts the parent. Decide whether to use the built-in [configuration syncronization](13-distributed-monitoring-ha.md#cluster-zone-config-sync) or use an external tool (Puppet, Ansible, Chef, Salt, etc) to manage the configuration deployment. > **Tip** > > If you're looking for troubleshooting cluster problems, check the general > [troubleshooting](16-troubleshooting.md#troubleshooting-cluster) section. ## Manual SSL Certificate Generation Icinga 2 provides [CLI commands](8-cli-commands.md#cli-command-pki) assisting with CA and node certificate creation for your Icinga 2 distributed setup. > **Tip** > > You can also use the master and client setup wizards to install the cluster nodes > using CSR-Autosigning. > > The manual steps are helpful if you want to use your own and/or existing CA (for example > Puppet CA). > **Note** > > You're free to use your own method to generated a valid ca and signed client > certificates. The first step is the creation of the certificate authority (CA) by running the following command: # icinga2 pki new-ca Now create a certificate and key file for each node running the following command (replace `icinga2a` with the required hostname): # icinga2 pki new-cert --cn icinga2a --key icinga2a.key --csr icinga2a.csr # icinga2 pki sign-csr --csr icinga2a.csr --cert icinga2a.crt Repeat the step for all nodes in your cluster scenario. Save the CA key in a secure location in case you want to set up certificates for additional nodes at a later time. Navigate to the location of your newly generated certificate files, and manually copy/transfer them to `/etc/icinga2/pki` in your Icinga 2 configuration folder. > **Note** > > The certificate files must be readable by the user Icinga 2 is running as. Also, > the private key file must not be world-readable. Each node requires the following files in `/etc/icinga2/pki` (replace `fqdn-nodename` with the host's FQDN): * ca.crt * <fqdn-nodename>.crt * <fqdn-nodename>.key If you're planning to use your existing CA and certificates please note that you *must not* use wildcard certificates. The common name (CN) is mandatory for the cluster communication and therefore must be unique for each connecting instance. ## Cluster Naming Convention The SSL certificate common name (CN) will be used by the [ApiListener](6-object-types.md#objecttype-apilistener) object to determine the local authority. This name must match the local [Endpoint](6-object-types.md#objecttype-endpoint) object name. Certificate generation for host with the FQDN `icinga2a`: # icinga2 pki new-cert --cn icinga2a --key icinga2a.key --csr icinga2a.csr # icinga2 pki sign-csr --csr icinga2a.csr --cert icinga2a.crt Add a new `Endpoint` object named `icinga2a`: # vim zones.conf object Endpoint "icinga2a" { host = "icinga2a.icinga.org" } The [Endpoint](6-object-types.md#objecttype-endpoint) name is further referenced as `endpoints` attribute on the [Zone](6-object-types.md#objecttype-zone) object. object Endpoint "icinga2b" { host = "icinga2b.icinga.org" } object Zone "config-ha-master" { endpoints = [ "icinga2a", "icinga2b" ] } Specifying the local node name using the [NodeName](13-distributed-monitoring-ha.md#configure-nodename) variable requires the same name as used for the endpoint name and common name above. If not set, the FQDN is used. const NodeName = "icinga2a" If you're using the host's FQDN everywhere, you're on the safe side. The setup wizards will do the very same. ## Cluster Configuration The following section describe which configuration must be updated/created in order to get your cluster running with basic functionality. * [configure the node name](13-distributed-monitoring-ha.md#configure-nodename) * [configure the ApiListener object](13-distributed-monitoring-ha.md#configure-apilistener-object) * [configure cluster endpoints](13-distributed-monitoring-ha.md#configure-cluster-endpoints) * [configure cluster zones](13-distributed-monitoring-ha.md#configure-cluster-zones) Once you're finished with the basic setup the following section will describe how to use [zone configuration synchronisation](13-distributed-monitoring-ha.md#cluster-zone-config-sync) and configure [cluster scenarios](13-distributed-monitoring-ha.md#cluster-scenarios). ### Configure the Icinga Node Name Instead of using the default FQDN as node name you can optionally set that value using the [NodeName](18-language-reference.md#constants) constant. > ** Note ** > > Skip this step if your FQDN already matches the default `NodeName` set > in `/etc/icinga2/constants.conf`. This setting must be unique for each node, and must also match the name of the local [Endpoint](6-object-types.md#objecttype-endpoint) object and the SSL certificate common name as described in the [cluster naming convention](13-distributed-monitoring-ha.md#cluster-naming-convention). vim /etc/icinga2/constants.conf /* Our local instance name. By default this is the server's hostname as returned by `hostname --fqdn`. * This should be the common name from the API certificate. */ const NodeName = "icinga2a" Read further about additional [naming conventions](13-distributed-monitoring-ha.md#cluster-naming-convention). Not specifying the node name will make Icinga 2 using the FQDN. Make sure that all configured endpoint names and common names are in sync. ### Configure the ApiListener Object The [ApiListener](6-object-types.md#objecttype-apilistener) object needs to be configured on every node in the cluster with the following settings: A sample config looks like: object ApiListener "api" { cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt" key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key" ca_path = SysconfDir + "/icinga2/pki/ca.crt" accept_config = true accept_commands = true } You can simply enable the `api` feature using # icinga2 feature enable api Edit `/etc/icinga2/features-enabled/api.conf` if you require the configuration synchronisation enabled for this node. Set the `accept_config` attribute to `true`. If you want to use this node as [remote client for command execution](11-icinga2-client.md#icinga2-client-configuration-command-bridge) set the `accept_commands` attribute to `true`. > **Note** > > The certificate files must be readable by the user Icinga 2 is running as. Also, > the private key file must not be world-readable. ### Configure Cluster Endpoints `Endpoint` objects specify the `host` and `port` settings for the cluster node connection information. This configuration can be the same on all nodes in the cluster only containing connection information. A sample configuration looks like: /** * Configure config master endpoint */ object Endpoint "icinga2a" { host = "icinga2a.icinga.org" } If this endpoint object is reachable on a different port, you must configure the `ApiListener` on the local `Endpoint` object accordingly too. If you don't want the local instance to connect to the remote instance, remove the `host` attribute locally. Keep in mind that the configuration is now different amongst all instances and point-of-view dependant. ### Configure Cluster Zones `Zone` objects specify the endpoints located in a zone. That way your distributed setup can be seen as zones connected together instead of multiple instances in that specific zone. Zones can be used for [high availability](13-distributed-monitoring-ha.md#cluster-scenarios-high-availability), [distributed setups](13-distributed-monitoring-ha.md#cluster-scenarios-distributed-zones) and [load distribution](13-distributed-monitoring-ha.md#cluster-scenarios-load-distribution). Furthermore zones are used for the [Icinga 2 remote client](11-icinga2-client.md#icinga2-client). Each Icinga 2 `Endpoint` must be put into its respective `Zone`. In this example, you will define the zone `config-ha-master` where the `icinga2a` and `icinga2b` endpoints are located. The `check-satellite` zone consists of `icinga2c` only, but more nodes could be added. The `config-ha-master` zone acts as High-Availability setup - the Icinga 2 instances elect one instance running a check, notification or feature (DB IDO), for example `icinga2a`. In case of failure of the `icinga2a` instance, `icinga2b` will take over automatically. object Zone "config-ha-master" { endpoints = [ "icinga2a", "icinga2b" ] } The `check-satellite` zone is a separated location and only sends back their checkresults to the defined parent zone `config-ha-master`. object Zone "check-satellite" { endpoints = [ "icinga2c" ] parent = "config-ha-master" } ## Zone Configuration Synchronisation In case you are using the Icinga 2 API for creating, modifying and deleting objects at runtime, please continue over [here](9-icinga2-api.md#icinga2-api-config-objects-cluster-sync). By default all objects for specific zones should be organized in /etc/icinga2/zones.d/ on the configuration master. Your child zones and endpoint members **must not** have their config copied to `zones.d`. The built-in configuration synchronisation takes care of that if your nodes accept configuration from the parent zone. You can define that in the [ApiListener](13-distributed-monitoring-ha.md#configure-apilistener-object) object by configuring the `accept_config` attribute accordingly. You should remove the sample config included in `conf.d` by commenting the `recursive_include` statement in [icinga2.conf](4-configuring-icinga-2.md#icinga2-conf): //include_recursive "conf.d" This applies to any other non-used configuration directories as well (e.g. `repository.d` if not used). Better use a dedicated directory name for local configuration like `local` or similar, and include that one if your nodes require local configuration not being synced to other nodes. That's useful for local [health checks](13-distributed-monitoring-ha.md#cluster-health-check) for example. > **Note** > > In a [high availability](13-distributed-monitoring-ha.md#cluster-scenarios-high-availability) > setup only one assigned node can act as configuration master. All other zone > member nodes **must not** have the `/etc/icinga2/zones.d` directory populated. These zone packages are then distributed to all nodes in the same zone, and to their respective target zone instances. Each configured zone must exist with the same directory name. The parent zone syncs the configuration to the child zones, if allowed using the `accept_config` attribute of the [ApiListener](13-distributed-monitoring-ha.md#configure-apilistener-object) object. Config on node `icinga2a`: object Zone "master" { endpoints = [ "icinga2a" ] } object Zone "checker" { endpoints = [ "icinga2b" ] parent = "master" } /etc/icinga2/zones.d master health.conf checker health.conf demo.conf Config on node `icinga2b`: object Zone "master" { endpoints = [ "icinga2a" ] } object Zone "checker" { endpoints = [ "icinga2b" ] parent = "master" } /etc/icinga2/zones.d EMPTY_IF_CONFIG_SYNC_ENABLED If the local configuration is newer than the received update Icinga 2 will skip the synchronisation process. > **Note** > > `zones.d` must not be included in [icinga2.conf](4-configuring-icinga-2.md#icinga2-conf). Icinga 2 automatically > determines the required include directory. This can be overridden using the > [global constant](18-language-reference.md#constants) `ZonesDir`. ### Global Configuration Zone for Templates If your zone configuration setup shares the same templates, groups, commands, timeperiods, etc. you would have to duplicate quite a lot of configuration objects making the merged configuration on your configuration master unique. > ** Note ** > > Only put templates, groups, etc into this zone. DO NOT add checkable objects such as > hosts or services here. If they are checked by all instances globally, this will lead > into duplicated check results and unclear state history. Not easy to troubleshoot too - > you have been warned. That is not necessary by defining a global zone shipping all those templates. By setting `global = true` you ensure that this zone serving common configuration templates will be synchronized to all involved nodes (only if they accept configuration though). Config on configuration master: /etc/icinga2/zones.d global-templates/ templates.conf groups.conf master health.conf checker health.conf demo.conf In this example, the global zone is called `global-templates` and must be defined in your zone configuration visible to all nodes. object Zone "global-templates" { global = true } If the remote node does not have this zone configured, it will ignore the configuration update, if it accepts synchronized configuration. If you do not require any global configuration, skip this setting. ### Zone Configuration Synchronisation Permissions Each [ApiListener](6-object-types.md#objecttype-apilistener) object must have the `accept_config` attribute set to `true` to receive configuration from the parent `Zone` members. Default value is `false`. object ApiListener "api" { cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt" key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key" ca_path = SysconfDir + "/icinga2/pki/ca.crt" accept_config = true } If `accept_config` is set to `false`, this instance won't accept configuration from remote master instances anymore. > ** Tip ** > > Look into the [troubleshooting guides](16-troubleshooting.md#troubleshooting-cluster-config-sync) for debugging > problems with the configuration synchronisation. ### Zone Configuration Synchronisation Best Practice The configuration synchronisation works with multiple hierarchies. The following example illustrate a quite common setup where the master is reponsible for configuration deployment: * [High-Availability master zone](13-distributed-monitoring-ha.md#distributed-monitoring-high-availability) * [Distributed satellites](13-distributed-monitoring-ha.md#cluster-scenarios-distributed-zones) * [Remote clients](11-icinga2-client.md#icinga2-client-scenarios) connected to the satellite While you could use the clients with local configuration and service discovery on the satellite/master **bottom up**, the configuration sync could be more reasonable working **top-down** in a cascaded scenario. Take pen and paper and draw your network scenario including the involved zone and endpoint names. Once you've added them to your zones.conf as connection and permission configuration, start over with the actual configuration organization: * Ensure that `command` object definitions are globally available. That way you can use the `command_endpoint` configuration more easily on clients as [command execution bridge](11-icinga2-client.md#icinga2-client-configuration-command-bridge) * Generic `Templates`, `timeperiods`, `downtimes` should be synchronized in a global zone as well. * [Apply rules](3-monitoring-basics.md#using-apply) can be synchronized globally. Keep in mind that they are evaluated on each instance, and might require additional filters (e.g. `match("icinga2*", NodeName) or similar based on the zone information. * [Apply rules](3-monitoring-basics.md#using-apply) specified inside zone directories will only affect endpoints in the same zone or below. * Host configuration must be put into the specific zone directory. * Duplicated host and service objects (also generated by faulty apply rules) will generate a configuration error. * Consider using custom constants in your host/service configuration. Each instance may set their local value, e.g. for `PluginDir`. This example specifies the following hierarchy over three levels: * `ha-master` zone with two child zones `dmz1-checker` and `dmz2-checker` * `dmz1-checker` has two client child zones `dmz1-client1` and `dmz1-client2` * `dmz2-checker` has one client child zone `dmz2-client9` The configuration tree could look like this: # tree /etc/icinga2/zones.d /etc/icinga2/zones.d ├── dmz1-checker │   └── health.conf ├── dmz1-client1 │   └── hosts.conf ├── dmz1-client2 │   └── hosts.conf ├── dmz2-checker │   └── health.conf ├── dmz2-client9 │   └── hosts.conf ├── global-templates │   ├── apply_notifications.conf │   ├── apply_services.conf │   ├── commands.conf │   ├── groups.conf │   ├── templates.conf │   └── users.conf ├── ha-master │   └── health.conf └── README 7 directories, 13 files If you prefer a different naming schema for directories or files names, go for it. If you are unsure about the best method, join the [support channels](1-about.md#support) and discuss with the community. If you are planning to synchronize local service health checks inside a zone, look into the [command endpoint](13-distributed-monitoring-ha.md#cluster-health-check-command-endpoint) explainations. ## Cluster Health Check The Icinga 2 [ITL](7-icinga-template-library.md#icinga-template-library) provides an internal check command checking all configured `EndPoints` in the cluster setup. The check result will become critical if one or more configured nodes are not connected. Example: object Host "icinga2a" { display_name = "Health Checks on icinga2a" address = "192.168.33.10" check_command = "hostalive" } object Service "cluster" { check_command = "cluster" check_interval = 5s retry_interval = 1s host_name = "icinga2a" } Each cluster node should execute its own local cluster health check to get an idea about network related connection problems from different points of view. Additionally you can monitor the connection from the local zone to the remote connected zones. Example for the `checker` zone checking the connection to the `master` zone: object Service "cluster-zone-master" { check_command = "cluster-zone" check_interval = 5s retry_interval = 1s vars.cluster_zone = "master" host_name = "icinga2b" } ## Cluster Health Check with Command Endpoints If you are planning to sync the zone configuration inside a [High-Availability]() cluster zone, you can also use the `command_endpoint` object attribute to pin host/service checks to a specific endpoint inside the same zone. This requires the `accept_commands` setting inside the [ApiListener](13-distributed-monitoring-ha.md#configure-apilistener-object) object set to `true` similar to the [remote client command execution bridge](11-icinga2-client.md#icinga2-client-configuration-command-bridge) setup. Make sure to set `command_endpoint` to the correct endpoint instance. The example below assumes that the endpoint name is the same as the host name configured for health checks. If it differs, define a host custom attribute providing [this information](11-icinga2-client.md#icinga2-client-configuration-command-bridge-master-config). apply Service "cluster-ha" { check_command = "cluster" check_interval = 5s retry_interval = 1s /* make sure host.name is the same as endpoint name */ command_endpoint = host.name assign where regex("^icinga2[a|b]", host.name) } ## Cluster Scenarios All cluster nodes are full-featured Icinga 2 instances. You only need to enabled the features for their role (for example, a `Checker` node only requires the `checker` feature enabled, but not `notification` or `ido-mysql` features). > **Tip** > > There's a [Vagrant demo setup](https://github.com/Icinga/icinga-vagrant/tree/master/icinga2x-cluster) > available featuring a two node cluster showcasing several aspects (config sync, > remote command execution, etc). ### Cluster with Master, Satellites and Remote Clients You can combine "classic" cluster scenarios from HA to Master-Checker with the Icinga 2 Remote Client modes. Each instance plays a certain role in that picture. Imagine the following scenario: * The master zone acts as High-Availability zone * Remote satellite zones execute local checks and report them to the master * All satellites query remote clients and receive check results (which they also replay to the master) * All involved nodes share the same configuration logic: zones, endpoints, apilisteners You'll need to think about the following: * Deploy the entire configuration from the master to satellites and cascading remote clients? ("top down") * Use local client configuration instead and report the inventory to satellites and cascading to the master? ("bottom up") * Combine that with command execution brdiges on remote clients and also satellites ### Security in Cluster Scenarios While there are certain capabilities to ensure the safe communication between all nodes (firewalls, policies, software hardening, etc) the Icinga 2 cluster also provides additional security itself: * [SSL certificates](13-distributed-monitoring-ha.md#manual-certificate-generation) are mandatory for cluster communication. * Child zones only receive event updates (check results, commands, etc) for their configured updates. * Zones cannot influence/interfere other zones. Each checked object is assigned to only one zone. * All nodes in a zone trust each other. * [Configuration sync](13-distributed-monitoring-ha.md#zone-config-sync-permissions) is disabled by default. ### Features in Cluster Zones Each cluster zone may use all available features. If you have multiple locations or departments, they may write to their local database, or populate graphite. Even further all commands are distributed amongst connected nodes. For example, you could re-schedule a check or acknowledge a problem on the master, and it gets replicated to the actual slave checker node. > **Note** > > All features must be same on all endpoints inside an [HA zone](13-distributed-monitoring-ha.md#cluster-scenarios-high-availability). > There are additional [High-Availability-enabled features](13-distributed-monitoring-ha.md#high-availability-features) available. ### Distributed Zones That scenario fits if your instances are spread over the globe and they all report to a master instance. Their network connection only works towards the master master (or the master is able to connect, depending on firewall policies) which means remote instances won't see each/connect to each other. All events (check results, downtimes, comments, etc) are synced to the master node, but the remote nodes can still run local features such as a web interface, reporting, graphing, etc. in their own specified zone. Imagine the following example with a master node in Nuremberg, and two remote DMZ based instances in Berlin and Vienna. Additonally you'll specify [global templates](13-distributed-monitoring-ha.md#zone-global-config-templates) available in all zones. The configuration tree on the master instance `nuremberg` could look like this: zones.d global-templates/ templates.conf groups.conf nuremberg/ local.conf berlin/ hosts.conf vienna/ hosts.conf The configuration deployment will take care of automatically synchronising the child zone configuration: * The master node sends `zones.d/berlin` to the `berlin` child zone. * The master node sends `zones.d/vienna` to the `vienna` child zone. * The master node sends `zones.d/global-templates` to the `vienna` and `berlin` child zones. The endpoint configuration would look like: object Endpoint "nuremberg-master" { host = "nuremberg.icinga.org" } object Endpoint "berlin-satellite" { host = "berlin.icinga.org" } object Endpoint "vienna-satellite" { host = "vienna.icinga.org" } The zones would look like: object Zone "nuremberg" { endpoints = [ "nuremberg-master" ] } object Zone "berlin" { endpoints = [ "berlin-satellite" ] parent = "nuremberg" } object Zone "vienna" { endpoints = [ "vienna-satellite" ] parent = "nuremberg" } object Zone "global-templates" { global = true } The `nuremberg-master` zone will only execute local checks, and receive check results from the satellite nodes in the zones `berlin` and `vienna`. > **Note** > > The child zones `berlin` and `vienna` will get their configuration synchronised > from the configuration master 'nuremberg'. The endpoints in the child > zones **must not** have their `zones.d` directory populated if this endpoint > [accepts synced configuration](13-distributed-monitoring-ha.md#zone-config-sync-permissions). ### Load Distribution If you are planning to off-load the checks to a defined set of remote workers you can achieve that by: * Deploying the configuration on all nodes. * Let Icinga 2 distribute the load amongst all available nodes. That way all remote check instances will receive the same configuration but only execute their part. The master instance located in the `master` zone can also execute checks, but you may also disable the `Checker` feature. Configuration on the master node: zones.d/ global-templates/ master/ checker/ If you are planning to have some checks executed by a specific set of checker nodes you have to define additional zones and define these check objects there. Endpoints: object Endpoint "master-node" { host = "master.icinga.org" } object Endpoint "checker1-node" { host = "checker1.icinga.org" } object Endpoint "checker2-node" { host = "checker2.icinga.org" } Zones: object Zone "master" { endpoints = [ "master-node" ] } object Zone "checker" { endpoints = [ "checker1-node", "checker2-node" ] parent = "master" } object Zone "global-templates" { global = true } > **Note** > > The child zones `checker` will get its configuration synchronised > from the configuration master 'master'. The endpoints in the child > zone **must not** have their `zones.d` directory populated if this endpoint > [accepts synced configuration](13-distributed-monitoring-ha.md#zone-config-sync-permissions). ### Cluster High Availability High availability with Icinga 2 is possible by putting multiple nodes into a dedicated [zone](13-distributed-monitoring-ha.md#configure-cluster-zones). All nodes will elect one active master, and retry an election once the current active master is down. Selected features provide advanced [HA functionality](13-distributed-monitoring-ha.md#high-availability-features). Checks and notifications are load-balanced between nodes in the high availability zone. Connections from other zones will be accepted by all active and passive nodes but all are forwarded to the current active master dealing with the check results, commands, etc. object Zone "config-ha-master" { endpoints = [ "icinga2a", "icinga2b", "icinga2c" ] } Two or more nodes in a high availability setup require an [initial cluster sync](13-distributed-monitoring-ha.md#initial-cluster-sync). > **Note** > > Keep in mind that **only one node acts as configuration master** having the > configuration files in the `zones.d` directory. All other nodes **must not** > have that directory populated. Instead they are required to > [accept synced configuration](13-distributed-monitoring-ha.md#zone-config-sync-permissions). > Details in the [Configuration Sync Chapter](13-distributed-monitoring-ha.md#cluster-zone-config-sync). ### Multiple Hierarchies Your master zone collects all check results for reporting and graphing and also does some sort of additional notifications. The customers got their own instances in their local DMZ zones. They are limited to read/write only their services, but replicate all events back to the master instance. Within each DMZ there are additional check instances also serving interfaces for local departments. The customers instances will collect all results, but also send them back to your master instance. Additionally the customers instance on the second level in the middle prohibits you from sending commands to the subjacent department nodes. You're only allowed to receive the results, and a subset of each customers configuration too. Your master zone will generate global reports, aggregate alert notifications, and check additional dependencies (for example, the customers internet uplink and bandwidth usage). The customers zone instances will only check a subset of local services and delegate the rest to each department. Even though it acts as configuration master with a master dashboard for all departments managing their configuration tree which is then deployed to all department instances. Furthermore the master NOC is able to see what's going on. The instances in the departments will serve a local interface, and allow the administrators to reschedule checks or acknowledge problems for their services. ## High Availability for Icinga 2 features All nodes in the same zone require the same features enabled for High Availability (HA) amongst them. By default the following features provide advanced HA functionality: * [Checks](13-distributed-monitoring-ha.md#high-availability-checks) (load balanced, automated failover) * [Notifications](13-distributed-monitoring-ha.md#high-availability-notifications) (load balanced, automated failover) * [DB IDO](13-distributed-monitoring-ha.md#high-availability-db-ido) (Run-Once, automated failover) ### High Availability with Checks All instances within the same zone (e.g. the `master` zone as HA cluster) must have the `checker` feature enabled. Example: # icinga2 feature enable checker All nodes in the same zone load-balance the check execution. When one instance shuts down the other nodes will automatically take over the reamining checks. ### High Availability with Notifications All instances within the same zone (e.g. the `master` zone as HA cluster) must have the `notification` feature enabled. Example: # icinga2 feature enable notification Notifications are load balanced amongst all nodes in a zone. By default this functionality is enabled. If your nodes should notify independent from any other nodes (this will cause duplicated notifications if not properly handled!), you can set `enable_ha = false` in the [NotificationComponent](6-object-types.md#objecttype-notificationcomponent) feature. ### High Availability with DB IDO All instances within the same zone (e.g. the `master` zone as HA cluster) must have the DB IDO feature enabled. Example DB IDO MySQL: # icinga2 feature enable ido-mysql By default the DB IDO feature only runs on one node. All other nodes in the same zone disable the active IDO database connection at runtime. The node with the active DB IDO connection is not necessarily the zone master. > **Note** > > The DB IDO HA feature can be disabled by setting the `enable_ha` attribute to `false` > for the [IdoMysqlConnection](6-object-types.md#objecttype-idomysqlconnection) or > [IdoPgsqlConnection](6-object-types.md#objecttype-idopgsqlconnection) object on **all** nodes in the > **same** zone. > > All endpoints will enable the DB IDO feature and connect to the configured > database and dump configuration, status and historical data on their own. If the instance with the active DB IDO connection dies, the HA functionality will automatically elect a new DB IDO master. The DB IDO feature will try to determine which cluster endpoint is currently writing to the database and bail out if another endpoint is active. You can manually verify that by running the following query: icinga=> SELECT status_update_time, endpoint_name FROM icinga_programstatus; status_update_time | endpoint_name ------------------------+--------------- 2014-08-15 15:52:26+02 | icinga2a (1 Zeile) This is useful when the cluster connection between endpoints breaks, and prevents data duplication in split-brain-scenarios. The failover timeout can be set for the `failover_timeout` attribute, but not lower than 60 seconds. ## Add a new cluster endpoint These steps are required for integrating a new cluster endpoint: * generate a new [SSL client certificate](13-distributed-monitoring-ha.md#manual-certificate-generation) * identify its location in the zones * update the `zones.conf` file on each involved node ([endpoint](13-distributed-monitoring-ha.md#configure-cluster-endpoints), [zones](13-distributed-monitoring-ha.md#configure-cluster-zones)) * a new slave zone node requires updates for the master and slave zones * verify if this endpoints requires [configuration synchronisation](13-distributed-monitoring-ha.md#cluster-zone-config-sync) enabled * if the node requires the existing zone history: [initial cluster sync](13-distributed-monitoring-ha.md#initial-cluster-sync) * add a [cluster health check](13-distributed-monitoring-ha.md#cluster-health-check) ### Initial Cluster Sync In order to make sure that all of your cluster nodes have the same state you will have to pick one of the nodes as your initial "master" and copy its state file to all the other nodes. You can find the state file in `/var/lib/icinga2/icinga2.state`. Before copying the state file you should make sure that all your cluster nodes are properly shut down. ## Host With Multiple Cluster Nodes Special scenarios might require multiple cluster nodes running on a single host. By default Icinga 2 and its features will place their runtime data below the prefix `LocalStateDir`. By default packages will set that path to `/var`. You can either set that variable as constant configuration definition in [icinga2.conf](4-configuring-icinga-2.md#icinga2-conf) or pass it as runtime variable to the Icinga 2 daemon. # icinga2 -c /etc/icinga2/node1/icinga2.conf -DLocalStateDir=/opt/node1/var icinga2-2.4.1/doc/14-addons-plugins.md000066400000000000000000000313001262555626500173050ustar00rootroot00000000000000# Icinga 2 Addons and Plugins ## Graphing ### PNP [PNP](http://www.pnp4nagios.org) is a graphing addon. [PNP](http://www.pnp4nagios.org) is an addon which adds a graphical representation of the performance data collected by the monitoring plugins. The data is stored as rrd (round robin database) files. Use your distribution's package manager to install the `pnp4nagios` package. If you're planning to use it configure it to use the [bulk mode with npcd and npcdmod](http://docs.pnp4nagios.org/pnp-0.6/modes#bulk_mode_with_npcd_and_npcdmod) in combination with Icinga 2's [PerfdataWriter](15-features.md#performance-data). NPCD collects the performance data files which Icinga 2 generates. Enable performance data writer in icinga 2 # icinga2 feature enable perfdata Configure npcd to use the performance data created by Icinga 2: vim /etc/pnp4nagios/npcd.cfg Set `perfdata_spool_dir = /var/spool/icinga2/perfdata` and restart the `npcd` daemon. There's also an Icinga Web 2 module for direct PNP graph integration available at https://exchange.icinga.org/icinga/PNP4Nagios More information on [action_url as attribute](14-addons-plugins.md#addons-graphing-pnp-action-url) and [graph template names](14-addons-plugins.md#addons-graphing-pnp-custom-templates). ### Graphite [Graphite](http://graphite.readthedocs.org/en/latest/) is a time-series database storing collected metrics and making them available through restful apis and web interfaces. Graphite consists of 3 software components: * carbon - a Twisted daemon that listens for time-series data * whisper - a simple database library for storing time-series data (similar in design to RRD) * graphite webapp - A Django webapp that renders graphs on-demand using Cairo Use the [GraphiteWriter](15-features.md#graphite-carbon-cache-writer) feature for sending real-time metrics from Icinga 2 to Graphite. # icinga2 feature enable graphite There are Graphite addons available for collecting the performance data files too (e.g. `Graphios`). A popular alternative frontend for Graphite is for example [Grafana](http://grafana.org). ### InfluxDB [InfluxDB](https://influxdb.com) is a time series, metrics, and analytics database. It’s written in Go and has no external dependencies. Use the [GraphiteWriter](15-features.md#graphite-carbon-cache-writer) feature for sending real-time metrics from Icinga 2 to InfluxDB. Note: There are [API changes](https://github.com/influxdb/influxdb/issues/2102) in InfluxDB 0.9.x. # icinga2 feature enable graphite A popular frontend for InfluxDB is for example [Grafana](http://grafana.org). ## Visualization ### Icinga Reporting By enabling the [DB IDO](15-features.md#db-ido) feature you can use the [Icinga Reporting package](https://wiki.icinga.org/display/howtos/Setting+up+Icinga+with+Reporting). ### NagVis By using either [Livestatus](15-features.md#setting-up-livestatus) or [DB IDO](15-features.md#db-ido) as a backend you can create your own network maps based on your monitoring configuration and status data using [NagVis](http://www.nagvis.org). The configuration in nagvis.ini.php should look like this for Livestatus for example: [backend_live_1] backendtype="mklivestatus" socket="unix:/var/run/icinga2/cmd/livestatus" If you are planning an integration into Icinga Web 2, look at [this module](https://github.com/divetoh/icingaweb2-module-nagvis). ### Thruk [Thruk](http://www.thruk.org) is an alternative web interface which can be used with Icinga 2 and the [Livestatus](15-features.md#setting-up-livestatus) feature. ## Log Monitoring Using [Logstash](https://www.elastic.co/guide/en/logstash/current/introduction.html) or [Graylog](https://www.graylog.org) in your infrastructure and correlate events with your monitoring is even simpler these days. * Use the `GelfWriter` feature to write Icinga 2's check and notification events to Graylog or Logstash. * Configure the logstash `nagios` output to send passive traps to Icinga 2 using the external command pipe. * Execute a plugin to check Graylog alert streams. More details can be found in [this blog post](https://www.icinga.org/2014/12/02/team-icinga-at-osmc-2014/). ## Notification Scripts and Interfaces There's a variety of resources available, for example different notification scripts such as: * E-Mail ([examples](3-monitoring-basics.md#notifications) provided) * SMS * Pager (XMPP, etc.) * Twitter * IRC * Ticket systems * etc. Additionally external services can be [integrated with Icinga 2](https://www.icinga.org/icinga/integration/): * [Pagerduty](https://www.icinga.org/partners/pagerduty/) * [VictorOps](https://www.icinga.org/partners/victorops/) * [StackStorm](https://www.icinga.org/partners/stackstorm/) More information can be found on the [Icinga Website](https://www.icinga.org) and the [Icinga Wiki](https://wiki.icinga.org/display/howtos/Home). ## Configuration Management Tools If you require your favourite configuration tool to export Icinga 2 configuration, please get in touch with their developers. The Icinga project does not provide a configuration web interface yet. Follow the [Icinga Blog](https://www.icinga.org/blog/) for updates on this topic. If you're looking for puppet manifests, chef cookbooks, ansible recipes, etc - we're happy to integrate them upstream, so please get in touch with the [Icinga team](https://www.icinga.org/community/get-involved/). These tools are currently in development and require feedback and tests: * [Ansible Roles](https://github.com/Icinga/icinga2-ansible) * [Puppet Module](https://github.com/Icinga/puppet-icinga2) * [Chef Cookbook](https://github.com/Icinga/chef-icinga2) ## Plugins For some services you may need additional 'check plugins' which are not provided by the official Monitoring Plugins project. All existing Nagios or Icinga 1.x plugins work with Icinga 2. Here's a list of popular community sites which host check plugins: * [Icinga Exchange](https://exchange.icinga.org) * [Icinga Wiki](https://wiki.icinga.org) The recommended way of setting up these plugins is to copy them to a common directory and create a new global constant, e.g. `CustomPluginDir` in your [constants.conf](4-configuring-icinga-2.md#constants-conf) configuration file: # cp check_snmp_int.pl /opt/monitoring/plugins # chmod +x /opt/plugins/check_snmp_int.pl # cat /etc/icinga2/constants.conf /** * This file defines global constants which can be used in * the other configuration files. At a minimum the * PluginDir constant should be defined. */ const PluginDir = "/usr/lib/nagios/plugins" const CustomPluginDir = "/opt/monitoring/plugins" Prior to using the check plugin with Icinga 2 you should ensure that it is working properly by trying to run it on the console using whichever user Icinga 2 is running as: # su - icinga -s /bin/bash $ /opt/monitoring/plugins/check_snmp_int.pl --help Additional libraries may be required for some plugins. Please consult the plugin documentation and/or plugin provided README for installation instructions. Sometimes plugins contain hard-coded paths to other components. Instead of changing the plugin it might be easier to create logical links which is (more) update-safe. Each plugin requires a [CheckCommand](6-object-types.md#objecttype-checkcommand) object in your configuration which can be used in the [Service](6-object-types.md#objecttype-service) or [Host](6-object-types.md#objecttype-host) object definition. There are the following conventions to follow when adding a new command object definition: * Always import the `plugin-check-command` template * Use [command-arguments](#) whenever possible. The `command` attribute must be an array in `[ ... ]` then for shell escaping. * Define a unique `prefix` for the command's specific command arguments. That way you can safely set them on host/service level and you'll always know which command they control. * Use command argument default values, e.g. for thresholds * Use [advanced conditions](6-object-types.md#objecttype-checkcommand) like `set_if` definitions. Example for a custom `my-snmp-int` check command: object CheckCommand "my-snmp-int" { import "plugin-check-command" command = [ CustomPluginDir + "/check_snmp_int.pl" ] arguments = { "-H" = "$snmp_address$" "-C" = "$snmp_community$" "-p" = "$snmp_port$" "-2" = { set_if = "$snmp_v2$" } "-n" = "$snmp_interface$" "-f" = { set_if = "$snmp_perf$" } "-w" = "$snmp_warn$" "-c" = "$snmp_crit$" } vars.snmp_v2 = true vars.snmp_perf = true vars.snmp_warn = "300,400" vars.snmp_crit = "0,600" } Icinga 2 has built-in check command definitions for the [Manubulon Plugin Checks](7-icinga-template-library.md#snmp-manubulon-plugin-check-commands). For further information on your monitoring configuration read the [Monitoring Basics](3-monitoring-basics.md#monitoring-basics) chapter. You can find additional plugins at the [Icinga Exchange](https://exchange.icinga.org) More details on the plugins can also be found on the Icinga Wiki at https://wiki.icinga.org > **Tip** > > Create the best `CheckCommand` definition there is and send it upstream. More > information can be found in [Contribute Icinga 2 ITL Plugin Check Command Definitions](https://wiki.icinga.org/display/community/Contribute+Icinga+2+ITL+Plugin+Check+Command+Definitions) > on the Icinga Wiki. Thank you in advance! ## Plugin API Currently Icinga 2 supports the native plugin API specification from the `Monitoring Plugins` project. The `Monitoring Plugin API` is defined in the [Monitoring Plugins Development Guidelines](https://www.monitoring-plugins.org/doc/guidelines.html). There are no output length restrictions using Icinga 2. This is different to the [Icinga 1.x plugin api definition](http://docs.icinga.org/latest/en/pluginapi.html#outputlengthrestrictions). ## More Addon Integration Hints ### PNP Action Url They work in a similar fashion for Icinga 2 and are used for 1.x web interfaces (Icinga Web 2 doesn't require the action url attribute in its own module). template Service "pnp-hst" { action_url = "/pnp4nagios/graph?host=$HOSTNAME$" } template Service "pnp-svc" { action_url = "/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$" } ### PNP Custom Templates with Icinga 2 PNP automatically determines the graph template from the check command name (or the argument's name). This behavior changed in Icinga 2 compared to Icinga 1.x. Though there are certain possibilities to fix this: * Create a symlink for example from the `templates.dist/check_ping.php` template to the actual check name in Icinga 2 (`templates/ping4.php`) * Pass the check command name inside the [format template configuration](15-features.md#writing-performance-data-files) The latter becomes difficult with agent based checks like NRPE or SSH where the first command argument acts as graph template identifier. There is the possibility to define the pnp template name as custom attribute and use that inside the formatting templates as `SERVICECHECKCOMMAND` for instance. Example for services: # vim /etc/icinga2/features-enabled/perfdata.conf service_format_template = "DATATYPE::SERVICEPERFDATA\tTIMET::$icinga.timet$\tHOSTNAME::$host.name$\tSERVICEDESC::$service.name$\tSERVICEPERFDATA::$service.perfdata$\tSERVICECHECKCOMMAND::$service.check_command$$pnp_check_arg1$\tHOSTSTATE::$host.state$\tHOSTSTATETYPE::$host.state_type$\tSERVICESTATE::$service.state$\tSERVICESTATETYPE::$service.state_type$" # vim /etc/icinga2/conf.d/services.conf template Service "pnp-svc" { action_url = "/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$" vars.pnp_check_arg1 = "" } apply Service "nrpe-check" { import "pnp-svc" check_command = nrpe vars.nrpe_command = "check_disk" vars.pnp_check_arg1 = "!$nrpe_command$" } If there are warnings about unresolved macros make sure to specify a default value for `vars.pnp_check_arg1` inside the In PNP, the custom template for nrpe is then defined in `/etc/pnp4nagios/custom/nrpe.cfg` and the additional command arg string will be seen in the xml too for other templates. icinga2-2.4.1/doc/15-features.md000066400000000000000000000634201262555626500162050ustar00rootroot00000000000000# Icinga 2 Features ## Logging Icinga 2 supports three different types of logging: * File logging * Syslog (on *NIX-based operating systems) * Console logging (`STDOUT` on tty) You can enable additional loggers using the `icinga2 feature enable` and `icinga2 feature disable` commands to configure loggers: Feature | Description ---------|------------ debuglog | Debug log (path: `/var/log/icinga2/debug.log`, severity: `debug` or higher) mainlog | Main log (path: `/var/log/icinga2/icinga2.log`, severity: `information` or higher) syslog | Syslog (severity: `warning` or higher) By default file the `mainlog` feature is enabled. When running Icinga 2 on a terminal log messages with severity `information` or higher are written to the console. ## DB IDO The IDO (Icinga Data Output) modules for Icinga 2 take care of exporting all configuration and status information into a database. The IDO database is used by a number of projects including Icinga Web 1.x and 2. Details on the installation can be found in the [Configuring DB IDO](2-getting-started.md#configuring-db-ido-mysql) chapter. Details on the configuration can be found in the [IdoMysqlConnection](6-object-types.md#objecttype-idomysqlconnection) and [IdoPgsqlConnection](6-object-types.md#objecttype-idopgsqlconnection) object configuration documentation. The DB IDO feature supports [High Availability](13-distributed-monitoring-ha.md#high-availability-db-ido) in the Icinga 2 cluster. The following example query checks the health of the current Icinga 2 instance writing its current status to the DB IDO backend table `icinga_programstatus` every 10 seconds. By default it checks 60 seconds into the past which is a reasonable amount of time - adjust it for your requirements. If the condition is not met, the query returns an empty result. > **Tip** > > Use [check plugins](14-addons-plugins.md#plugins) to monitor the backend. Replace the `default` string with your instance name, if different. Example for MySQL: # mysql -u root -p icinga -e "SELECT status_update_time FROM icinga_programstatus ps JOIN icinga_instances i ON ps.instance_id=i.instance_id WHERE (UNIX_TIMESTAMP(ps.status_update_time) > UNIX_TIMESTAMP(NOW())-60) AND i.instance_name='default';" +---------------------+ | status_update_time | +---------------------+ | 2014-05-29 14:29:56 | +---------------------+ Example for PostgreSQL: # export PGPASSWORD=icinga; psql -U icinga -d icinga -c "SELECT ps.status_update_time FROM icinga_programstatus AS ps JOIN icinga_instances AS i ON ps.instance_id=i.instance_id WHERE ((SELECT extract(epoch from status_update_time) FROM icinga_programstatus) > (SELECT extract(epoch from now())-60)) AND i.instance_name='default'"; status_update_time ------------------------ 2014-05-29 15:11:38+02 (1 Zeile) A detailed list on the available table attributes can be found in the [DB IDO Schema documentation](23-appendix.md#schema-db-ido). ## External Commands Icinga 2 provides an external command pipe for processing commands triggering specific actions (for example rescheduling a service check through the web interface). In order to enable the `ExternalCommandListener` configuration use the following command and restart Icinga 2 afterwards: # icinga2 feature enable command Icinga 2 creates the command pipe file as `/var/run/icinga2/cmd/icinga2.cmd` using the default configuration. Web interfaces and other Icinga addons are able to send commands to Icinga 2 through the external command pipe, for example for rescheduling a forced service check: # /bin/echo "[`date +%s`] SCHEDULE_FORCED_SVC_CHECK;localhost;ping4;`date +%s`" >> /var/run/icinga2/cmd/icinga2.cmd # tail -f /var/log/messages Oct 17 15:01:25 icinga-server icinga2: Executing external command: [1382014885] SCHEDULE_FORCED_SVC_CHECK;localhost;ping4;1382014885 Oct 17 15:01:25 icinga-server icinga2: Rescheduling next check for service 'ping4' A list of currently supported external commands can be found [here](23-appendix.md#external-commands-list-detail). Detailed information on the commands and their required parameters can be found on the [Icinga 1.x documentation](http://docs.icinga.org/latest/en/extcommands2.html). ## Performance Data When a host or service check is executed plugins should provide so-called `performance data`. Next to that additional check performance data can be fetched using Icinga 2 runtime macros such as the check latency or the current service state (or additional custom attributes). The performance data can be passed to external applications which aggregate and store them in their backends. These tools usually generate graphs for historical reporting and trending. Well-known addons processing Icinga performance data are [PNP4Nagios](14-addons-plugins.md#addons-graphing-pnp), [Graphite](14-addons-plugins.md#addons-graphing-graphite) or [OpenTSDB](15-features.md#opentsdb-writer). ### Writing Performance Data Files PNP4Nagios and Graphios use performance data collector daemons to fetch the current performance files for their backend updates. Therefore the Icinga 2 [PerfdataWriter](6-object-types.md#objecttype-perfdatawriter) feature allows you to define the output template format for host and services helped with Icinga 2 runtime vars. host_format_template = "DATATYPE::HOSTPERFDATA\tTIMET::$icinga.timet$\tHOSTNAME::$host.name$\tHOSTPERFDATA::$host.perfdata$\tHOSTCHECKCOMMAND::$host.check_command$\tHOSTSTATE::$host.state$\tHOSTSTATETYPE::$host.state_type$" service_format_template = "DATATYPE::SERVICEPERFDATA\tTIMET::$icinga.timet$\tHOSTNAME::$host.name$\tSERVICEDESC::$service.name$\tSERVICEPERFDATA::$service.perfdata$\tSERVICECHECKCOMMAND::$service.check_command$\tHOSTSTATE::$host.state$\tHOSTSTATETYPE::$host.state_type$\tSERVICESTATE::$service.state$\tSERVICESTATETYPE::$service.state_type$" The default templates are already provided with the Icinga 2 feature configuration which can be enabled using # icinga2 feature enable perfdata By default all performance data files are rotated in a 15 seconds interval into the `/var/spool/icinga2/perfdata/` directory as `host-perfdata.` and `service-perfdata.`. External collectors need to parse the rotated performance data files and then remove the processed files. ### Graphite Carbon Cache Writer While there are some [Graphite](14-addons-plugins.md#addons-graphing-graphite) collector scripts and daemons like Graphios available for Icinga 1.x it's more reasonable to directly process the check and plugin performance in memory in Icinga 2. Once there are new metrics available, Icinga 2 will directly write them to the defined Graphite Carbon daemon tcp socket. You can enable the feature using # icinga2 feature enable graphite By default the [GraphiteWriter](6-object-types.md#objecttype-graphitewriter) feature expects the Graphite Carbon Cache to listen at `127.0.0.1` on TCP port `2003`. #### Current Graphite Schema The current naming schema is defined as follows. The official Icinga Web 2 Graphite module will use that schema too. The default prefix for hosts and services is configured using [runtime macros](3-monitoring-basics.md#runtime-macros)like this: icinga2.$host.name$.host.$host.check_command$ icinga2.$host.name$.services.$service.name$.$service.check_command$ You can customize the prefix name by using the `host_name_template` and `service_name_template` configuration attributes. The additional levels will allow fine granular filters and also template capabilities, e.g. by using the check command `disk` for specific graph templates in web applications rendering the Graphite data. The following characters are escaped in prefix labels: Character | Escaped character --------------|-------------------------- whitespace | _ . | _ \ | _ / | _ Metric values are stored like this: .perfdata..value The following characters are escaped in perfdata labels: Character | Escaped character --------------|-------------------------- whitespace | _ \ | _ / | _ :: | . Note that perfdata labels may contain dots (`.`) allowing to add more subsequent levels inside the Graphite tree. `::` adds support for [multi performance labels](http://my-plugin.de/wiki/projects/check_multi/configuration/performance) and is therefore replaced by `.`. By enabling `enable_send_thresholds` Icinga 2 automatically adds the following threshold metrics: .perfdata..min .perfdata..max .perfdata..warn .perfdata..crit By enabling `enable_send_metadata` Icinga 2 automatically adds the following metadata metrics: .metadata.current_attempt .metadata.downtime_depth .metadata.execution_time .metadata.latency .metadata.max_check_attempts .metadata.reachable .metadata.state .metadata.state_type Metadata metric overview: metric | description -------------------|------------------------------------------ current_attempt | current check attempt max_check_attempts | maximum check attempts until the hard state is reached reachable | checked object is reachable downtime_depth | number of downtimes this object is in execution_time | check execution time latency | check latency state | current state of the checked object state_type | 0=SOFT, 1=HARD state The following example illustrates how to configure the storage schemas for Graphite Carbon Cache. [icinga2_default] # intervals like PNP4Nagios uses them per default pattern = ^icinga2\. retentions = 1m:2d,5m:10d,30m:90d,360m:4y #### Graphite Schema < 2.4 In order to restore the old legacy schema, you'll need to adopt the `GraphiteWriter` configuration: object GraphiteWriter "graphite" { enable_legacy_mode = true host_name_template = "icinga.$host.name$" service_name_template = "icinga.$host.name$.$service.name$" } The old legacy naming schema is icinga.. icinga... You can customize the metric prefix name by using the `host_name_template` and `service_name_template` configuration attributes. The example below uses [runtime macros](3-monitoring-basics.md#runtime-macros) and a [global constant](18-language-reference.md#constants) named `GraphiteEnv`. The constant name is freely definable and should be put in the [constants.conf](4-configuring-icinga-2.md#constants-conf) file. const GraphiteEnv = "icinga.env1" object GraphiteWriter "graphite" { host_name_template = GraphiteEnv + ".$host.name$" service_name_template = GraphiteEnv + ".$host.name$.$service.name$" } To make sure Icinga 2 writes a valid label into Graphite some characters are replaced with `_` in the target name: \/.- (and space) The resulting name in Graphite might look like: www-01 / http-cert / response time icinga.www_01.http_cert.response_time In addition to the performance data retrieved from the check plugin, Icinga 2 sends internal check statistic data to Graphite: metric | description -------------------|------------------------------------------ current_attempt | current check attempt max_check_attempts | maximum check attempts until the hard state is reached reachable | checked object is reachable downtime_depth | number of downtimes this object is in execution_time | check execution time latency | check latency state | current state of the checked object state_type | 0=SOFT, 1=HARD state The following example illustrates how to configure the storage-schemas for Graphite Carbon Cache. Please make sure that the order is correct because the first match wins. [icinga_internals] pattern = ^icinga\..*\.(max_check_attempts|reachable|current_attempt|execution_time|latency|state|state_type) retentions = 5m:7d [icinga_default] # intervals like PNP4Nagios uses them per default pattern = ^icinga\. retentions = 1m:2d,5m:10d,30m:90d,360m:4y ### GELF Writer The `Graylog Extended Log Format` (short: [GELF](http://www.graylog2.org/resources/gelf)) can be used to send application logs directly to a TCP socket. While it has been specified by the [graylog2](http://www.graylog2.org/) project as their [input resource standard](http://www.graylog2.org/resources/gelf), other tools such as [Logstash](http://www.logstash.net) also support `GELF` as [input type](http://logstash.net/docs/latest/inputs/gelf). You can enable the feature using # icinga2 feature enable gelf By default the `GelfWriter` object expects the GELF receiver to listen at `127.0.0.1` on TCP port `12201`. The default `source` attribute is set to `icinga2`. You can customize that for your needs if required. Currently these events are processed: * Check results * State changes * Notifications ### OpenTSDB Writer While there are some OpenTSDB collector scripts and daemons like tcollector available for Icinga 1.x it's more reasonable to directly process the check and plugin performance in memory in Icinga 2. Once there are new metrics available, Icinga 2 will directly write them to the defined TSDB TCP socket. You can enable the feature using # icinga2 feature enable opentsdb By default the `OpenTsdbWriter` object expects the TSD to listen at `127.0.0.1` on port `4242`. The current naming schema is icinga.host. icinga.service.. for host and service checks. The tag host is always applied. To make sure Icinga 2 writes a valid metric into OpenTSDB some characters are replaced with `_` in the target name: \ (and space) The resulting name in OpenTSDB might look like: www-01 / http-cert / response time icinga.http_cert.response_time In addition to the performance data retrieved from the check plugin, Icinga 2 sends internal check statistic data to OpenTSDB: metric | description -------------------|------------------------------------------ current_attempt | current check attempt max_check_attempts | maximum check attempts until the hard state is reached reachable | checked object is reachable downtime_depth | number of downtimes this object is in execution_time | check execution time latency | check latency state | current state of the checked object state_type | 0=SOFT, 1=HARD state While reachable, state and state_type are metrics for the host or service the other metrics follow the current naming schema icinga.check. with the following tags tag | description --------|------------------------------------------ type | the check type, one of [host, service] host | hostname, the check ran on service | the service name (if type=service) > **Note** > > You might want to set the tsd.core.auto_create_metrics setting to `true` > in your opentsdb.conf configuration file. ## Livestatus The [MK Livestatus](http://mathias-kettner.de/checkmk_livestatus.html) project implements a query protocol that lets users query their Icinga instance for status information. It can also be used to send commands. > **Tip** > > Only install the Livestatus feature if your web interface or addon requires > you to do so (for example, [Icinga Web 2](2-getting-started.md#setting-up-icingaweb2)). > Icinga Classic UI 1.x and Icinga Web 1.x do not use Livestatus as backend. The Livestatus component that is distributed as part of Icinga 2 is a re-implementation of the Livestatus protocol which is compatible with MK Livestatus. Details on the available tables and attributes with Icinga 2 can be found in the [Livestatus Schema](23-appendix.md#schema-livestatus) section. You can enable Livestatus using icinga2 feature enable: # icinga2 feature enable livestatus After that you will have to restart Icinga 2: Debian/Ubuntu, RHEL/CentOS 6 and SUSE: # service icinga2 restart RHEL/CentOS 7 and Fedora: # systemctl restart icinga2 By default the Livestatus socket is available in `/var/run/icinga2/cmd/livestatus`. In order for queries and commands to work you will need to add your query user (e.g. your web server) to the `icingacmd` group: # usermod -a -G icingacmd www-data The Debian packages use `nagios` as the user and group name. Make sure to change `icingacmd` to `nagios` if you're using Debian. Change `www-data` to the user you're using to run queries. In order to use the historical tables provided by the livestatus feature (for example, the `log` table) you need to have the `CompatLogger` feature enabled. By default these logs are expected to be in `/var/log/icinga2/compat`. A different path can be set using the `compat_log_path` configuration attribute. # icinga2 feature enable compatlog ### Livestatus Sockets Other to the Icinga 1.x Addon, Icinga 2 supports two socket types * Unix socket (default) * TCP socket Details on the configuration can be found in the [LivestatusListener](6-object-types.md#objecttype-livestatuslistener) object configuration. ### Livestatus GET Queries > **Note** > > All Livestatus queries require an additional empty line as query end identifier. > The `nc` tool (`netcat`) provides the `-U` parameter to communicate using > a unix socket. There also is a Perl module available in CPAN for accessing the Livestatus socket programmatically: [Monitoring::Livestatus](http://search.cpan.org/~nierlein/Monitoring-Livestatus-0.74/) Example using the unix socket: # echo -e "GET services\n" | /usr/bin/nc -U /var/run/icinga2/cmd/livestatus Example using the tcp socket listening on port `6558`: # echo -e 'GET services\n' | netcat 127.0.0.1 6558 # cat servicegroups < Livestatus COMMAND Queries A list of available external commands and their parameters can be found [here](23-appendix.md#external-commands-list-detail) $ echo -e 'COMMAND ' | netcat 127.0.0.1 6558 ### Livestatus Filters and, or, negate Operator | Negate | Description ----------|------------------------ = | != | Equality ~ | !~ | Regex match =~ | !=~ | Equality ignoring case ~~ | !~~ | Regex ignoring case < | | Less than > | | Greater than <= | | Less than or equal >= | | Greater than or equal ### Livestatus Stats Schema: "Stats: aggregatefunction aggregateattribute" Aggregate Function | Description -------------------|-------------- sum |   min |   max |   avg | sum / count std | standard deviation suminv | sum (1 / value) avginv | suminv / count count | ordinary default for any stats query if not aggregate function defined Example: GET hosts Filter: has_been_checked = 1 Filter: check_type = 0 Stats: sum execution_time Stats: sum latency Stats: sum percent_state_change Stats: min execution_time Stats: min latency Stats: min percent_state_change Stats: max execution_time Stats: max latency Stats: max percent_state_change OutputFormat: json ResponseHeader: fixed16 ### Livestatus Output * CSV CSV output uses two levels of array separators: The members array separator is a comma (1st level) while extra info and host|service relation separator is a pipe (2nd level). Separators can be set using ASCII codes like: Separators: 10 59 44 124 * JSON Default separators. ### Livestatus Error Codes Code | Description ----------|-------------- 200 | OK 404 | Table does not exist 452 | Exception on query ### Livestatus Tables Table | Join |Description --------------|-----------|---------------------------- hosts |   | host config and status attributes, services counter hostgroups |   | hostgroup config, status attributes and host/service counters services | hosts | service config and status attributes servicegroups |   | servicegroup config, status attributes and service counters contacts |   | contact config and status attributes contactgroups |   | contact config, members commands |   | command name and line status |   | programstatus, config and stats comments | services | status attributes downtimes | services | status attributes timeperiods |   | name and is inside flag endpoints |   | config and status attributes log | services, hosts, contacts, commands | parses [compatlog](6-object-types.md#objecttype-compatlogger) and shows log attributes statehist | hosts, services | parses [compatlog](6-object-types.md#objecttype-compatlogger) and aggregates state change attributes hostsbygroup | hostgroups | host attributes grouped by hostgroup and its attributes servicesbygroup | servicegroups | service attributes grouped by servicegroup and its attributes servicesbyhostgroup | hostgroups | service attributes grouped by hostgroup and its attributes The `commands` table is populated with `CheckCommand`, `EventCommand` and `NotificationCommand` objects. A detailed list on the available table attributes can be found in the [Livestatus Schema documentation](23-appendix.md#schema-livestatus). ## Status Data Files Icinga 1.x writes object configuration data and status data in a cyclic interval to its `objects.cache` and `status.dat` files. Icinga 2 provides the `StatusDataWriter` object which dumps all configuration objects and status updates in a regular interval. # icinga2 feature enable statusdata Icinga 1.x Classic UI requires this data set as part of its backend. > **Note** > > If you are not using any web interface or addon which uses these files > you can safely disable this feature. ## Compat Log Files The Icinga 1.x log format is considered being the `Compat Log` in Icinga 2 provided with the `CompatLogger` object. These logs are not only used for informational representation in external web interfaces parsing the logs, but also to generate SLA reports and trends in Icinga 1.x Classic UI. Furthermore the [Livestatus](15-features.md#setting-up-livestatus) feature uses these logs for answering queries to historical tables. The `CompatLogger` object can be enabled with # icinga2 feature enable compatlog By default, the Icinga 1.x log file called `icinga.log` is located in `/var/log/icinga2/compat`. Rotated log files are moved into `var/log/icinga2/compat/archives`. The format cannot be changed without breaking compatibility to existing log parsers. # tail -f /var/log/icinga2/compat/icinga.log [1382115688] LOG ROTATION: HOURLY [1382115688] LOG VERSION: 2.0 [1382115688] HOST STATE: CURRENT;localhost;UP;HARD;1; [1382115688] SERVICE STATE: CURRENT;localhost;disk;WARNING;HARD;1; [1382115688] SERVICE STATE: CURRENT;localhost;http;OK;HARD;1; [1382115688] SERVICE STATE: CURRENT;localhost;load;OK;HARD;1; [1382115688] SERVICE STATE: CURRENT;localhost;ping4;OK;HARD;1; [1382115688] SERVICE STATE: CURRENT;localhost;ping6;OK;HARD;1; [1382115688] SERVICE STATE: CURRENT;localhost;processes;WARNING;HARD;1; [1382115688] SERVICE STATE: CURRENT;localhost;ssh;OK;HARD;1; [1382115688] SERVICE STATE: CURRENT;localhost;users;OK;HARD;1; [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;disk;1382115705 [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;http;1382115705 [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;load;1382115705 [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;ping4;1382115705 [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;ping6;1382115705 [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;processes;1382115705 [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;ssh;1382115705 [1382115706] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;users;1382115705 [1382115731] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;localhost;ping6;2;critical test| [1382115731] SERVICE ALERT: localhost;ping6;CRITICAL;SOFT;2;critical test ## Check Result Files Icinga 1.x writes its check result files to a temporary spool directory where they are processed in a regular interval. While this is extremely inefficient in performance regards it has been rendered useful for passing passive check results directly into Icinga 1.x skipping the external command pipe. Several clustered/distributed environments and check-aggregation addons use that method. In order to support step-by-step migration of these environments, Icinga 2 supports the `CheckResultReader` object. There is no feature configuration available, but it must be defined on-demand in your Icinga 2 objects configuration. object CheckResultReader "reader" { spool_dir = "/data/check-results" } icinga2-2.4.1/doc/16-troubleshooting.md000066400000000000000000000445061262555626500176230ustar00rootroot00000000000000# Icinga 2 Troubleshooting ## Which information is required * Run `icinga2 troubleshoot` to collect required troubleshooting information * Alternative, manual steps: * `icinga2 --version` * `icinga2 feature list` * `icinga2 daemon --validate` * Relevant output from your main and debug log ( `icinga2 object list --type='filelogger'` ) * The newest Icinga 2 crash log, if relevant * Your icinga2.conf and, if you run multiple Icinga 2 instances, your zones.conf * How was Icinga 2 installed (and which repository in case) and which distribution are you using * Provide complete configuration snippets explaining your problem in detail * If the check command failed - what's the output of your manual plugin tests? * In case of [debugging](21-development.md#development) Icinga 2, the full back traces and outputs ## Enable Debug Output Enable the `debuglog` feature: # icinga2 feature enable debuglog # service icinga2 restart You can find the debug log file in `/var/log/icinga2/debug.log`. Alternatively you may run Icinga 2 in the foreground with debugging enabled. Specify the console log severity as an additional parameter argument to `-x`. # /usr/sbin/icinga2 daemon -x notice The log level can be one of `critical`, `warning`, `information`, `notice` and `debug`. ## List Configuration Objects The `icinga2 object list` CLI command can be used to list all configuration objects and their attributes. The tool also shows where each of the attributes was modified. > **Tip** > > Use the Icinga 2 API to access [config objects at runtime](9-icinga2-api.md#icinga2-api-config-objects) directly. That way you can also identify which objects have been created from your [apply rules](18-language-reference.md#apply). # icinga2 object list Object 'localhost!ssh' of type 'Service': * __name = 'localhost!ssh' * check_command = 'ssh' % = modified in '/etc/icinga2/conf.d/hosts/localhost/ssh.conf', lines 5:3-5:23 * check_interval = 60 % = modified in '/etc/icinga2/conf.d/templates.conf', lines 24:3-24:21 * host_name = 'localhost' % = modified in '/etc/icinga2/conf.d/hosts/localhost/ssh.conf', lines 4:3-4:25 * max_check_attempts = 3 % = modified in '/etc/icinga2/conf.d/templates.conf', lines 23:3-23:24 * name = 'ssh' * retry_interval = 30 % = modified in '/etc/icinga2/conf.d/templates.conf', lines 25:3-25:22 * templates = [ 'ssh', 'generic-service' ] % += modified in '/etc/icinga2/conf.d/hosts/localhost/ssh.conf', lines 1:0-7:1 % += modified in '/etc/icinga2/conf.d/templates.conf', lines 22:1-26:1 * type = 'Service' * vars % += modified in '/etc/icinga2/conf.d/hosts/localhost/ssh.conf', lines 6:3-6:19 * sla = '24x7' % = modified in '/etc/icinga2/conf.d/hosts/localhost/ssh.conf', lines 6:3-6:19 [...] You can also filter by name and type: # icinga2 object list --name *ssh* --type Service Object 'localhost!ssh' of type 'Service': * __name = 'localhost!ssh' * check_command = 'ssh' % = modified in '/etc/icinga2/conf.d/hosts/localhost/ssh.conf', lines 5:3-5:23 * check_interval = 60 % = modified in '/etc/icinga2/conf.d/templates.conf', lines 24:3-24:21 * host_name = 'localhost' % = modified in '/etc/icinga2/conf.d/hosts/localhost/ssh.conf', lines 4:3-4:25 * max_check_attempts = 3 % = modified in '/etc/icinga2/conf.d/templates.conf', lines 23:3-23:24 * name = 'ssh' * retry_interval = 30 % = modified in '/etc/icinga2/conf.d/templates.conf', lines 25:3-25:22 * templates = [ 'ssh', 'generic-service' ] % += modified in '/etc/icinga2/conf.d/hosts/localhost/ssh.conf', lines 1:0-7:1 % += modified in '/etc/icinga2/conf.d/templates.conf', lines 22:1-26:1 * type = 'Service' * vars % += modified in '/etc/icinga2/conf.d/hosts/localhost/ssh.conf', lines 6:3-6:19 * sla = '24x7' % = modified in '/etc/icinga2/conf.d/hosts/localhost/ssh.conf', lines 6:3-6:19 Found 1 Service objects. [2014-10-15 14:27:19 +0200] information/cli: Parsed 175 objects. ## Where are the check command definitions? Icinga 2 features a number of built-in [check command definitions](7-icinga-template-library.md#plugin-check-commands) which are included using include include in the [icinga2.conf](4-configuring-icinga-2.md#icinga2-conf) configuration file. These files are not considered configuration files and will be overridden on upgrade, so please send modifications as proposed patches upstream. The default include path is set to `LocalStateDir + "/share/icinga2/includes"`. You should add your own command definitions to a new file in `conf.d/` called `commands.conf` or similar. ## Checks are not executed * Check the debug log to see if the check command gets executed * Verify that failed depedencies do not prevent command execution * Make sure that the plugin is executable by the Icinga 2 user (run a manual test) * Make sure the [checker](8-cli-commands.md#enable-features) feature is enabled. * Use the Icinga 2 API [event streams](9-icinga2-api.md#icinga2-api-event-streams) to receive live check result streams. Examples: # sudo -u icinga /usr/lib/nagios/plugins/check_ping -4 -H 127.0.0.1 -c 5000,100% -w 3000,80% # icinga2 feature enable checker The feature 'checker' is already enabled. Fetch all check result events matching the `event.service` name `random`: $ curl -k -s -u root:icinga -X POST 'https://localhost:5665/v1/events?queue=debugchecks&types=CheckResult&filter=match%28%22random*%22,event.service%29' ## Notifications are not sent * Check the debug log to see if a notification is triggered * If yes, verify that all conditions are satisfied * Are any errors on the notification command execution logged? Verify the following configuration * Is the host/service `enable_notifications` attribute set, and if, to which value? * Do the notification attributes `states`, `types`, `period` match the notification conditions? * Do the user attributes `states`, `types`, `period` match the notification conditions? * Are there any notification `begin` and `end` times configured? * Make sure the [notification](8-cli-commands.md#enable-features) feature is enabled. * Does the referenced NotificationCommand work when executed as Icinga user on the shell? If notifications are to be sent via mail make sure that the mail program specified inside the [NotificationCommand object](6-object-types.md#objecttype-notificationcommand) exists. The name and location depends on the distribution so the preconfigured setting might have to be changed on your system. Examples: # icinga2 feature enable notification The feature 'notification' is already enabled. You can use the Icinga 2 API [event streams](9-icinga2-api.md#icinga2-api-event-streams) to receive live notification streams: $ curl -k -s -u root:icinga -X POST 'https://localhost:5665/v1/events?queue=debugnotifications&types=Notification' ## Feature is not working * Make sure that the feature configuration is enabled by symlinking from `features-available/` to `features-enabled` and that the latter is included in [icinga2.conf](4-configuring-icinga-2.md#icinga2-conf). * Are the feature attributes set correctly according to the documentation? * Any errors on the logs? ## Configuration is ignored * Make sure that the line(s) are not [commented out](18-language-reference.md#comments) (starting with `//` or `#`, or encapsulated by `/* ... */`). * Is the configuration file included in [icinga2.conf](4-configuring-icinga-2.md#icinga2-conf)? ## Configuration attributes are inherited from Icinga 2 allows you to import templates using the [import](18-language-reference.md#template-imports) keyword. If these templates contain additional attributes, your objects will automatically inherit them. You can override or modify these attributes in the current object. ## Configuration Value with Single Dollar Sign In case your configuration validation fails with a missing closing dollar sign error message, you did not properly escape the single dollar sign preventing its usage as [runtime macro](3-monitoring-basics.md#runtime-macros). critical/config: Error: Validation failed for Object 'ping4' (Type: 'Service') at /etc/icinga2/zones.d/global-templates/windows.conf:24: Closing $ not found in macro format string 'top-syntax=${list}'. ## Cluster and Clients Troubleshooting This applies to anything using the cluster protocol: * [Distributed and High-Availability](13-distributed-monitoring-ha.md#distributed-monitoring-high-availability) scenarios * [Remote client](11-icinga2-client.md#icinga2-client-scenarios) scenarios You should configure the [cluster health checks](13-distributed-monitoring-ha.md#cluster-health-check) if you haven't done so already. > **Note** > > Some problems just exist due to wrong file permissions or packet filters applied. Make > sure to check these in the first place. ### Cluster Troubleshooting Connection Errors General connection errors normally lead you to one of the following problems: * Wrong network configuration * Packet loss on the connection * Firewall rules preventing traffic Use tools like `netstat`, `tcpdump`, `nmap`, etc to make sure that the cluster communication happens (default port is `5665`). # tcpdump -n port 5665 -i any # netstat -tulpen | grep icinga # nmap yourclusternode.localdomain ### Cluster Troubleshooting SSL Errors If the cluster communication fails with SSL error messages, make sure to check the following * File permissions on the SSL certificate files * Does the used CA match for all cluster endpoints? * Verify the `Issuer` being your trusted CA * Verify the `Subject` containing your endpoint's common name (CN) * Check the validity of the certificate itself Steps on the client `icinga2-node2.localdomain`: # ls -la /etc/icinga2/pki # cd /etc/icinga2/pki/ # openssl x509 -in icinga2-node2.localdomain.crt -text Certificate: Data: Version: 1 (0x0) Serial Number: 2 (0x2) Signature Algorithm: sha1WithRSAEncryption Issuer: C=DE, ST=Bavaria, L=Nuremberg, O=NETWAYS GmbH, OU=Monitoring, CN=Icinga CA Validity Not Before: Jan 7 13:17:38 2014 GMT Not After : Jan 5 13:17:38 2024 GMT Subject: C=DE, ST=Bavaria, L=Nuremberg, O=NETWAYS GmbH, OU=Monitoring, CN=icinga2-node2.localdomain Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (4096 bit) Modulus: ... Try to manually connect from `icinga2-node2.localdomain` to the master node `icinga2-node1.localdomain`: # openssl s_client -CAfile /etc/icinga2/pki/ca.crt -cert /etc/icinga2/pki/icinga2-node2.localdomain.crt -key /etc/icinga2/pki/icinga2-node2.localdomain..key -connect icinga2-node1.localdomain.crt:5665 CONNECTED(00000003) --- ... If the connection attempt fails or your CA does not match, [verify the master and client certificates](16-troubleshooting.md#troubleshooting-cluster-ssl-certificate-verification). #### Cluster Troubleshooting Unauthenticated Clients Unauthenticated nodes are able to connect required by the [CSR auto-signing](11-icinga2-client.md#csr-autosigning-requirements) functionality. Master: [2015-07-13 18:29:25 +0200] information/ApiListener: New client connection for identity 'icinga-client' (unauthenticated) Client as command execution bridge: [2015-07-13 18:29:26 +1000] notice/ApiEvents: Discarding 'execute command' message from 'icinga-master': Invalid endpoint origin (client not allowed). If these messages do not go away, make sure to [verify the master and client certificates](16-troubleshooting.md#troubleshooting-cluster-ssl-certificate-verification). #### Cluster Troubleshooting SSL Certificate Verification Make sure to verify the client's certificate and its received `ca.crt` in `/etc/icinga2/pki` and ensure that both instances are signed by the **same CA**. # openssl verify -verbose -CAfile /etc/icinga2/pki/ca.crt /etc/icinga2/pki/icinga2-node1.localdomain.crt icinga2-node1.localdomain.crt: OK # openssl verify -verbose -CAfile /etc/icinga2/pki/ca.crt /etc/icinga2/pki/icinga2-node2.localdomain.crt icinga2-node2.localdomain.crt: OK Fetch the `ca.crt` file from the client node and compare it to your master's `ca.crt` file: # scp icinga2-node2:/etc/icinga2/pki/ca.crt test-client-ca.crt # diff -ur /etc/icinga2/pki/ca.crt test-client-ca.crt On SLES11 you'll need to use the `openssl1` command instead of `openssl`. ### Cluster Troubleshooting Message Errors At some point, when the network connection is broken or gone, the Icinga 2 instances will be disconnected. If the connection can't be re-established between endpoints in the same HA zone, they remain in a Split-Brain-mode and history may differ. Although the Icinga 2 cluster protocol stores historical events in a [replay log](16-troubleshooting.md#troubleshooting-cluster-replay-log) for later synchronisation, you should make sure to check why the network connection failed. ### Cluster Troubleshooting Command Endpoint Errors Command endpoints can be used for clients acting as [remote command execution bridge](11-icinga2-client.md#icinga2-client-configuration-command-bridge) as well as inside an [High-Availability cluster](13-distributed-monitoring-ha.md#distributed-monitoring-high-availability). There is no cli command for manually executing the check, but you can verify the following (e.g. by invoking a forced check from the web interface): * `/var/log/icinga2/icinga2.log` contains connection and execution errors. * The ApiListener is not enabled to [accept commands](11-icinga2-client.md#icinga2-client-configuration-command-bridge). * `CheckCommand` definition not found on the remote client. * Referenced check plugin not found on the remote client. * Runtime warnings and errors, e.g. unresolved runtime macros or configuration problems. * Specific error messages are also populated into `UNKNOWN` check results including a detailed error message in their output. * Verify the `check_source` object attribute. This is populated by the node executing the check. * More verbose logs are found inside the [debug log](16-troubleshooting.md#troubleshooting-enable-debug-output). * Use the Icinga 2 API [event streams](9-icinga2-api.md#icinga2-api-event-streams) to receive live check result streams. Fetch all check result events matching the `event.service` name `remote-client`: $ curl -k -s -u root:icinga -X POST 'https://localhost:5665/v1/events?queue=debugcommandendpoint&types=CheckResult&filter=match%28%22remote-client*%22,event.service%29' ### Cluster Troubleshooting Config Sync If the cluster zones do not sync their configuration, make sure to check the following: * Within a config master zone, only one configuration master is allowed to have its config in `/etc/icinga2/zones.d`. ** The master syncs the configuration to `/var/lib/icinga2/api/zones/` during startup and only syncs valid configuration to the other nodes. ** The other nodes receive the configuration into `/var/lib/icinga2/api/zones/`. * The `icinga2.log` log file in `/var/log/icinga2` will indicate whether this ApiListener [accepts config](13-distributed-monitoring-ha.md#zone-config-sync-permissions), or not. Verify the object's [version](6-object-types.md#object-types) attribute on all nodes to check whether the config update and reload was succesful or not. ### Cluster Troubleshooting Overdue Check Results If your master does not receive check results (or any other events) from the child zones (satellite, clients, etc) make sure to check whether the client sending in events is allowed to do so. The [cluster naming convention](13-distributed-monitoring-ha.md#cluster-naming-convention) applies so if there's a mismatch between your client node's endpoint name and its provided certificate's CN, the master will deny all events. > **Tip** > > [Icinga Web 2](2-getting-started.md#setting-up-the-user-interface) provides a dashboard view > for overdue check results. Enable the [debug log](16-troubleshooting.md#troubleshooting-enable-debug-output) on the master for more verbose insights. If the client cannot authenticate, it's a more general [problem](16-troubleshooting.md#troubleshooting-cluster-unauthenticated-clients). The client's endpoint is not configured on nor trusted by the master node: Discarding 'check result' message from 'icinga2b': Invalid endpoint origin (client not allowed). The check result message sent by the client does not belong to the zone the checkable object is in on the master: Discarding 'check result' message from 'icinga2b': Unauthorized access. ### Cluster Troubleshooting Replay Log If your `/var/lib/icinga2/api/log` directory grows, it generally means that your cluster cannot replay the log on connection loss and re-establishment. A master node for example will store all events for not connected endpoints in the same and child zones. Check the following: * All clients are connected? (e.g. [cluster health check](13-distributed-monitoring-ha.md#cluster-health-check)). * Check your [connection](16-troubleshooting.md#troubleshooting-cluster-connection-errors) in general. * Does the log replay work, e.g. are all events processed and the directory gets cleared up over time? * Decrease the `log_duration` attribute value for that specific [endpoint](6-object-types.md#objecttype-endpoint). icinga2-2.4.1/doc/17-upgrading-icinga-2.md000066400000000000000000000042011262555626500177300ustar00rootroot00000000000000# Upgrading Icinga 2 Upgrading Icinga 2 is usually quite straightforward. Ordinarily the only manual steps involved are scheme updates for the IDO database. ## Upgrading the MySQL database If you're upgrading an existing Icinga 2 instance you should check the `/usr/share/icinga2-ido-mysql/schema/upgrade` directory for an incremental schema upgrade file. > **Note** > > If there isn't an upgrade file for your current version available there's nothing to do. Apply all database schema upgrade files incrementally. # mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/upgrade/.sql The Icinga 2 DB IDO module will check for the required database schema version on startup and generate an error message if not satisfied. **Example:** You are upgrading Icinga 2 from version `2.0.2` to `2.3.0`. Look into the *upgrade* directory: $ ls /usr/share/icinga2-ido-mysql/schema/upgrade/ 2.0.2.sql 2.1.0.sql 2.2.0.sql 2.3.0.sql There are two new upgrade files called `2.1.0.sql`, `2.2.0.sql` and `2.3.0.sql` which must be applied incrementally to your IDO database. ## Upgrading the PostgreSQL database If you're updating an existing Icinga 2 instance you should check the `/usr/share/icinga2-ido-pgsql/schema/upgrade` directory for an incremental schema upgrade file. > **Note** > > If there isn't an upgrade file for your current version available there's nothing to do. Apply all database schema upgrade files incrementally. # export PGPASSWORD=icinga # psql -U icinga -d icinga < /usr/share/icinga2-ido-pgsql/schema/upgrade/.sql The Icinga 2 DB IDO module will check for the required database schema version on startup and generate an error message if not satisfied. **Example:** You are upgrading Icinga 2 from version `2.0.2` to `2.3.0`. Look into the *upgrade* directory: $ ls /usr/share/icinga2-ido-pgsql/schema/upgrade/ 2.0.2.sql 2.1.0.sql 2.2.0.sql 2.3.0.sql There are two new upgrade files called `2.1.0.sql`, `2.2.0.sql` and `2.3.0.sql` which must be applied incrementally to your IDO database. icinga2-2.4.1/doc/18-language-reference.md000066400000000000000000000755161262555626500201220ustar00rootroot00000000000000# Language Reference ## Object Definition Icinga 2 features an object-based configuration format. You can define new objects using the `object` keyword: object Host "host1.example.org" { display_name = "host1" address = "192.168.0.1" address6 = "::1" } In general you need to write each statement on a new line. Expressions started with `{`, `(` and `[` extend until the matching closing character and can be broken up into multiple lines. Alternatively you can write multiple statements on a single line by separating them with a semicolon: object Host "host1.example.org" { display_name = "host1" address = "192.168.0.1"; address6 = "::1" } Each object is uniquely identified by its type (`Host`) and name (`host1.example.org`). Some types have composite names, e.g. the `Service` type which uses the `host_name` attribute and the name you specified to generate its object name. Exclamation marks (!) are not permitted in object names. Objects can contain a comma-separated list of property declarations. Instead of commas semicolons may also be used. The following data types are available for property values: All objects have at least the following attributes: Attribute | Description ---------------------|----------------------------- name | The name of the object. This attribute can be modified in the object definition to override the name specified with the `object` directive. type | The type of the object. ## Expressions The following expressions can be used on the right-hand side of assignments. ### Numeric Literals A floating-point number. Example: 27.3 ### Duration Literals Similar to floating-point numbers except for the fact that they support suffixes to help with specifying time durations. Example: 2.5m Supported suffixes include ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Duration literals are converted to seconds by the config parser and are treated like numeric literals. ### String Literals A string. Example: "Hello World!" Certain characters need to be escaped. The following escape sequences are supported: Character | Escape sequence --------------------------|------------------------------------ " | \\" \\ | \\\\ <TAB> | \\t <CARRIAGE-RETURN> | \\r <LINE-FEED> | \\n <BEL> | \\b <FORM-FEED> | \\f In addition to these pre-defined escape sequences you can specify arbitrary ASCII characters using the backslash character (\\) followed by an ASCII character in octal encoding. ### Multi-line String Literals Strings spanning multiple lines can be specified by enclosing them in {{{ and }}}. Example: {{{This is a multi-line string.}}} Unlike in ordinary strings special characters do not have to be escaped in multi-line string literals. ### Boolean Literals The keywords `true` and `false` are used to denote truth values. ### Null Value The `null` keyword can be used to specify an empty value. ### Dictionary An unordered list of key-value pairs. Keys must be unique and are compared in a case-sensitive manner. Individual key-value pairs must either be comma-separated or on separate lines. The comma after the last key-value pair is optional. Example: { address = "192.168.0.1" port = 443 } Identifiers may not contain certain characters (e.g. space) or start with certain characters (e.g. digits). If you want to use a dictionary key that is not a valid identifier you can enclose the key in double quotes. ### Array An ordered list of values. Individual array elements must be comma-separated. The comma after the last element is optional. Example: [ "hello", 42 ] An array may simultaneously contain values of different types, such as strings and numbers. ### Operators The following operators are supported in expressions. The operators are by descending precedence. Operator | Precedence | Examples (Result) | Description ---------|------------|-----------------------------------------------|-------------------------------- () | 1 | (3 + 3) * 5 | Groups sub-expressions () | 1 | Math.random() | Calls a function [] | 1 | a[3] | Array subscript . | 1 | a.b | Element access ! | 2 | !"Hello" (false), !false (true) | Logical negation of the operand ~ | 2 | ~true (false) | Bitwise negation of the operand + | 2 | +3 | Unary plus - | 2 | -3 | Unary minus * | 3 | 5m * 10 (3000) | Multiplies two numbers / | 3 | 5m / 5 (60) | Divides two numbers % | 3 | 17 % 12 (5) | Remainder after division + | 4 | 1 + 3 (4), "hello " + "world" ("hello world") | Adds two numbers; concatenates strings - | 4 | 3 - 1 (2) | Subtracts two numbers << | 5 | 4 << 8 (1024) | Left shift >> | 5 | 1024 >> 4 (64) | Right shift < | 6 | 3 < 5 (true) | Less than > | 6 | 3 > 5 (false) | Greater than <= | 6 | 3 <= 3 (true) | Less than or equal >= | 6 | 3 >= 3 (true) | Greater than or equal in | 7 | "foo" in [ "foo", "bar" ] (true) | Element contained in array !in | 7 | "foo" !in [ "bar", "baz" ] (true) | Element not contained in array == | 8 | "hello" == "hello" (true), 3 == 5 (false) | Equal to != | 8 | "hello" != "world" (true), 3 != 3 (false) | Not equal to & | 9 | 7 & 3 (3) | Binary AND ^ | 10 | 17 ^ 12 (29) | Bitwise XOR | | 11 | 2 | 3 (3) | Binary OR && | 13 | true && false (false), 3 && 7 (7), 0 && 7 (0) | Logical AND || | 14 | true || false (true), 0 || 7 (7)| Logical OR = | 12 | a = 3 | Assignment => | 15 | x => x * x (function with arg x) | Lambda, for loop ### Function Calls Functions can be called using the `()` operator: const MyGroups = [ "test1", "test" ] { check_interval = len(MyGroups) * 1m } A list of available functions is available in the [Library Reference](19-library-reference.md#library-reference) chapter. ## Assignments In addition to the `=` operator shown above a number of other operators to manipulate attributes are supported. Here's a list of all available operators: ### Operator = Sets an attribute to the specified value. Example: { a = 5 a = 7 } In this example `a` has the value `7` after both instructions are executed. ### Operator += The += operator is a shortcut. The following expression: { a = [ "hello" ] a += [ "world" ] } is equivalent to: { a = [ "hello" ] a = a + [ "world" ] } ### Operator -= The -= operator is a shortcut. The following expression: { a = 10 a -= 5 } is equivalent to: { a = 10 a = a - 5 } ### Operator \*= The *= operator is a shortcut. The following expression: { a = 60 a *= 5 } is equivalent to: { a = 60 a = a * 5 } ### Operator /= The /= operator is a shortcut. The following expression: { a = 300 a /= 5 } is equivalent to: { a = 300 a = a / 5 } ## Indexer The indexer syntax provides a convenient way to set dictionary elements. Example: { hello.key = "world" } Example (alternative syntax): { hello["key"] = "world" } This is equivalent to writing: { hello += { key = "world" } } If the `hello` attribute does not already have a value it is automatically initialized to an empty dictionary. ## Template Imports Objects can import attributes from other objects. Example: template Host "default-host" { vars.colour = "red" } template Host "test-host" { import "default-host" vars.colour = "blue" } object Host "localhost" { import "test-host" address = "127.0.0.1" address6 = "::1" } The `default-host` and `test-host` objects are marked as templates using the `template` keyword. Unlike ordinary objects templates are not instantiated at run-time. Parent objects do not necessarily have to be templates, however in general they are. The `vars` dictionary for the `localhost` object contains all three custom attributes and the custom attribute `colour` has the value `"blue"`. Parent objects are resolved in the order they're specified using the `import` keyword. ## Constants Global constants can be set using the `const` keyword: const VarName = "some value" Once defined a constant can be accessed from any file. Constants cannot be changed once they are set. Icinga 2 provides a number of special global constants. Some of them can be overridden using the `--define` command line parameter: Variable |Description --------------------|------------------- PrefixDir |**Read-only.** Contains the installation prefix that was specified with cmake -DCMAKE_INSTALL_PREFIX. Defaults to "/usr/local". SysconfDir |**Read-only.** Contains the path of the sysconf directory. Defaults to PrefixDir + "/etc". ZonesDir |**Read-only.** Contains the path of the zones.d directory. Defaults to SysconfDir + "/zones.d". LocalStateDir |**Read-only.** Contains the path of the local state directory. Defaults to PrefixDir + "/var". RunDir |**Read-only.** Contains the path of the run directory. Defaults to LocalStateDir + "/run". PkgDataDir |**Read-only.** Contains the path of the package data directory. Defaults to PrefixDir + "/share/icinga2". StatePath |**Read-write.** Contains the path of the Icinga 2 state file. Defaults to LocalStateDir + "/lib/icinga2/icinga2.state". ObjectsPath |**Read-write.** Contains the path of the Icinga 2 objects file. Defaults to LocalStateDir + "/cache/icinga2/icinga2.debug". PidPath |**Read-write.** Contains the path of the Icinga 2 PID file. Defaults to RunDir + "/icinga2/icinga2.pid". Vars |**Read-write.** Contains a dictionary with global custom attributes. Not set by default. NodeName |**Read-write.** Contains the cluster node name. Set to the local hostname by default. UseVfork |**Read-write.** Whether to use vfork(). Only available on *NIX. Defaults to true. AttachDebugger |**Read-write.** Whether to attach a debugger when Icinga 2 crashes. Defaults to false. RunAsUser |**Read-write.** Defines the user the Icinga 2 daemon is running as. Used in the `init.conf` configuration file. RunAsGroup |**Read-write.** Defines the group the Icinga 2 daemon is running as. Used in the `init.conf` configuration file. PlatformName |**Read-only.** The name of the operating system, e.g. "Ubuntu". PlatformVersion |**Read-only.** The version of the operating system, e.g. "14.04.3 LTS". PlatformKernel |**Read-only.** The name of the operating system kernel, e.g. "Linux". PlatformKernelVersion|**Read-only.** The version of the operating system kernel, e.g. "3.13.0-63-generic". ## Apply The `apply` keyword can be used to create new objects which are associated with another group of objects. apply Service "ping" to Host { import "generic-service" check_command = "ping4" assign where host.name == "localhost" } In this example the `assign where` condition is a boolean expression which is evaluated for all objects of type `Host` and a new service with name "ping" is created for each matching host. [Expression operators](18-language-reference.md#expression-operators) may be used in `assign where` conditions. The `to` keyword and the target type may be omitted if there is only one target type, e.g. for the `Service` type. Depending on the object type used in the `apply` expression additional local variables may be available for use in the `where` condition: Source Type | Target Type | Variables ------------------|-------------|-------------- Service | Host | host Dependency | Host | host Dependency | Service | host, service Notification | Host | host Notification | Service | host, service ScheduledDowntime | Host | host ScheduledDowntime | Service | host, service Any valid config attribute can be accessed using the `host` and `service` variables. For example, `host.address` would return the value of the host's "address" attribute - or null if that attribute isn't set. More usage examples are documented in the [monitoring basics](3-monitoring-basics.md#using-apply-expressions) chapter. ## Apply For [Apply](18-language-reference.md#apply) rules can be extended with the [for loop](18-language-reference.md#for-loops) keyword. apply Service "prefix-" for (key => value in host.vars.dictionary) to Host { import "generic-service" check_command = "ping4" vars.host_value = value } Any valid config attribute can be accessed using the `host` and `service` variables. The attribute must be of the Array or Dictionary type. In this example `host.vars.dictionary` is of the Dictionary type which needs a key-value-pair as iterator. In this example all generated service object names consist of `prefix-` and the value of the `key` iterator. The prefix string can be omitted if not required. The `key` and `value` variables can be used for object attribute assignment, e.g. for setting the `check_command` attribute or custom attributes as command parameters. `apply for` rules are first evaluated against all objects matching the `for loop` list and afterwards the `assign where` and `ignore where` conditions are evaluated. It is not necessary to check attributes referenced in the `for loop` expression for their existance using an additional `assign where` condition. More usage examples are documented in the [monitoring basics](3-monitoring-basics.md#using-apply-for) chapter. ## Group Assign Group objects can be assigned to specific member objects using the `assign where` and `ignore where` conditions. object HostGroup "linux-servers" { display_name = "Linux Servers" assign where host.vars.os == "Linux" } In this example the `assign where` condition is a boolean expression which is evaluated for all objects of the type `Host`. Each matching host is added as member to the host group with the name "linux-servers". Membership exclusion can be controlled using the `ignore where` condition. [Expression operators](18-language-reference.md#expression-operators) may be used in `assign where` and `ignore where` conditions. Source Type | Variables ------------------|-------------- HostGroup | host ServiceGroup | host, service UserGroup | user ## Boolean Values The `assign where`, `ignore where`, `if` and `while` statements, the `!` operator as well as the `bool()` function convert their arguments to a boolean value based on the following rules: Description | Example Value | Boolean Value ---------------------|-------------------|-------------- Empty value | null | false Zero | 0 | false Non-zero integer | -23945 | true Empty string | "" | false Non-empty string | "Hello" | true Empty array | [] | false Non-empty array | [ "Hello" ] | true Empty dictionary | {} | false Non-empty dictionary | { key = "value" } | true For a list of supported expression operators for `assign where` and `ignore where` statements, see [expression operators](18-language-reference.md#expression-operators). ## Comments The Icinga 2 configuration format supports C/C++-style and shell-style comments. Example: /* This is a comment. */ object Host "localhost" { check_interval = 30 // this is also a comment. retry_interval = 15 # yet another comment } ## Includes Other configuration files can be included using the `include` directive. Paths must be relative to the configuration file that contains the `include` directive. Example: include "some/other/file.conf" include "conf.d/*.conf" Wildcard includes are not recursive. Icinga also supports include search paths similar to how they work in a C/C++ compiler: include Note the use of angle brackets instead of double quotes. This causes the config compiler to search the include search paths for the specified file. By default $PREFIX/share/icinga2/include is included in the list of search paths. Additional include search paths can be added using [command-line options](8-cli-commands.md#config-include-path). Wildcards are not permitted when using angle brackets. ## Recursive Includes The `include_recursive` directive can be used to recursively include all files in a directory which match a certain pattern. Example: include_recursive "conf.d", "*.conf" include_recursive "templates" The first parameter specifies the directory from which files should be recursively included. The file names need to match the pattern given in the second parameter. When no pattern is specified the default pattern "*.conf" is used. ## Zone Includes The `include_zones` recursively includes all subdirectories for the given path. In addition to that it sets the `zone` attribute for all objects created in these subdirectories to the name of the subdirectory. Example: include_zones "etc", "zones.d", "*.conf" include_zones "puppet", "puppet-zones" The first parameter specifies a tag name for this directive. Each `include_zones` invocation should use a unique tag name. When copying the zones' configuration files Icinga uses the tag name as the name for the destination directory in `/var/lib/icinga2/api/config`. The second parameter specifies the directory which contains the subdirectories. The file names need to match the pattern given in the third parameter. When no pattern is specified the default pattern "*.conf" is used. ## Library directive The `library` directive can be used to manually load additional libraries. Libraries can be used to provide additional object types and functions. Example: library "snmphelper" ## Functions Functions can be defined using the `function` keyword. Example: function multiply(a, b) { return a * b } When encountering the `return` keyword further execution of the function is terminated and the specified value is supplied to the caller of the function: log(multiply(3, 5)) In this example the `multiply` function we declared earlier is invoked with two arguments (3 and 5). The function computes the product of those arguments and makes the result available to the function's caller. When no value is supplied for the `return` statement the function returns `null`. Functions which do not have a `return` statement have their return value set to the value of the last expression which was performed by the function. For example, we could have also written our `multiply` function like this: function multiply(a, b) { a * b } Anonymous functions can be created by omitting the name in the function definition. The resulting function object can be used like any other value: var fn = function() { 3 } fn() /* Returns 3 */ ## Lambda Expressions Functions can also be declared using the alternative lambda syntax. Example: f = (x) => x * x Multiple statements can be used by putting the function body into braces: f = (x) => { log("Lambda called") x * x } Just like with ordinary functions the return value is the value of the last statement. For lambdas which take exactly one argument the braces around the arguments can be omitted: f = x => x * x ## Abbreviated Lambda Syntax Lambdas which take no arguments can also be written using the abbreviated lambda syntax. Example: f = {{ 3 }} This creates a new function which returns the value 3. ## Variable Scopes When setting a variable Icinga checks the following scopes in this order whether the variable already exists there: * Local Scope * `this` Scope * Global Scope The local scope contains variables which only exist during the invocation of the current function, object or apply statement. Local variables can be declared using the `var` keyword: function multiply(a, b) { var temp = a * b return temp } Each time the `multiply` function is invoked a new `temp` variable is used which is in no way related to previous invocations of the function. When setting a variable which has not previously been declared as local using the `var` keyword the `this` scope is used. The `this` scope refers to the current object which the function or object/apply statement operates on. object Host "localhost" { check_interval = 5m } In this example the `this` scope refers to the "localhost" object. The `check_interval` attribute is set for this particular host. You can explicitly access the `this` scope using the `this` keyword: object Host "localhost" { var check_interval = 5m /* This explicitly specifies that the attribute should be set * for the host, if we had omitted `this.` the (poorly named) * local variable `check_interval` would have been modified instead. */ this.check_interval = 1m } Similarly the keywords `locals` and `globals` are available to access the local and global scope. Functions also have a `this` scope. However unlike for object/apply statements the `this` scope for a function is set to whichever object was used to invoke the function. Here's an example: hm = { h_word = null function init(word) { h_word = word } } /* Let's invoke the init() function */ hm.init("hello") We're using `hm.init` to invoke the function which causes the value of `hm` to become the `this` scope for this function call. ## Closures By default `function`s, `object`s and `apply` rules do not have access to variables declared outside of their scope (except for global variables). In order to access variables which are defined in the outer scope the `use` keyword can be used: function MakeHelloFunction(name) { return function() use(name) { log("Hello, " + name) } } In this case a new variable `name` is created inside the inner function's scope which has the value of the `name` function argument. Alternatively a different value for the inner variable can be specified: function MakeHelloFunction(name) { return function() use (greeting = "Hello, " + name) { log(greeting) } } ## Conditional Statements Sometimes it can be desirable to only evaluate statements when certain conditions are met. The if/else construct can be used to accomplish this. Example: a = 3 if (a < 5) { a *= 7 } else if (a > 10) { a *= 5 } else { a *= 2 } An if/else construct can also be used in place of any other value. The value of an if/else statement is the value of the last statement which was evaluated for the branch which was taken: a = if (true) { log("Taking the 'true' branch") 7 * 3 } else { log("Taking the 'false' branch") 9 } This example prints the log message "Taking the 'true' branch" and the `a` variable is set to 21 (7 * 3). The value of an if/else construct is null if the condition evaluates to false and no else branch is given. ## While Loops The `while` statement checks a condition and executes the loop body when the condition evaluates to `true`. This is repeated until the condition is no longer true. Example: var num = 5 while (num > 5) { log("Test") num -= 1 } The `continue` and `break` keywords can be used to control how the loop is executed: The `continue` keyword skips over the remaining expressions for the loop body and begins the next loop evaluation. The `break` keyword breaks out of the loop. ## For Loops The `for` statement can be used to iterate over arrays and dictionaries. Example: var list = [ "a", "b", "c" ] for (item in list) { log("Item: " + item) } The loop body is evaluated once for each item in the array. The variable `item` is declared as a local variable just as if the `var` keyword had been used. Iterating over dictionaries can be accomplished in a similar manner: var dict = { a = 3, b = 7 } for (key => value in dict) { log("Key: " + key + ", Value: " + value) } The `continue` and `break` keywords can be used to control how the loop is executed: The `continue` keyword skips over the remaining expressions for the loop body and begins the next loop evaluation. The `break` keyword breaks out of the loop. ## Constructors In order to create a new value of a specific type constructor calls may be used. Example: var pd = PerfdataValue() pd.label = "test" pd.value = 10 You can also try to convert an existing value to another type by specifying it as an argument for the constructor call. Example: var s = String(3) /* Sets s to "3". */ ## Exceptions Built-in commands may throw exceptions to signal errors such as invalid arguments. User scripts can throw exceptions using the `throw` keyword. Example: throw "An error occurred." There is currently no way for scripts to catch exceptions. ## Breakpoints The `debugger` keyword can be used to insert a breakpoint. It may be used at any place where an assignment would also be a valid expression. By default breakpoints have no effect unless Icinga is started with the `--script-debugger` command-line option. When the script debugger is enabled Icinga stops execution of the script when it encounters a breakpoint and spawns a console which lets the user inspect the current state of the execution environment. ## Types All values have a static type. The `typeof` function can be used to determine the type of a value: typeof(3) /* Returns an object which represents the type for numbers */ The following built-in types are available: Type | Examples | Description -----------|-------------------|------------------------ Number | 3.7 | A numerical value. Boolean | true, false | A boolean value. String | "hello" | A string. Array | [ "a", "b" ] | An array. Dictionary | { a = 3 } | A dictionary. Depending on which libraries are loaded additional types may become available. The `icinga` library implements a whole bunch of other [object types](6-object-types.md#object-types), e.g. Host, Service, CheckCommand, etc. Each type has an associated type object which describes the type's semantics. These type objects are made available using global variables which match the type's name: /* This logs 'true' */ log(typeof(3) == Number) The type object's `prototype` property can be used to find out which methods a certain type supports: /* This returns: ["contains","find","len","lower","replace","reverse","split","substr","to_string","upper"] */ keys(String.prototype) Additional documentation on type methods is available in the [library reference](19-library-reference.md#library-reference). ## Location Information The location of the currently executing script can be obtained using the `current_filename` and `current_line` keywords. Example: log("Hello from '" + current_filename + "' in line " + current_line) ## Reserved Keywords These keywords are reserved and must not be used as constants or custom attributes. object template include include_recursive ignore_on_error library null true false const var this use apply to where import assign ignore function return for if else in current_filename current_line You can escape reserved keywords using the `@` character. The following example tries to set `vars.include` which references a reserved keyword and generates an error: [2014-09-15 17:24:00 +0200] critical/config: Location: /etc/icinga2/conf.d/hosts/localhost.conf(13): vars.sla = "24x7" /etc/icinga2/conf.d/hosts/localhost.conf(14): /etc/icinga2/conf.d/hosts/localhost.conf(15): vars.include = "some cmdb export field" ^^^^^^^ /etc/icinga2/conf.d/hosts/localhost.conf(16): } /etc/icinga2/conf.d/hosts/localhost.conf(17): Config error: in /etc/icinga2/conf.d/hosts/localhost.conf: 15:8-15:14: syntax error, unexpected include (T_INCLUDE), expecting T_IDENTIFIER [2014-09-15 17:24:00 +0200] critical/config: 1 errors, 0 warnings. You can escape the `include` keyword by prefixing it with an additional `@` character: object Host "localhost" { import "generic-host" address = "127.0.0.1" address6 = "::1" vars.os = "Linux" vars.sla = "24x7" vars.@include = "some cmdb export field" } icinga2-2.4.1/doc/19-library-reference.md000066400000000000000000000440121262555626500177670ustar00rootroot00000000000000# Library Reference ## Global functions Function | Description --------------------------------|----------------------- regex(pattern, text) | Returns true if the regex pattern matches the text, false otherwise. match(pattern, text) | Returns true if the wildcard pattern matches the text, false otherwise. cidr_match(pattern, ip) | Returns true if the CIDR pattern matches the IP address, false otherwise. IPv4 addresses are converted to IPv4-mapped IPv6 addresses before being matched against the pattern. len(value) | Returns the length of the value, i.e. the number of elements for an array or dictionary, or the length of the string in bytes. union(array, array, ...) | Returns an array containing all unique elements from the specified arrays. intersection(array, array, ...) | Returns an array containing all unique elements which are common to all specified arrays. keys(dict) | Returns an array containing the dictionary's keys. string(value) | Converts the value to a string. number(value) | Converts the value to a number. bool(value) | Converts the value to a bool. random() | Returns a random value between 0 and RAND_MAX (as defined in stdlib.h). log(value) | Writes a message to the log. Non-string values are converted to a JSON string. log(severity, facility, value) | Writes a message to the log. `severity` can be one of `LogDebug`, `LogNotice`, `LogInformation`, `LogWarning`, and `LogCritical`. Non-string values are converted to a JSON string. typeof(value) | Returns the [Type](19-library-reference.md#type-type) object for a value. get_time() | Returns the current UNIX timestamp. parse_performance_data(pd) | Parses a performance data string and returns an array describing the values. dirname(path) | Returns the directory portion of the specified path. basename(path) | Returns the filename portion of the specified path. escape\_shell\_arg(text) | Escapes a string for use as a single shell argument. escape\_shell\_cmd(text) | Escapes shell meta characters in a string. escape\_create\_process\_arg(text)| (Windows only) Escapes a string for use as an argument for CreateProcess(). exit(integer) | Terminates the application. ## Object Accessor Functions These functions can be used to retrieve a reference to another object by name. ### get_check_command Signature: function get_check_command(name); Returns the CheckCommand object with the specified name, or `null` if no such CheckCommand object exists. ### get_event_command Signature: function get_event_command(name); Returns the EventCommand object with the specified name, or `null` if no such EventCommand object exists. ### get_notification_command Signature: function get_notification_command(name); Returns the NotificationCommand object with the specified name, or `null` if no such NotificationCommand object exists. ### get_host Signature: function get_host(host_name); Returns the Host object with the specified name, or `null` if no such Host object exists. ### get_service Signature: function get_service(host_name, service_name); Returns the Service object with the specified name, or `null` if no such Service object exists. ### get_user Signature: function get_user(name); Returns the User object with the specified name, or `null` if no such User object exists. ### get_host_group Signature: function get_host_group(name); Returns the HostGroup object with the specified name, or `null` if no such HostGroup object exists. ### get_service_group Signature: function get_service_group(name); Returns the ServiceGroup object with the specified name, or `null` if no such ServiceGroup object exists. ### get_user_group Signature: function get_user_group(name); Returns the UserGroup object with the specified name, or `null` if no such UserGroup object exists. ### get_time_period Signature: function get_time_period(name); Returns the TimePeriod object with the specified name, or `null` if no such TimePeriod object exists. ### get_object Signature: function get_object(type, name); Returns the object with the specified type and name, or `null` if no such object exists. `type` must refer to a type object. ### get_objects Signature: function get_objects(type); Returns an array of objects whose type matches the specified type. `type` must refer to a type object. ## Math object The global `Math` object can be used to access a number of mathematical constants and functions. ### Math.E Euler's constant. ### Math.LN2 Natural logarithm of 2. ### Math.LN10 Natural logarithm of 10. ### Math.LOG2E Base 2 logarithm of E. ### Math.PI The mathematical constant Pi. ### Math.SQRT1_2 Square root of 1/2. ### Math.SQRT2 Square root of 2. ### Math.abs Signature: function abs(x); Returns the absolute value of `x`. ### Math.acos Signature: function acos(x); Returns the arccosine of `x`. ### Math.asin Signature: function asin(x); Returns the arcsine of `x`. ### Math.atan Signature: function atan(x); Returns the arctangent of `x`. ### Math.atan2 Signature: function atan2(y, x); Returns the arctangent of the quotient of `y` and `x`. ### Math.ceil Signature: function ceil(x); Returns the smallest integer value not less than `x`. ### Math.cos Signature: function cos(x); Returns the cosine of `x`. ### Math.exp Signature: function exp(x); Returns E raised to the `x`th power. ### Math.floor Signature: function floor(x); Returns the largest integer value not greater than `x`. ### Math.isinf Signature: function isinf(x); Returns whether `x` is infinite. ### Math.isnan Signature: function isnan(x); Returns whether `x` is NaN (not-a-number). ### Math.log Signature: function log(x); Returns the natural logarithm of `x`. ### Math.max Signature: function max(...); Returns the largest argument. A variable number of arguments can be specified. If no arguments are given -Infinity is returned. ### Math.min Signature: function min(...); Returns the smallest argument. A variable number of arguments can be specified. If no arguments are given +Infinity is returned. ### Math.pow Signature: function pow(x, y); Returns `x` raised to the `y`th power. ### Math.random Signature: function random(); Returns a pseudo-random number between 0 and 1. ### Math.round Signature: function round(x); Returns `x` rounded to the nearest integer value. ### Math.sign Signature: function sign(x); Returns -1 if `x` is negative, 1 if `x` is positive and 0 if `x` is 0. ### Math.sin Signature: function sin(x); Returns the sine of `x`. ### Math.sqrt Signature: function sqrt(x); Returns the square root of `x`. ### Math.tan Signature: function tan(x); Returns the tangent of `x`. ## Json object The global `Json` object can be used to encode and decode JSON. ### Json.encode Signature: function encode(x); Encodes an arbitrary value into JSON. ### Json.decode Signature: function decode(x); Decodes a JSON string. ## Number type ### Number#to_string Signature: function to_string(); The `to_string` method returns a string representation of the number. Example: var example = 7 example.to_string() /* Returns "7" */ ## Boolean type ### Boolean#to_string Signature: function to_string(); The `to_string` method returns a string representation of the boolean value. Example: var example = true example.to_string() /* Returns "true" */ ## String type ### String#find Signature: function find(str, start); Returns the zero-based index at which the string `str` was found in the string. If the string was not found -1 is returned. `start` specifies the zero-based index at which `find` should start looking for the string (defaults to 0 when not specified). Example: "Hello World".find("World") /* Returns 6 */ ### String#contains Signature: function contains(str); Returns `true` if the string `str` was found in the string. If the string was not found `false` is returned. Use [find](19-library-reference.md#string-find) for getting the index instead. Example: "Hello World".contains("World") /* Returns true */ ### String#len Signature function len(); Returns the length of the string in bytes. Note that depending on the encoding type of the string this is not necessarily the number of characters. Example: "Hello World".len() /* Returns 11 */ ### String#lower Signature: function lower(); Returns a copy of the string with all of its characters converted to lower-case. Example: "Hello World".lower() /* Returns "hello world" */ ### String#upper Signature: function upper(); Returns a copy of the string with all of its characters converted to upper-case. Example: "Hello World".upper() /* Returns "HELLO WORLD" */ ### String#replace Signature: function replace(search, replacement); Returns a copy of the string with all occurences of the string specified in `search` replaced with the string specified in `replacement`. ### String#split Signature: function split(delimiters); Splits a string into individual parts and returns them as an array. The `delimiters` argument specifies the characters which should be used as delimiters between parts. Example: "x-7,y".split("-,") /* Returns [ "x", "7", "y" ] */ ### String#substr Signature: function substr(start, len); Returns a part of a string. The `start` argument specifies the zero-based index at which the part begins. The optional `len` argument specifies the length of the part ("until the end of the string" if omitted). Example: "Hello World".substr(6) /* Returns "World" */ ### String#to_string Signature: function to_string(); Returns a copy of the string. ### String#reverse Signature: function reverse(); Returns a copy of the string in reverse order. ## Object type This is the base type for all types in the Icinga application. ### Object#clone Signature: function clone(); Returns a copy of the object. Note that for object elements which are reference values (e.g. objects such as arrays or dictionaries) the entire object is recursively copied. ## Object#to_string Signature: function to_string(); Returns a string representation for the object. Unless overridden this returns a string of the format "Object of type ''" where is the name of the object's type. Example: [ 3, true ].to_string() /* Returns "[ 3.000000, true ]" */ ## Object#type Signature: String type; Returns the object's type name. This attribute is read-only. Example: get_host("localhost").type /* Returns "Host" */ ## Type type Inherits methods from the [Object type](19-library-reference.md#object-type). The `Type` type provides information about the underlying type of an object or scalar value. All types are registered as global variables. For example, in order to obtain a reference to the `String` type the global variable `String` can be used. ### Type#base Signature: Type base; Returns a reference to the type's base type. This attribute is read-only. Example: Dictionary.base == Object /* Returns true, because the Dictionary type inherits directly from the Object type. */ ### Type#name Signature: String name; Returns the name of the type. ### Type#prototype Signature: Object prototype; Returns the prototype object for the type. When an attribute is accessed on an object that doesn't exist the prototype object is checked to see if an attribute with the requested name exists there. If it does that attribute's value is returned. The prototype functionality is used to implement methods. Example: 3.to_string() /* Even though '3' does not have a to_string property the Number type's prototype object does. */ ## Array type Inherits methods from the [Object type](19-library-reference.md#object-type). ### Array#add Signature: function add(value); Adds a new value after the last element in the array. ### Array#clear Signature: function clear(); Removes all elements from the array. ### Array#shallow_clone function shallow_clone(); Returns a copy of the array. Note that for elements which are reference values (e.g. objects such as arrays and dictionaries) only the references are copied. ### Array#contains Signature: function contains(value); Returns true if the array contains the specified value, false otherwise. ### Array#len Signature: function len(); Returns the number of elements contained in the array. ### Array#remove Signature: function remove(index); Removes the element at the specified zero-based index. ### Array#set Signature: function set(index, value); Sets the element at the zero-based index to the specified value. The `index` must refer to an element which already exists in the array. ### Array#get Signature: function get(index); Retrieves the element at the specified zero-based index. ### Array#sort Signature: function sort(less_cmp); Returns a copy of the array where all items are sorted. The items are compared using the `<` (less-than) operator. A custom comparator function can be specified with the `less_cmp` argument. ### Array#join Signature: function join(separator); Joins all elements of the array using the specified separator. ### Array#reverse Signature: function reverse(); Returns a new array with all elements of the current array in reverse order. ## Dictionary type Inherits methods from the [Object type](19-library-reference.md#object-type). ### Dictionary#shallow_clone Signature: function shallow_clone(); Returns a copy of the dictionary. Note that for elements which are reference values (e.g. objects such as arrays and dictionaries) only the references are copied. ### Dictionary#contains Signature: function contains(key); Returns true if a dictionary item with the specified `key` exists, false otherwise. ### Dictionary#len Signature: function len(); Returns the number of items contained in the dictionary. ### Dictionary#remove Signature: function remove(key); Removes the item with the specified `key`. Trying to remove an item which does not exist is a no-op. ### Dictionary#set Signature: function set(key, value); Creates or updates an item with the specified `key` and `value`. ### Dictionary#get Signature: function get(key); Retrieves the value for the specified `key`. Returns `null` if they `key` does not exist in the dictionary. ### Dictionary#keys Signature: function keys(); Returns a list of keys for all items that are currently in the dictionary. ## Function type ### Function#call Signature: function call(thisArg, ...); Invokes the function using an alternative `this` scope. The `thisArg` argument specifies the `this` scope for the function. All other arguments are passed directly to the function. Example: function set_x(val) { this.x = val } dict = {} set_x.call(dict, 7) /* Invokes set_x using `dict` as `this` */ ### Function#callv Signature: function callv(thisArg, args); Invokes the function using an alternative `this` scope. The `thisArg` argument specifies the `this` scope for the function. The items in the `args` array are passed to the function as individual arguments. Example: function set_x(val) { this.x = val } var dict = {} var args = [ 7 ] set_x.callv(dict, args) /* Invokes set_x using `dict` as `this` */ icinga2-2.4.1/doc/2-getting-started.md000066400000000000000000000601471262555626500174130ustar00rootroot00000000000000# Getting Started This tutorial is a step-by-step introduction to installing [Icinga 2](2-getting-started.md#setting-up-icinga2) and [Icinga Web 2](2-getting-started.md#setting-up-the-user-interface). It assumes that you are familiar with the operating system you're using to install Icinga 2. ## Setting up Icinga 2 First off you will have to install Icinga 2. The preferred way of doing this is to use the official package repositories depending on which operating system and distribution you are running. Distribution | Repository ------------------------|--------------------------- Debian | [debmon](http://debmon.org/packages/debmon-jessie/icinga2), [Icinga Repository](http://packages.icinga.org/debian/) Ubuntu | [Icinga PPA](https://launchpad.net/~formorer/+archive/ubuntu/icinga), [Icinga Repository](http://packages.icinga.org/ubuntu/) RHEL/CentOS | [Icinga Repository](http://packages.icinga.org/epel/) openSUSE | [Icinga Repository](http://packages.icinga.org/openSUSE/), [Server Monitoring Repository](https://build.opensuse.org/package/show/server:monitoring/icinga2) SLES | [Icinga Repository](http://packages.icinga.org/SUSE/) Gentoo | [Upstream](http://packages.gentoo.org/package/net-analyzer/icinga2) FreeBSD | [Upstream](http://www.freshports.org/net-mgmt/icinga2) ArchLinux | [Upstream](https://aur.archlinux.org/packages/icinga2) Packages for distributions other than the ones listed above may also be available. Please contact your distribution packagers. ### Package Repositories You need to add the Icinga repository to your package management configuration. Below is a list with examples for the various distributions. Debian (debmon): # wget -O - http://debmon.org/debmon/repo.key 2>/dev/null | apt-key add - # echo 'deb http://debmon.org/debmon debmon-jessie main' >/etc/apt/sources.list.d/debmon.list # apt-get update Ubuntu (PPA): # add-apt-repository ppa:formorer/icinga # apt-get update RHEL/CentOS: # rpm --import http://packages.icinga.org/icinga.key # curl -o /etc/yum.repos.d/ICINGA-release.repo http://packages.icinga.org/epel/ICINGA-release.repo # yum makecache The packages for RHEL/CentOS depend on other packages which are distributed as part of the [EPEL repository](http://fedoraproject.org/wiki/EPEL). Please make sure to enable this repository by following [these instructions](http://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F). Fedora: # rpm --import http://packages.icinga.org/icinga.key # curl -o /etc/yum.repos.d/ICINGA-release.repo http://packages.icinga.org/fedora/ICINGA-release.repo # yum makecache SLES 11: # zypper ar http://packages.icinga.org/SUSE/ICINGA-release-11.repo # zypper ref The packages for SLES 11 depend on the `openssl1` package which is distributed as part of the [SLES 11 Security Module](https://www.suse.com/communities/conversations/introducing-the-suse-linux-enterprise-11-security-module/). SLES 12: # zypper ar http://packages.icinga.org/SUSE/ICINGA-release.repo # zypper ref openSUSE: # zypper ar http://packages.icinga.org/openSUSE/ICINGA-release.repo # zypper ref ### Installing Icinga 2 You can install Icinga 2 by using your distribution's package manager to install the `icinga2` package. Debian/Ubuntu: # apt-get install icinga2 RHEL/CentOS 5/6: # yum install icinga2 # chkconfig icinga2 on # service icinga2 start RHEL/CentOS 7 and Fedora: # yum install icinga2 # systemctl enable icinga2 # systemctl start icinga2 SLES/openSUSE: # zypper install icinga2 FreeBSD: # pkg install icinga2 ### Enabled Features during Installation The default installation will enable three features required for a basic Icinga 2 installation: * `checker` for executing checks * `notification` for sending notifications * `mainlog` for writing the `icinga2.log` file You can verify that by calling `icinga2 feature list` [CLI command](8-cli-commands.md#cli-command-feature) to see which features are enabled and disabled. # icinga2 feature list Disabled features: api command compatlog debuglog graphite icingastatus ido-mysql ido-pgsql livestatus notification perfdata statusdata syslog Enabled features: checker mainlog notification ### Installation Paths By default Icinga 2 uses the following files and directories: Path | Description ------------------------------------|------------------------------------ /etc/icinga2 | Contains Icinga 2 configuration files. /etc/init.d/icinga2 | The Icinga 2 init script. /usr/sbin/icinga2 | The Icinga 2 binary. /usr/share/doc/icinga2 | Documentation files that come with Icinga 2. /usr/share/icinga2/include | The Icinga Template Library and plugin command configuration. /var/run/icinga2 | PID file. /var/run/icinga2/cmd | Command pipe and Livestatus socket. /var/cache/icinga2 | status.dat/objects.cache, icinga2.debug files /var/spool/icinga2 | Used for performance data spool files. /var/lib/icinga2 | Icinga 2 state file, cluster log, local CA and configuration files. /var/log/icinga2 | Log file location and compat/ directory for the CompatLogger feature. FreeBSD uses slightly different paths: By default Icinga 2 uses the following files and directories: Path | Description ------------------------------------|------------------------------------ /usr/local/etc/icinga2 | Contains Icinga 2 configuration files. /usr/local/etc/rc.d/icinga2 | The Icinga 2 init script. /usr/local/sbin/icinga2 | The Icinga 2 binary. /usr/local/share/doc/icinga2 | Documentation files that come with Icinga 2. /usr/local/share/icinga2/include | The Icinga Template Library and plugin command configuration. /var/run/icinga2 | PID file. /var/run/icinga2/cmd | Command pipe and Livestatus socket. /var/cache/icinga2 | status.dat/objects.cache, icinga2.debug files /var/spool/icinga2 | Used for performance data spool files. /var/lib/icinga2 | Icinga 2 state file, cluster log, local CA and configuration files. /var/log/icinga2 | Log file location and compat/ directory for the CompatLogger feature. ## Setting up Check Plugins Without plugins Icinga 2 does not know how to check external services. The [Monitoring Plugins Project](https://www.monitoring-plugins.org/) provides an extensive set of plugins which can be used with Icinga 2 to check whether services are working properly. The recommended way of installing these standard plugins is to use your distribution's package manager. For your convenience here is a list of package names for some of the more popular operating systems/distributions: OS/Distribution | Package Name | Installation Path -----------------------|--------------------|--------------------------- RHEL/CentOS (EPEL) | nagios-plugins-all | /usr/lib/nagios/plugins or /usr/lib64/nagios/plugins Debian | nagios-plugins | /usr/lib/nagios/plugins FreeBSD | monitoring-plugins | /usr/local/libexec/nagios OS X (MacPorts) | nagios-plugins | /opt/local/libexec Depending on which directory your plugins are installed into you may need to update the global `PluginDir` constant in your [Icinga 2 configuration](4-configuring-icinga-2.md#constants-conf). This constant is used by the check command definitions contained in the Icinga Template Library to determine where to find the plugin binaries. Please refer to the [plugins](14-addons-plugins.md#plugins) chapter for details about how to integrate additional check plugins into your Icinga 2 setup. ## Running Icinga 2 ### Init Script Icinga 2's init script is installed in `/etc/init.d/icinga2` (`/usr/local/etc/rc.d/icinga2` on FreeBSD) by default: # /etc/init.d/icinga2 Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status} The init script supports the following actions: Command | Description --------------------|------------------------ start | The `start` action starts the Icinga 2 daemon. stop | The `stop` action stops the Icinga 2 daemon. restart | The `restart` action is a shortcut for running the `stop` action followed by `start`. reload | The `reload` action sends the `HUP` signal to Icinga 2 which causes it to restart. Unlike the `restart` action `reload` does not wait until Icinga 2 has restarted. checkconfig | The `checkconfig` action checks if the `/etc/icinga2/icinga2.conf` configuration file contains any errors. status | The `status` action checks if Icinga 2 is running. By default the Icinga 2 daemon is running as `icinga` user and group using the init script. Using Debian packages the user and group are set to `nagios` for historical reasons. ### systemd Service Some distributions (e.g. Fedora, openSUSE and RHEL/CentOS 7) use systemd. The Icinga 2 packages automatically install the necessary systemd unit files. The Icinga 2 systemd service can be (re-)started, reloaded, stopped and also queried for its current status. # systemctl status icinga2 icinga2.service - Icinga host/service/network monitoring system Loaded: loaded (/usr/lib/systemd/system/icinga2.service; disabled) Active: active (running) since Mi 2014-07-23 13:39:38 CEST; 15s ago Process: 21692 ExecStart=/usr/sbin/icinga2 -c ${ICINGA2_CONFIG_FILE} -d -e ${ICINGA2_ERROR_LOG} -u ${ICINGA2_USER} -g ${ICINGA2_GROUP} (code=exited, status=0/SUCCESS) Process: 21674 ExecStartPre=/usr/sbin/icinga2-prepare-dirs /etc/sysconfig/icinga2 (code=exited, status=0/SUCCESS) Main PID: 21727 (icinga2) CGroup: /system.slice/icinga2.service 21727 /usr/sbin/icinga2 -c /etc/icinga2/icinga2.conf -d -e /var/log/icinga2/error.log -u icinga -g icinga --no-stack-rlimit Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 309 Service(s). Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 1 User(s). Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 15 Notification(s). Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 4 ScheduledDowntime(s). Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 1 UserGroup(s). Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 1 IcingaApplication(s). Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 8 Dependency(s). Jul 23 13:39:38 nbmif systemd[1]: Started Icinga host/service/network monitoring system. The `systemctl` command supports the following actions: Command | Description --------------------|------------------------ start | The `start` action starts the Icinga 2 daemon. stop | The `stop` action stops the Icinga 2 daemon. restart | The `restart` action is a shortcut for running the `stop` action followed by `start`. reload | The `reload` action sends the `HUP` signal to Icinga 2 which causes it to restart. Unlike the `restart` action `reload` does not wait until Icinga 2 has restarted. status | The `status` action checks if Icinga 2 is running. enable | The `enable` action enables the service being started at system boot time (similar to `chkconfig`) Examples: # systemctl enable icinga2 # systemctl restart icinga2 Job for icinga2.service failed. See 'systemctl status icinga2.service' and 'journalctl -xn' for details. If you're stuck with configuration errors, you can manually invoke the [configuration validation](8-cli-commands.md#config-validation). ### FreeBSD On FreeBSD you need to enable icinga2 in your rc.conf # sysrc icinga2_enable=yes # service icinga2 restart ## Configuration Syntax Highlighting Icinga 2 ships configuration examples for syntax highlighting using the `vim` and `nano` editors. The RHEL, SUSE and Debian package `icinga2-common` install these files into `/usr/share/*/icinga2-common/syntax`. Sources provide these files in `tools/syntax`. ### Configuration Syntax Highlighting using Vim Create a new local vim configuration storage, if not already existing. Edit `vim/ftdetect/icinga2.vim` if your paths to the Icinga 2 configuration differ. $ PREFIX=~/.vim $ mkdir -p $PREFIX/{syntax,ftdetect} $ cp vim/syntax/icinga2.vim $PREFIX/syntax/ $ cp vim/ftdetect/icinga2.vim $PREFIX/ftdetect/ Test it: $ vim /etc/icinga2/conf.d/templates.conf ### Configuration Syntax Highlighting using Nano Copy the `/etc/nanorc` sample file to your home directory. Create the `/etc/nano` directory and copy the provided `icinga2.nanorc` into it. $ cp /etc/nanorc ~/.nanorc # mkdir -p /etc/nano # cp icinga2.nanorc /etc/nano/ Then include the icinga2.nanorc file in your ~/.nanorc by adding the following line: $ vim ~/.nanorc ## Icinga 2 include "/etc/nano/icinga2.nanorc" Test it: $ nano /etc/icinga2/conf.d/templates.conf ## Setting up Icinga Web 2 Icinga 2 can be used with Icinga Web 2 and a number of other web interfaces. This chapter explains how to set up Icinga Web 2. The DB IDO (Database Icinga Data Output) modules for Icinga 2 take care of exporting all configuration and status information into a database. The IDO database is used by a number of projects including [Icinga Web 2](2-getting-started.md#setting-up-icingaweb2), Icinga Reporting or Icinga Web 1.x. There is a separate module for each database backend. At present support for both MySQL and PostgreSQL is implemented. ### Configuring DB IDO MySQL #### Installing MySQL database server Debian/Ubuntu: # apt-get install mysql-server mysql-client RHEL/CentOS 5/6: # yum install mysql-server mysql # chkconfig mysqld on # service mysqld start # mysql_secure_installation RHEL/CentOS 7 and Fedora: # yum install mariadb-server mariadb # systemctl enable mariadb # systemctl start mariadb # mysql_secure_installation SUSE: # zypper install mysql mysql-client # chkconfig mysqld on # service mysqld start FreeBSD: # pkg install mysql56-server # sysrc mysql_enable=yes # service mysql-server restart # mysql_secure_installation #### Installing the IDO modules for MySQL The next step is to install the `icinga2-ido-mysql` package using your distribution's package manager. Debian/Ubuntu: # apt-get install icinga2-ido-mysql RHEL/CentOS: # yum install icinga2-ido-mysql SUSE: # zypper install icinga2-ido-mysql FreeBSD: On FreeBSD the IDO modules for MySQL are included with the icinga2 package and located at /usr/local/share/icinga2-ido-mysql/schema/mysql.sql > **Note** > > The Debian/Ubuntu packages provide a database configuration wizard by > default. You can skip the automated setup and install/upgrade the > database manually if you prefer that. #### Setting up the MySQL database Set up a MySQL database for Icinga 2: # mysql -u root -p mysql> CREATE DATABASE icinga; GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga'; After creating the database you can import the Icinga 2 IDO schema using the following command: # mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql #### Enabling the IDO MySQL module The package provides a new configuration file that is installed in `/etc/icinga2/features-available/ido-mysql.conf`. You will need to update the database credentials in this file. All available attributes are explained in the [IdoMysqlConnection object](6-object-types.md#objecttype-idomysqlconnection) chapter. You can enable the `ido-mysql` feature configuration file using `icinga2 feature enable`: # icinga2 feature enable ido-mysql Module 'ido-mysql' was enabled. Make sure to restart Icinga 2 for these changes to take effect. After enabling the ido-mysql feature you have to restart Icinga 2: Debian/Ubuntu, RHEL/CentOS 6 and SUSE: # service icinga2 restart RHEL/CentOS 7 and Fedora: # systemctl restart icinga2 FreeBSD: # service icinga2 restart ### Configuring DB IDO PostgreSQL #### Installing PostgreSQL database server Debian/Ubuntu: # apt-get install postgresql RHEL/CentOS 5/6: # yum install postgresql-server postgresql # chkconfig postgresql on # service postgresql start RHEL/CentOS 7: # yum install postgresql-server postgresql # postgresql-setup --initdb # systemctl enable postgresql # systemctl start postgresql SUSE: # zypper install postgresql postgresql-server # chkconfig postgresql on # service postgresql start FreeBSD: # pkg install postgresql93-server # sysrc postgresql_enable=yes # service postgresql start #### Installing the IDO modules for PostgreSQL The next step is to install the `icinga2-ido-pgsql` package using your distribution's package manager. Debian/Ubuntu: # apt-get install icinga2-ido-pgsql RHEL/CentOS: # yum install icinga2-ido-pgsql SUSE: # zypper install icinga2-ido-pgsql FreeBSD: On FreeBSD the IDO modules for PostgreSQL are included with the icinga2 package and located at /usr/local/share/icinga2-ido-pgsql/schema/pgsql.sql > **Note** > > Upstream Debian packages provide a database configuration wizard by default. > You can skip the automated setup and install/upgrade the database manually > if you prefer that. #### Setting up the PostgreSQL database Set up a PostgreSQL database for Icinga 2: # cd /tmp # sudo -u postgres psql -c "CREATE ROLE icinga WITH LOGIN PASSWORD 'icinga'"; # sudo -u postgres createdb -O icinga -E UTF8 icinga # sudo -u postgres createlang plpgsql icinga > **Note** > > When using PostgreSQL 9.x you can omit the `createlang` command. Locate your pg_hba.conf (Debian: `/etc/postgresql/*/main/pg_hba.conf`, RHEL/SUSE: `/var/lib/pgsql/data/pg_hba.conf`), add the icinga user with md5 authentication method and restart the postgresql server. # vim /var/lib/pgsql/data/pg_hba.conf # icinga local icinga icinga md5 host icinga icinga 127.0.0.1/32 md5 host icinga icinga ::1/128 md5 # "local" is for Unix domain socket connections only local all all ident # IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident # service postgresql restart After creating the database and permissions you can import the Icinga 2 IDO schema using the following command: # export PGPASSWORD=icinga # psql -U icinga -d icinga < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql #### Enabling the IDO PostgreSQL module The package provides a new configuration file that is installed in `/etc/icinga2/features-available/ido-pgsql.conf`. You will need to update the database credentials in this file. All available attributes are explained in the [IdoPgsqlConnection object](6-object-types.md#objecttype-idopgsqlconnection) chapter. You can enable the `ido-pgsql` feature configuration file using `icinga2 feature enable`: # icinga2 feature enable ido-pgsql Module 'ido-pgsql' was enabled. Make sure to restart Icinga 2 for these changes to take effect. After enabling the ido-pgsql feature you have to restart Icinga 2: Debian/Ubuntu, RHEL/CentOS 6, SUSE and FreeBSD: # service icinga2 restart RHEL/CentOS 7 and Fedora: # systemctl restart icinga2 ### Webserver Debian/Ubuntu: # apt-get install apache2 RHEL/CentOS 6: # yum install httpd # chkconfig httpd on # service httpd start RHEL/CentOS 7/Fedora: # yum install httpd # systemctl enable httpd # systemctl start httpd SUSE: # zypper install apache2 # chkconfig on # service apache2 start FreeBSD (nginx, but you could also use the apache24 package): # pkg install nginx php56-gettext php56-ldap php56-openssl php56-mysql php56-pdo_mysql php56-pgsql php56-pdo_pgsql php56-sockets php56-gd pecl-imagick pecl-intl # sysrc php_fpm_enable=yes # sysrc nginx_enable=yes # sed -i '' "s/listen\ =\ 127.0.0.1:9000/listen\ =\ \/var\/run\/php5-fpm.sock/" /usr/local/etc/php-fpm.conf # sed -i '' "s/;listen.owner/listen.owner/" /usr/local/etc/php-fpm.conf # sed -i '' "s/;listen.group/listen.group/" /usr/local/etc/php-fpm.conf # sed -i '' "s/;listen.mode/listen.mode/" /usr/local/etc/php-fpm.conf # service php-fpm start # service nginx start ### Firewall Rules Example: # iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT # service iptables save RHEL/CentOS 7 specific: # firewall-cmd --add-service=http # firewall-cmd --permanent --add-service=http FreeBSD: Please consult the [FreeBSD Handbook](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls.html) how to configure one of FreeBSD's firewalls. ### Setting Up External Command Pipe Web interfaces and other Icinga addons are able to send commands to Icinga 2 through the external command pipe. You can enable the External Command Pipe using the CLI: # icinga2 feature enable command After that you will have to restart Icinga 2: Debian/Ubuntu, RHEL/CentOS 6 and SUSE: # service icinga2 restart RHEL/CentOS 7 and Fedora: # systemctl restart icinga2 FreeBSD: # service icinga2 restart By default the command pipe file is owned by the group `icingacmd` with read/write permissions. Add your webserver's user to the group `icingacmd` to enable sending commands to Icinga 2 through your web interface: # usermod -a -G icingacmd www-data FreeBSD: On FreeBSD the rw directory is owned by the group `www`. You do not need to add the user `icinga` to the group `www`. Debian packages use `nagios` as the default user and group name. Therefore change `icingacmd` to `nagios`. The webserver's user is different between distributions so you might have to change `www-data` to `wwwrun`, `www`, or `apache`. Change "www-data" to the user you're using to run queries. You can verify that the user has been successfully added to the `icingacmd` group using the `id` command: $ id ### Installing up Icinga Web 2 Please consult the [installation documentation](https://github.com/Icinga/icingaweb2/blob/master/doc/installation.md) for further instructions on how to install Icinga Web 2. ## Addons A number of additional features are available in the form of addons. A list of popular addons is available in the [Addons and Plugins](14-addons-plugins.md#addons-plugins) chapter. icinga2-2.4.1/doc/20-script-debugger.md000066400000000000000000000066161262555626500174550ustar00rootroot00000000000000# Script Debugger You can run the Icinga 2 daemon with the `-X` (`--script-debugger`) parameter to enable the script debugger: # icinga2 daemon -X When an exception occurs or the [debugger](18-language-reference.md#breakpoints) keyword is encountered in a user script, Icinga 2 launches a console that allows the user to debug the script. Here is a list of common errors which can be diagnosed with the script debugger: * Configuration errors (apply) * Errors in user-defined functions ## Debugging Configuration Errors The following example illustrates the problem of a service [apply rule](3-monitoring-basics.md#using-apply-for) which expects a dictionary value for `config`, but the host custom attribute only provides a string value: object Host "script-debugger-host" { check_command = "icinga" vars.http_vhosts["example.org"] = "192.168.1.100" // a string value } apply Service for (http_vhost => config in host.vars.http_vhosts) { import "generic-service" vars += config // expects a dictionary check_command = "http" } The error message on config validation will warn about the wrong value type, but does not provide any context which objects are affected. Enable the script debugger and run the config validation: # icinga2 daemon -C -X Breakpoint encountered in /etc/icinga2/conf.d/services.conf: 59:67-65:1 Exception: Error: Error while evaluating expression: Cannot convert value of type 'String' to an object. Location: /etc/icinga2/conf.d/services.conf(62): check_command = "http" /etc/icinga2/conf.d/services.conf(63): /etc/icinga2/conf.d/services.conf(64): vars += config ^^^^^^^^^^^^^^ /etc/icinga2/conf.d/services.conf(65): } /etc/icinga2/conf.d/services.conf(66): You can inspect expressions (such as variables) by entering them at the prompt. To leave the debugger and continue the program use "$continue". <1> => You can print the variables `vars` and `config` to get an idea about their values: <1> => vars null <2> => config "192.168.1.100" <3> => The `vars` attribute has to be a dictionary. Trying to set this attribute to a string caused the error in our configuration example. In order to determine the name of the host where the value of the `config` variable came from you can inspect attributes of the service object: <3> => host_name "script-debugger-host-01" <4> => name "http" Additionally you can view the service object attributes by printing the value of `this`. ## Using Breakpoints In order to halt execution in a script you can use the `debugger` keyword: object Host "script-debugger-host-02" { check_command = "dummy" check_interval = 5s vars.dummy_text = {{ var text = "Hello from " + macro("$name$") debugger return text }} } Icinga 2 will spawn a debugger console every time the function is executed: # icinga2 daemon -X ... Breakpoint encountered in /etc/icinga2/tests/script-debugger.conf: 7:5-7:12 You can inspect expressions (such as variables) by entering them at the prompt. To leave the debugger and continue the program use "$continue". <1> => text "Hello from script-debugger-host-02" <2> => $continue icinga2-2.4.1/doc/21-development.md000066400000000000000000000160371262555626500167100ustar00rootroot00000000000000# Develop Icinga 2 This chapter provides hints on Icinga 2 development especially for debugging purposes. > **Note** > > If you are planning to build your own development environment, > please consult the `INSTALL.md` file from the source tree. ## Debug Requirements Make sure that the debug symbols are available for Icinga 2. The Icinga 2 packages provide a debug package which must be installed separately for all involved binaries, like `icinga2-bin` or `icinga2-ido-mysql`. Debian/Ubuntu: # apt-get install icinga2-dbg RHEL/CentOS: # yum install icinga2-debuginfo SLES/openSUSE: # zypper install icinga2-bin-debuginfo icinga2-ido-mysql-debuginfo Furthermore, you may also have to install debug symbols for Boost and your C library. If you're building your own binaries you should use the `-DCMAKE_BUILD_TYPE=Debug` cmake build flag for debug builds. ## GDB Install gdb: Debian/Ubuntu: # apt-get install gdb RHEL/CentOS/Fedora: # yum install gdb SLES/openSUSE: # zypper install gdb Install the `boost`, `python` and `icinga2` pretty printers. Absolute paths are required, so please make sure to update the installation paths accordingly (`pwd`). $ mkdir -p ~/.gdb_printers && cd ~/.gdb_printers Boost Pretty Printers compatible with Python 3: $ git clone https://github.com/mateidavid/Boost-Pretty-Printer.git && cd Boost-Pretty-Printer $ git checkout python-3 $ pwd /home/michi/.gdb_printers/Boost-Pretty-Printer Python Pretty Printers: $ cd ~/.gdb_printers $ svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python Icinga 2 Pretty Printers: $ mkdir -p ~/.gdb_printers/icinga2 && cd ~/.gdb_printers/icinga2 $ wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/debug/gdb/icingadbg.py Now you'll need to modify/setup your `~/.gdbinit` configuration file. You can download the one from Icinga 2 and modify all paths. Example on Fedora 22: $ wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/debug/gdb/gdbinit -O ~/.gdbinit $ vim ~/.gdbinit set print pretty on python import sys sys.path.insert(0, '/home/michi/.gdb_printers/icinga2') from icingadbg import register_icinga_printers register_icinga_printers() end python import sys sys.path.insert(0, '/home/michi/.gdb_printers/python') from libstdcxx.v6.printers import register_libstdcxx_printers try: register_libstdcxx_printers(None) except: pass end python import sys sys.path.insert(0, '/home/michi/.gdb_printers/Boost-Pretty-Printer') import boost_print boost_print.register_printers() end If you are getting the following error when running gdb, the `libstdcxx` printers are already preloaded in your environment and you can remove the duplicate import in your `~/.gdbinit` file. RuntimeError: pretty-printer already registered: libstdc++-v6 ### GDB Run Call GDB with the binary (`/usr/sbin/icinga2` is a wrapper script calling `/usr/lib64/icinga2/sbin/icinga2` since 2.4) and all arguments and run it in foreground. If VFork causes trouble disable it inside the gdb run. # gdb --args /usr/lib64/icinga2/sbin/icinga2 daemon -x debug -DUseVfork=0 The exact path to the Icinga 2 binary differs on each distribution. On Ubuntu it is installed into `/usr/lib/x86_64-linux-gnu/icinga2/sbin/icinga2` on 64-bit systems for example. > **Note** > > If gdb tells you it's missing debug symbols, quit gdb and install > them: `Missing separate debuginfos, use: debuginfo-install ...` Run the application. (gdb) r Kill the running application. (gdb) k Continue after breakpoint. (gdb) c ### GDB Core Dump Either attach to the running process using `gdb -p PID` or start a new gdb run. (gdb) r (gdb) generate-core-file ### GDB Backtrace If Icinga 2 aborted its operation abnormally, generate a backtrace. (gdb) bt (gdb) bt full Generate a full backtrace for all threads and store it into a new file (e.g. for debugging dead locks): # gdb -p PID -batch -ex "thread apply all bt full" -ex "detach" -ex "q" > gdb_bt.log If you're opening an issue at [https://dev.icinga.org] make sure to attach as much detail as possible. ### GDB Backtrace Stepping Identifying the problem may require stepping into the backtrace, analysing the current scope, attributes, and possible unmet requirements. `p` prints the value of the selected variable or function call result. (gdb) up (gdb) down (gdb) p checkable (gdb) p checkable.px->m_Name ### GDB Breakpoints To set a breakpoint to a specific function call, or file specific line. (gdb) b checkable.cpp:125 (gdb) b icinga::Checkable::SetEnablePerfdata GDB will ask about loading the required symbols later, select `yes` instead of `no`. Then run Icinga 2 until it reaches the first breakpoint. Continue with `c` afterwards. (gdb) run (gdb) c If you want to delete all breakpoints, use `d` and select `yes`. (gdb) d > **Tip** > > When debugging exceptions, set your breakpoint like this: `b __cxa_throw`. Breakpoint Example: (gdb) b __cxa_throw (gdb) r (gdb) up .... (gdb) up #11 0x00007ffff7cbf9ff in icinga::Utility::GlobRecursive(icinga::String const&, icinga::String const&, boost::function const&, int) (path=..., pattern=..., callback=..., type=1) at /home/michi/coding/icinga/icinga2/lib/base/utility.cpp:609 609 callback(cpath); (gdb) l 604 605 #endif /* _WIN32 */ 606 607 std::sort(files.begin(), files.end()); 608 BOOST_FOREACH(const String& cpath, files) { 609 callback(cpath); 610 } 611 612 std::sort(dirs.begin(), dirs.end()); 613 BOOST_FOREACH(const String& cpath, dirs) { (gdb) p files $3 = std::vector of length 11, capacity 16 = {{static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/agent.conf"}, {static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/commands.conf"}, {static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/downtimes.conf"}, {static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/groups.conf"}, {static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/notifications.conf"}, {static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/satellite.conf"}, {static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/services.conf"}, {static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/templates.conf"}, {static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/test.conf"}, {static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/timeperiods.conf"}, {static NPos = 18446744073709551615, m_Data = "/etc/icinga2/conf.d/users.conf"}} icinga2-2.4.1/doc/22-migrating-from-icinga-1x.md000066400000000000000000001606171262555626500210730ustar00rootroot00000000000000# Migration from Icinga 1.x ## Configuration Migration The Icinga 2 configuration format introduces plenty of behavioural changes. In order to ease migration from Icinga 1.x, this section provides hints and tips on your migration requirements. ### Configuration Migration Script A standalone configuration migration script is available at https://github.com/Icinga/icinga2-migration. All further details on the command line parameters are documented there too. Please note that not each configuration detail, trick or attribute does work. Some specific migration steps will be still required to be done manually, especially if you want to preserve your existing file layout, or any other object specific policies. > **Note** > > It is highly recommended to review your existing installation, do an inventory > of checked objects, thresholds and then design your new configuration layout. > Keep in mind that the more dynamic approach using the [apply rules](3-monitoring-basics.md#using-apply) > allows you to start over in many scenarios. ### Manual Config Migration For a long-term migration of your configuration you should consider re-creating your configuration based on the proposed Icinga 2 configuration paradigm. Please read the [next chapter](22-migrating-from-icinga-1x.md#differences-1x-2) to find out more about the differences between 1.x and 2. ### Manual Config Migration Hints These hints should provide you with enough details for manually migrating your configuration, or to adapt your configuration export tool to dump Icinga 2 configuration instead of Icinga 1.x configuration. The examples are taken from Icinga 1.x test and production environments and converted straight into a possible Icinga 2 format. If you found a different strategy, please let us know! If you require in-depth explanations, please check the [next chapter](22-migrating-from-icinga-1x.md#differences-1x-2). #### Manual Config Migration Hints for Intervals By default all intervals without any duration literal are interpreted as seconds. Therefore all existing Icinga 1.x `*_interval` attributes require an additional `m` duration literal. Icinga 1.x: define service { service_description service1 host_name localhost1 check_command test_customvar use generic-service check_interval 5 retry_interval 1 } Icinga 2: object Service "service1" { import "generic-service" host_name = "localhost1" check_command = "test_customvar" check_interval = 5m retry_interval = 1m } #### Manual Config Migration Hints for Services If you have used the `host_name` attribute in Icinga 1.x with one or more host names this service belongs to, you can migrate this to the [apply rules](3-monitoring-basics.md#using-apply) syntax. Icinga 1.x: define service { service_description service1 host_name localhost1,localhost2 check_command test_check use generic-service } Icinga 2: apply Service "service1" { import "generic-service" check_command = "test_check" assign where host.name in [ "localhost1", "localhost2" ] } In Icinga 1.x you would have organized your services with hostgroups using the `hostgroup_name` attribute like the following example: define service { service_description servicewithhostgroups hostgroup_name hostgroup1,hostgroup3 check_command test_check use generic-service } Using Icinga 2 you can migrate this to the [apply rules](3-monitoring-basics.md#using-apply) syntax: apply Service "servicewithhostgroups" { import "generic-service" check_command = "test_check" assign where "hostgroup1" in host.groups assign where "hostgroup3" in host.groups } #### Manual Config Migration Hints for Group Members The Icinga 1.x hostgroup `hg1` has two members `host1` and `host2`. The hostgroup `hg2` has `host3` as a member and includes all members of the `hg1` hostgroup. define hostgroup { hostgroup_name hg1 members host1,host2 } define hostgroup { hostgroup_name hg2 members host3 hostgroup_members hg1 } This can be migrated to Icinga 2 and [using group assign](18-language-reference.md#group-assign). The additional nested hostgroup `hg1` is included into `hg2` with the `groups` attribute. object HostGroup "hg1" { assign where host.name in [ "host1", "host2" ] } object HostGroup "hg2" { groups = [ "hg1" ] assign where host.name == "host3" } These assign rules can be applied for all groups: `HostGroup`, `ServiceGroup` and `UserGroup` (requires renaming from `contactgroup`). > **Tip** > > Define custom attributes and assign/ignore members based on these attribute pattern matches. #### Manual Config Migration Hints for Check Command Arguments Host and service check command arguments are separated by a `!` in Icinga 1.x. Their order is important and they are referenced as `$ARGn$` where `n` is the argument counter. define command { command_name my-ping command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5 } define service { use generic-service host_name my-server service_description my-ping check_command my-ping-check!100.0,20%!500.0,60% } While you could manually migrate this like (please note the new generic command arguments and default argument values!): object CheckCommand "my-ping-check" { import "plugin-check-command" command = [ PluginDir + "/check_ping", "-4" ] arguments = { "-H" = "$ping_address$" "-w" = "$ping_wrta$,$ping_wpl$%" "-c" = "$ping_crta$,$ping_cpl$%" "-p" = "$ping_packets$" "-t" = "$ping_timeout$" } vars.ping_address = "$address$" vars.ping_wrta = 100 vars.ping_wpl = 5 vars.ping_crta = 200 vars.ping_cpl = 15 } object Service "my-ping" { import "generic-service" host_name = "my-server" check_command = "my-ping-check" vars.ping_wrta = 100 vars.ping_wpl = 20 vars.ping_crta = 500 vars.ping_cpl = 60 } #### Manual Config Migration Hints for Runtime Macros Runtime macros have been renamed. A detailed comparison table can be found [here](22-migrating-from-icinga-1x.md#differences-1x-2-runtime-macros). For example, accessing the service check output looks like the following in Icinga 1.x: $SERVICEOUTPUT$ In Icinga 2 you will need to write: $service.output$ Another example referencing the host's address attribute in Icinga 1.x: $HOSTADDRESS$ In Icinga 2 you'd just use the following macro to access all `address` attributes (even overridden from the service objects): $address$ #### Manual Config Migration Hints for Runtime Custom Attributes Custom variables from Icinga 1.x are available as Icinga 2 custom attributes. define command { command_name test_customvar command_line echo "Host CV: $_HOSTCVTEST$ Service CV: $_SERVICECVTEST$\n" } define host { host_name localhost1 check_command test_customvar use generic-host _CVTEST host cv value } define service { service_description service1 host_name localhost1 check_command test_customvar use generic-service _CVTEST service cv value } Can be written as the following in Icinga 2: object CheckCommand "test_customvar" { import "plugin-check-command" command = "echo "Host CV: $host.vars.CVTEST$ Service CV: $service.vars.CVTEST$\n"" } object Host "localhost1" { import "generic-host" check_command = "test_customvar" vars.CVTEST = "host cv value" } object Service "service1" { host_name = "localhost1" check_command = "test_customvar" vars.CVTEST = "service cv value" } If you are just defining `$CVTEST$` in your command definition its value depends on the execution scope - the host check command will fetch the host attribute value of `vars.CVTEST` while the service check command resolves its value to the service attribute attribute `vars.CVTEST`. > **Note** > > Custom attributes in Icinga 2 are case-sensitive. `vars.CVTEST` is not the same as `vars.CvTest`. #### Manual Config Migration Hints for Contacts (Users) Contacts in Icinga 1.x act as users in Icinga 2, but do not have any notification commands specified. This migration part is explained in the [next chapter](22-migrating-from-icinga-1x.md#manual-config-migration-hints-notifications). define contact{ contact_name testconfig-user use generic-user alias Icinga Test User service_notification_options c,f,s,u email icinga@localhost } The `service_notification_options` can be [mapped](22-migrating-from-icinga-1x.md#manual-config-migration-hints-notification-filters) into generic `state` and `type` filters, if additional notification filtering is required. `alias` gets renamed to `display_name`. object User "testconfig-user" { import "generic-user" display_name = "Icinga Test User" email = "icinga@localhost" } This user can be put into usergroups (former contactgroups) or referenced in newly migration notification objects. #### Manual Config Migration Hints for Notifications If you are migrating a host or service notification, you'll need to extract the following information from your existing Icinga 1.x configuration objects * host/service attribute `contacts` and `contact_groups` * host/service attribute `notification_options` * host/service attribute `notification_period` * host/service attribute `notification_interval` The clean approach is to refactor your current contacts and their notification command methods into a generic strategy * host or service has a notification type (for example mail) * which contacts (users) are notified by mail? * do the notification filters, periods, intervals still apply for them? (do a cleanup during migration) * assign users and groups to these notifications * Redesign the notifications into generic [apply rules](3-monitoring-basics.md#using-apply-notifications) The ugly workaround solution could look like this: Extract all contacts from the remaining groups, and create a unique list. This is required for determining the host and service notification commands involved. * contact attributes `host_notification_commands` and `service_notification_commands` (can be a comma separated list) * get the command line for each notification command and store them for later * create a new notification name and command name Generate a new notification object based on these values. Import the generic template based on the type (`host` or `service`). Assign it to the host or service and set the newly generated notification command name as `command` attribute. object Notification "" { import "mail-host-notification" host_name = "" command = "" Convert the `notification_options` attribute from Icinga 1.x to Icinga 2 `states` and `types`. Details [here](22-migrating-from-icinga-1x.md#manual-config-migration-hints-notification-filters). Add the notification period. states = [ OK, Warning, Critical ] types = [ Recovery, Problem, Custom ] period = "24x7" The current contact acts as `users` attribute. users = [ "" ] } Do this in a loop for all notification commands (depending if host or service contact). Once done, dump the collected notification commands. The result of this migration are lots of unnecessary notification objects and commands but it will unroll the Icinga 1.x logic into the revamped Icinga 2 notification object schema. If you are looking for code examples, try [LConf](https://www.netways.org). #### Manual Config Migration Hints for Notification Filters Icinga 1.x defines all notification filters in an attribute called `notification_options`. Using Icinga 2 you will have to split these values into the `states` and `types` attributes. > **Note** > > `Recovery` type requires the `Ok` state. > `Custom` and `Problem` should always be set as `type` filter. Icinga 1.x option | Icinga 2 state | Icinga 2 type ----------------------|-----------------------|------------------- o | OK (Up for hosts) | w | Warning | Problem c | Critical | Problem u | Unknown | Problem d | Down | Problem s | . | DowntimeStart / DowntimeEnd / DowntimeRemoved r | Ok | Recovery f | . | FlappingStart / FlappingEnd n | 0 (none) | 0 (none) . | . | Custom #### Manual Config Migration Hints for Escalations Escalations in Icinga 1.x are a bit tricky. By default service escalations can be applied to hosts and hostgroups and require a defined service object. The following example applies a service escalation to the service `dep_svc01` and all hosts in the `hg_svcdep2` hostgroup. The default `notification_interval` is set to `10` minutes notifying the `cg_admin` contact. After 20 minutes (`10*2`, notification_interval * first_notification) the notification is escalated to the `cg_ops` contactgroup until 60 minutes (`10*6`) have passed. define service { service_description dep_svc01 host_name dep_hostsvc01,dep_hostsvc03 check_command test2 use generic-service notification_interval 10 contact_groups cg_admin } define hostgroup { hostgroup_name hg_svcdep2 members dep_hostsvc03 } # with hostgroup_name and service_description define serviceescalation { hostgroup_name hg_svcdep2 service_description dep_svc01 first_notification 2 last_notification 6 contact_groups cg_ops } In Icinga 2 the service and hostgroup definition will look quite the same. Save the `notification_interval` and `contact_groups` attribute for an additional notification. apply Service "dep_svc01" { import "generic-service" check_command = "test2" assign where host.name == "dep_hostsvc01" assign where host.name == "dep_hostsvc03" } object HostGroup "hg_svcdep2" { assign where host.name == "dep_hostsvc03" } apply Notification "email" to Service { import "service-mail-notification" interval = 10m user_groups = [ "cg_admin" ] assign where service.name == "dep_svc01" && (host.name == "dep_hostsvc01" || host.name == "dep_hostsvc03") } Calculate the begin and end time for the newly created escalation notification: * begin = first_notification * notification_interval = 2 * 10m = 20m * end = last_notification * notification_interval = 6 * 10m = 60m = 1h Assign the notification escalation to the service `dep_svc01` on all hosts in the hostgroup `hg_svcdep2`. apply Notification "email-escalation" to Service { import "service-mail-notification" interval = 10m user_groups = [ "cg_ops" ] times = { begin = 20m end = 1h } assign where service.name == "dep_svc01" && "hg_svcdep2" in host.groups } The assign rule could be made more generic and the notification be applied to more than just this service belonging to hosts in the matched hostgroup. > **Note** > > When the notification is escalated, Icinga 1.x suppresses notifications to the default contacts. > In Icinga 2 an escalation is an additional notification with a defined begin and end time. The > `email` notification will continue as normal. #### Manual Config Migration Hints for Dependencies There are some dependency examples already in the [basics chapter](3-monitoring-basics.md#dependencies). Dependencies in Icinga 1.x can be confusing in terms of which host/service is the parent and which host/service acts as the child. While Icinga 1.x defines `notification_failure_criteria` and `execution_failure_criteria` as dependency filters, this behaviour has changed in Icinga 2. There is no 1:1 migration but generally speaking the state filter defined in the `execution_failure_criteria` defines the Icinga 2 `state` attribute. If the state filter matches, you can define whether to disable checks and notifications or not. The following example describes service dependencies. If you migrate from Icinga 1.x you will only want to use the classic `Host-to-Host` and `Service-to-Service` dependency relationships. define service { service_description dep_svc01 hostgroup_name hg_svcdep1 check_command test2 use generic-service } define service { service_description dep_svc02 hostgroup_name hg_svcdep2 check_command test2 use generic-service } define hostgroup { hostgroup_name hg_svcdep2 members host2 } define host{ use linux-server-template host_name host1 address 192.168.1.10 } # with hostgroup_name and service_description define servicedependency { host_name host1 dependent_hostgroup_name hg_svcdep2 service_description dep_svc01 dependent_service_description * execution_failure_criteria u,c notification_failure_criteria w,u,c inherits_parent 1 } Map the dependency attributes accordingly. Icinga 1.x | Icinga 2 ----------------------|--------------------- host_name | parent_host_name dependent_host_name | child_host_name (used in assign/ignore) dependent_hostgroup_name | all child hosts in group (used in assign/ignore) service_description | parent_service_name dependent_service_description | child_service_name (used in assign/ignore) And migrate the host and services. object Host "host1" { import "linux-server-template" address = "192.168.1.10" } object HostGroup "hg_svcdep2" { assign where host.name == "host2" } apply Service "dep_svc01" { import "generic-service" check_command = "test2" assign where "hp_svcdep1" in host.groups } apply Service "dep_svc02" { import "generic-service" check_command = "test2" assign where "hp_svcdep2" in host.groups } When it comes to the `execution_failure_criteria` and `notification_failure_criteria` attribute migration, you will need to map the most common values, in this example `u,c` (`Unknown` and `Critical` will cause the dependency to fail). Therefore the `Dependency` should be ok on Ok and Warning. `inherits_parents` is always enabled. apply Dependency "all-svc-for-hg-hg_svcdep2-on-host1-dep_svc01" to Service { parent_host_name = "host1" parent_service_name = "dep_svc01" states = [ Ok, Warning ] disable_checks = true disable_notifications = true assign where "hg_svcdep2" in host.groups } Host dependencies are explained in the [next chapter](22-migrating-from-icinga-1x.md#manual-config-migration-hints-host-parents). #### Manual Config Migration Hints for Host Parents Host parents from Icinga 1.x are migrated into `Host-to-Host` dependencies in Icinga 2. The following example defines the `vmware-master` host as parent host for the guest virtual machines `vmware-vm1` and `vmware-vm2`. By default all hosts in the hostgroup `vmware` should get the parent assigned. This isn't really solvable with Icinga 1.x parents, but only with host dependencies. define host{ use linux-server-template host_name vmware-master hostgroups vmware address 192.168.1.10 } define host{ use linux-server-template host_name vmware-vm1 hostgroups vmware address 192.168.27.1 parents vmware-master } define host{ use linux-server-template host_name vmware-vm2 hostgroups vmware address 192.168.28.1 parents vmware-master } By default all hosts in the hostgroup `vmware` should get the parent assigned (but not the `vmware-master` host itself). This isn't really solvable with Icinga 1.x parents, but only with host dependencies as shown below: define hostdependency { dependent_hostgroup_name vmware dependent_host_name !vmware-master host_name vmware-master inherits_parent 1 notification_failure_criteria d,u execution_failure_criteria d,u dependency_period testconfig-24x7 } When migrating to Icinga 2, the parents must be changed to a newly created host dependency. Map the following attributes Icinga 1.x | Icinga 2 ----------------------|--------------------- host_name | parent_host_name dependent_host_name | child_host_name (used in assign/ignore) dependent_hostgroup_name | all child hosts in group (used in assign/ignore) The Icinga 2 configuration looks like this: object Host "vmware-master" { import "linux-server-template" groups += [ "vmware" ] address = "192.168.1.10" vars.is_vmware_master = true } object Host "vmware-vm1" { import "linux-server-template" groups += [ "vmware" ] address = "192.168.27.1" } object Host "vmware-vm2" { import "linux-server-template" groups += [ "vmware" ] address = "192.168.28.1" } apply Dependency "vmware-master" to Host { parent_host_name = "vmware-master" assign where "vmware" in host.groups ignore where host.vars.is_vmware_master ignore where host.name == "vmware-master" } For easier identification you could add the `vars.is_vmware_master` attribute to the `vmware-master` host and let the dependency ignore that instead of the hardcoded host name. That's different to the Icinga 1.x example and a best practice hint only. #### Manual Config Migration Hints for Distributed Setups * Icinga 2 does not use active/passive instances calling OSCP commands and requiring the NSCA daemon for passing check results between instances. * Icinga 2 does not support any 1.x NEB addons for check load distribution * If your current setup consists of instances distributing the check load, you should consider building a [load distribution](13-distributed-monitoring-ha.md#cluster-scenarios-load-distribution) setup with Icinga 2. * If your current setup includes active/passive clustering with external tools like Pacemaker/DRBD consider the [High Availability](13-distributed-monitoring-ha.md#cluster-scenarios-high-availability) setup. * If you have build your own custom configuration deployment and check result collecting mechanism you should re-design your setup and re-evaluate your requirements, and how they may be fulfilled using the Icinga 2 cluster capabilities. ## Differences between Icinga 1.x and 2 ### Configuration Format Icinga 1.x supports two configuration formats: key-value-based settings in the `icinga.cfg` configuration file and object-based in included files (`cfg_dir`, `cfg_file`). The path to the `icinga.cfg` configuration file must be passed to the Icinga daemon at startup. icinga.cfg: enable_notifications=1 objects.cfg: define service { notifications_enabled 0 } Icinga 2 supports objects and (global) variables, but does not make a difference if it's the main configuration file, or any included file. icinga2.conf: const EnableNotifications = true object Service "test" { enable_notifications = false } #### Sample Configuration and ITL While Icinga 1.x ships sample configuration and templates spread in various object files, Icinga 2 moves all templates into the Icinga Template Library (ITL) and includes them in the sample configuration. Additional plugin check commands are shipped with Icinga 2 as well. The ITL will be updated on every release and must not be edited by the user. There are still generic templates available for your convenience which may or may not be re-used in your configuration. For instance, `generic-service` includes all required attributes except `check_command` for a service. Sample configuration files are located in the `conf.d/` directory which is included in `icinga2.conf` by default. > **Note** > > Add your own custom templates in the `conf.d/` directory as well, e.g. inside > the [templates.conf](4-configuring-icinga-2.md#templates-conf) file. ### Main Config File In Icinga 1.x there are many global configuration settings available in `icinga.cfg`. Icinga 2 only uses a small set of [global constants](18-language-reference.md#constants) allowing you to specify certain different setting such as the `NodeName` in a cluster scenario. Aside from that, the [icinga2.conf](4-configuring-icinga-2.md#icinga2-conf) should take care of including global constants, enabled [features](8-cli-commands.md#enable-features) and the object configuration. ### Include Files and Directories In Icinga 1.x the `icinga.cfg` file contains `cfg_file` and `cfg_dir` directives. The `cfg_dir` directive recursively includes all files with a `.cfg` suffix in the given directory. Only absolute paths may be used. The `cfg_file` and `cfg_dir` directives can include the same file twice which leads to configuration errors in Icinga 1.x. cfg_file=/etc/icinga/objects/commands.cfg cfg_dir=/etc/icinga/objects Icinga 2 supports wildcard includes and relative paths, e.g. for including `conf.d/*.conf` in the same directory. include "conf.d/*.conf" If you want to include files and directories recursively, you need to define a separate option and add the directory and an optional pattern. include_recursive "conf.d" A global search path for includes is available for advanced features like the Icinga Template Library (ITL) or additional monitoring plugins check command configuration. include include By convention the `.conf` suffix is used for Icinga 2 configuration files. ### Resource File and Global Macros Global macros such as for the plugin directory, usernames and passwords can be set in the `resource.cfg` configuration file in Icinga 1.x. By convention the `USER1` macro is used to define the directory for the plugins. Icinga 2 uses global constants instead. In the default config these are set in the `constants.conf` configuration file: /** * This file defines global constants which can be used in * the other configuration files. At a minimum the * PluginDir constant should be defined. */ const PluginDir = "/usr/lib/nagios/plugins" [Global macros](18-language-reference.md#constants) can only be defined once. Trying to modify a global constant will result in an error. ### Configuration Comments In Icinga 1.x comments are made using a leading hash (`#`) or a semi-colon (`;`) for inline comments. In Icinga 2 comments can either be encapsulated by `/*` and `*/` (allowing for multi-line comments) or starting with two slashes (`//`). A leading hash (`#`) could also be used. ### Object Names Object names must not contain an exclamation mark (`!`). Use the `display_name` attribute to specify user-friendly names which should be shown in UIs (supported by Icinga Web 2 for example). Object names are not specified using attributes (e.g. `service_description` for services) like in Icinga 1.x but directly after their type definition. define service { host_name localhost service_description ping4 } object Service "ping4" { host_name = "localhost" } ### Templates In Icinga 1.x templates are identified using the `register 0` setting. Icinga 2 uses the `template` identifier: template Service "ping4-template" { } Icinga 1.x objects inherit from templates using the `use` attribute. Icinga 2 uses the keyword `import` with template names in double quotes. define service { service_description testservice use tmpl1,tmpl2,tmpl3 } object Service "testservice" { import "tmpl1" import "tmpl2" import "tmpl3" } The last template overrides previously set values. ### Object attributes Icinga 1.x separates attribute and value pairs with whitespaces/tabs. Icinga 2 requires an equal sign (=) between them. define service { check_interval 5 } object Service "test" { check_interval = 5m } Please note that the default time value is seconds, if no duration literal is given. `check_interval = 5` behaves the same as `check_interval = 5s`. All strings require double quotes in Icinga 2. Therefore a double quote must be escaped by a backslash (e.g. in command line). If an attribute identifier starts with a number, it must be enclosed in double quotes as well. #### Alias vs. Display Name In Icinga 1.x a host can have an `alias` and a `display_name` attribute used for a more descriptive name. A service only can have a `display_name` attribute. The `alias` is used for group, timeperiod, etc. objects too. Icinga 2 only supports the `display_name` attribute which is also taken into account by Icinga web interfaces. ### Custom Attributes Icinga 2 allows you to define custom attributes in the `vars` dictionary. The `notes`, `notes_url`, `action_url`, `icon_image`, `icon_image_alt` attributes for host and service objects are still available in Icinga 2. `2d_coords` and `statusmap_image` are not supported in Icinga 2. #### Custom Variables Icinga 1.x custom variable attributes must be prefixed using an underscore (`_`). In Icinga 2 these attributes must be added to the `vars` dictionary as custom attributes. vars.dn = "cn=icinga2-dev-host,ou=icinga,ou=main,ou=IcingaConfig,ou=LConf,dc=icinga,dc=org" vars.cv = "my custom cmdb description" These custom attributes are also used as [command parameters](3-monitoring-basics.md#command-passing-parameters). While Icinga 1.x only supports numbers and strings as custom attribute values, Icinga 2 extends that to arrays and (nested) dictionaries. For more details look [here](3-monitoring-basics.md#custom-attributes). ### Host Service Relation In Icinga 1.x a service object is associated with a host by defining the `host_name` attribute in the service definition. Alternate methods refer to `hostgroup_name` or behaviour changing regular expression. The preferred way of associating hosts with services in Icinga 2 is by using the [apply](3-monitoring-basics.md#using-apply) keyword. Direct object relations between a service and a host still allow you to use the `host_name` [Service](6-object-types.md#objecttype-service) object attribute. ### Users Contacts have been renamed to users (same for groups). A contact does not only provide (custom) attributes and notification commands used for notifications, but is also used for authorization checks in Icinga 1.x. Icinga 2 changes that behavior and makes the user an attribute provider only. These attributes can be accessed using [runtime macros](3-monitoring-basics.md#runtime-macros) inside notification command definitions. In Icinga 2 notification commands are not directly associated with users. Instead the notification command is specified inside `Notification` objects next to user and user group relations. The `StatusDataWriter`, `IdoMySqlConnection` and `LivestatusListener` types will provide the contact and contactgroups attributes for services for compatibility reasons. These values are calculated from all services, their notifications, and their users. ### Macros Various object attributes and runtime variables can be accessed as macros in commands in Icinga 1.x - Icinga 2 supports all required [custom attributes](3-monitoring-basics.md#custom-attributes). #### Command Arguments If you have previously used Icinga 1.x you may already be familiar with user and argument definitions (e.g., `USER1` or `ARG1`). Unlike in Icinga 1.x the Icinga 2 custom attributes may have arbitrary names and arguments are no longer specified in the `check_command` setting. In Icinga 1.x arguments are specified in the `check_command` attribute and are separated from the command name using an exclamation mark (`!`). Please check the migration hints for a detailed [migration example](22-migrating-from-icinga-1x.md#manual-config-migration-hints-check-command-arguments). > **Note** > > The Classic UI feature named `Command Expander` does not work with Icinga 2. #### Environment Macros The global configuration setting `enable_environment_macros` does not exist in Icinga 2. Macros exported into the [environment](3-monitoring-basics.md#command-environment-variables) can be set using the `env` attribute in command objects. #### Runtime Macros Icinga 2 requires an object specific namespace when accessing configuration and stateful runtime macros. Custom attributes can be accessed directly. If a runtime macro from Icinga 1.x is not listed here, it is not supported by Icinga 2. Changes to user (contact) runtime macros Icinga 1.x | Icinga 2 -----------------------|---------------------- CONTACTNAME | user.name CONTACTALIAS | user.display_name CONTACTEMAIL | user.email CONTACTPAGER | user.pager `CONTACTADDRESS*` is not supported but can be accessed as `$user.vars.address1$` if set. Changes to service runtime macros Icinga 1.x | Icinga 2 -----------------------|---------------------- SERVICEDESC | service.name SERVICEDISPLAYNAME | service.display_name SERVICECHECKCOMMAND | service.check_command SERVICESTATE | service.state SERVICESTATEID | service.state_id SERVICESTATETYPE | service.state_type SERVICEATTEMPT | service.check_attempt MAXSERVICEATTEMPT | service.max_check_attempts LASTSERVICESTATE | service.last_state LASTSERVICESTATEID | service.last_state_id LASTSERVICESTATETYPE | service.last_state_type LASTSERVICESTATECHANGE | service.last_state_change SERVICEDOWNTIME | service.downtime_depth SERVICEDURATIONSEC | service.duration_sec SERVICELATENCY | service.latency SERVICEEXECUTIONTIME | service.execution_time SERVICEOUTPUT | service.output SERVICEPERFDATA | service.perfdata LASTSERVICECHECK | service.last_check SERVICENOTES | service.notes SERVICENOTESURL | service.notes_url SERVICEACTIONURL | service.action_url Changes to host runtime macros Icinga 1.x | Icinga 2 -----------------------|---------------------- HOSTNAME | host.name HOSTADDRESS | host.address HOSTADDRESS6 | host.address6 HOSTDISPLAYNAME | host.display_name HOSTALIAS | (use `host.display_name` instead) HOSTCHECKCOMMAND | host.check_command HOSTSTATE | host.state HOSTSTATEID | host.state_id HOSTSTATETYPE | host.state_type HOSTATTEMPT | host.check_attempt MAXHOSTATTEMPT | host.max_check_attempts LASTHOSTSTATE | host.last_state LASTHOSTSTATEID | host.last_state_id LASTHOSTSTATETYPE | host.last_state_type LASTHOSTSTATECHANGE | host.last_state_change HOSTDOWNTIME | host.downtime_depth HOSTDURATIONSEC | host.duration_sec HOSTLATENCY | host.latency HOSTEXECUTIONTIME | host.execution_time HOSTOUTPUT | host.output HOSTPERFDATA | host.perfdata LASTHOSTCHECK | host.last_check HOSTNOTES | host.notes HOSTNOTESURL | host.notes_url HOSTACTIONURL | host.action_url TOTALSERVICES | host.num_services TOTALSERVICESOK | host.num_services_ok TOTALSERVICESWARNING | host.num_services_warning TOTALSERVICESUNKNOWN | host.num_services_unknown TOTALSERVICESCRITICAL | host.num_services_critical Changes to command runtime macros Icinga 1.x | Icinga 2 -----------------------|---------------------- COMMANDNAME | command.name Changes to notification runtime macros Icinga 1.x | Icinga 2 -----------------------|---------------------- NOTIFICATIONTYPE | notification.type NOTIFICATIONAUTHOR | notification.author NOTIFICATIONCOMMENT | notification.comment NOTIFICATIONAUTHORNAME | (use `notification.author`) NOTIFICATIONAUTHORALIAS | (use `notification.author`) Changes to global runtime macros: Icinga 1.x | Icinga 2 -----------------------|---------------------- TIMET | icinga.timet LONGDATETIME | icinga.long_date_time SHORTDATETIME | icinga.short_date_time DATE | icinga.date TIME | icinga.time PROCESSSTARTTIME | icinga.uptime Changes to global statistic macros: Icinga 1.x | Icinga 2 ----------------------------------|---------------------- TOTALHOSTSUP | icinga.num_hosts_up TOTALHOSTSDOWN | icinga.num_hosts_down TOTALHOSTSUNREACHABLE | icinga.num_hosts_unreachable TOTALHOSTSDOWNUNHANDLED | -- TOTALHOSTSUNREACHABLEUNHANDLED | -- TOTALHOSTPROBLEMS | down TOTALHOSTPROBLEMSUNHANDLED | down-(downtime+acknowledged) TOTALSERVICESOK | icinga.num_services_ok TOTALSERVICESWARNING | icinga.num_services_warning TOTALSERVICESCRITICAL | icinga.num_services_critical TOTALSERVICESUNKNOWN | icinga.num_services_unknown TOTALSERVICESWARNINGUNHANDLED | -- TOTALSERVICESCRITICALUNHANDLED | -- TOTALSERVICESUNKNOWNUNHANDLED | -- TOTALSERVICEPROBLEMS | ok+warning+critical+unknown TOTALSERVICEPROBLEMSUNHANDLED | warning+critical+unknown-(downtime+acknowledged) ### External Commands `CHANGE_CUSTOM_CONTACT_VAR` was renamed to `CHANGE_CUSTOM_USER_VAR`. `CHANGE_CONTACT_MODATTR` was renamed to `CHANGE_USER_MODATTR`. The following external commands are not supported: CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD CHANGE_HOST_NOTIFICATION_TIMEPERIOD CHANGE_SVC_NOTIFICATION_TIMEPERIOD DEL_DOWNTIME_BY_HOSTGROUP_NAME DEL_DOWNTIME_BY_START_TIME_COMMENT DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST DISABLE_CONTACT_HOST_NOTIFICATIONS DISABLE_CONTACT_SVC_NOTIFICATIONS DISABLE_CONTACTGROUP_HOST_NOTIFICATIONS DISABLE_CONTACTGROUP_SVC_NOTIFICATIONS DISABLE_FAILURE_PREDICTION DISABLE_HOST_AND_CHILD_NOTIFICATIONS DISABLE_HOST_FRESHNESS_CHECKS DISABLE_NOTIFICATIONS_EXPIRE_TIME DISABLE_SERVICE_FRESHNESS_CHECKS ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST ENABLE_CONTACT_HOST_NOTIFICATIONS ENABLE_CONTACT_SVC_NOTIFICATIONS ENABLE_CONTACTGROUP_HOST_NOTIFICATIONS ENABLE_CONTACTGROUP_SVC_NOTIFICATIONS ENABLE_FAILURE_PREDICTION ENABLE_HOST_AND_CHILD_NOTIFICATIONS ENABLE_HOST_FRESHNESS_CHECKS ENABLE_SERVICE_FRESHNESS_CHECKS READ_STATE_INFORMATION SAVE_STATE_INFORMATION SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME SET_HOST_NOTIFICATION_NUMBER SET_SVC_NOTIFICATION_NUMBER START_ACCEPTING_PASSIVE_HOST_CHECKS START_ACCEPTING_PASSIVE_SVC_CHECKS START_OBSESSING_OVER_HOST START_OBSESSING_OVER_HOST_CHECKS START_OBSESSING_OVER_SVC START_OBSESSING_OVER_SVC_CHECKS STOP_ACCEPTING_PASSIVE_HOST_CHECKS STOP_ACCEPTING_PASSIVE_SVC_CHECKS STOP_OBSESSING_OVER_HOST STOP_OBSESSING_OVER_HOST_CHECKS STOP_OBSESSING_OVER_SVC STOP_OBSESSING_OVER_SVC_CHECKS ### Asynchronous Event Execution Unlike Icinga 1.x, Icinga 2 does not block when it waits for a command being executed - be it a check, notification, event handler, performance data writing update, etc. That way you'll recognize low to zero (check) latencies with Icinga 2. ### Checks #### Check Output Icinga 2 does not make a difference between `output` (first line) and `long_output` (remaining lines) like in Icinga 1.x. Performance Data is provided separately. There is no output length restriction as known from Icinga 1.x using an [8KB static buffer](http://docs.icinga.org/latest/en/pluginapi.html#outputlengthrestrictions). The `StatusDataWriter`, `IdoMysqlConnection` and `LivestatusListener` types split the raw output into `output` (first line) and `long_output` (remaining lines) for compatibility reasons. #### Initial State Icinga 1.x uses the `max_service_check_spread` setting to specify a timerange where the initial state checks must have happened. Icinga 2 will use the `retry_interval` setting instead and `check_interval` divided by 5 if `retry_interval` is not defined. ### Comments Icinga 2 doesn't support non-persistent comments. ### Commands Unlike in Icinga 1.x there are three different command types in Icinga 2: `CheckCommand`, `NotificationCommand`, and `EventCommand`. For example in Icinga 1.x it is possible to accidentally use a notification command as an event handler which might cause problems depending on which runtime macros are used in the notification command. In Icinga 2 these command types are separated and will generate an error on configuration validation if used in the wrong context. While Icinga 2 still supports the complete command line in command objects, it's recommended to use [command arguments](3-monitoring-basics.md#command-arguments) with optional and conditional command line parameters instead. It's also possible to define default argument values for the command itself which can be overridden by the host or service then. #### Command Timeouts In Icinga 1.x there were two global options defining a host and service check timeout. This was essentially bad when there only was a couple of check plugins requiring some command timeouts to be extended. Icinga 2 allows you to specify the command timeout directly on the command. So if your VMVware check plugin takes 15 minutes, [increase the timeout](6-object-types.md#objecttype-checkcommand) accordingly. ### Groups In Icinga 2 hosts, services, and users are added to groups using the `groups` attribute in the object. The old way of listing all group members in the group's `members` attribute is available through `assign where` and `ignore where` expressions by using [group assign](3-monitoring-basics.md#group-assign-intro). object Host "web-dev" { import "generic-host" } object HostGroup "dev-hosts" { display_name = "Dev Hosts" assign where match("*-dev", host.name) } #### Add Service to Hostgroup where Host is Member In order to associate a service with all hosts in a host group the [apply](3-monitoring-basics.md#using-apply) keyword can be used: apply Service "ping4" { import "generic-service" check_command = "ping4" assign where "dev-hosts" in host.groups } ### Notifications Notifications are a new object type in Icinga 2. Imagine the following notification configuration problem in Icinga 1.x: * Service A should notify contact X via SMS * Service B should notify contact X via Mail * Service C should notify contact Y via Mail and SMS * Contact X and Y should also be used for authorization (e.g. in Classic UI) The only way achieving a semi-clean solution is to * Create contact X-sms, set service_notification_command for sms, assign contact to service A * Create contact X-mail, set service_notification_command for mail, assign contact to service B * Create contact Y, set service_notification_command for sms and mail, assign contact to service C * Create contact X without notification commands, assign to service A and B Basically you are required to create duplicated contacts for either each notification method or used for authorization only. Icinga 2 attempts to solve that problem in this way * Create user X, set SMS and Mail attributes, used for authorization * Create user Y, set SMS and Mail attributes, used for authorization * Create notification A-SMS, set command for sms, add user X, assign notification A-SMS to service A * Create notification B-Mail, set command for mail, add user X, assign notification Mail to service B * Create notification C-SMS, set command for sms, add user Y, assign notification C-SMS to service C * Create notification C-Mail, set command for mail, add user Y, assign notification C-Mail to service C Previously in Icinga 1.x it looked like this: service -> (contact, contactgroup) -> notification command In Icinga 2 it will look like this: Service -> Notification -> NotificationCommand -> User, UserGroup #### Escalations Escalations in Icinga 1.x require a separated object matching on existing objects. Escalations happen between a defined start and end time which is calculated from the notification_interval: start = notification start + (notification_interval * first_notification) end = notification start + (notification_interval * last_notification) In theory first_notification and last_notification can be set to readable numbers. In practice users are manipulating those attributes in combination with notification_interval in order to get a start and end time. In Icinga 2 the notification object can be used as notification escalation if the start and end times are defined within the 'times' attribute using duration literals (e.g. 30m). The Icinga 2 escalation does not replace the current running notification. In Icinga 1.x it's required to copy the contacts from the service notification to the escalation to guarantee the normal notifications once an escalation happens. That's not necessary with Icinga 2 only requiring an additional notification object for the escalation itself. #### Notification Options Unlike Icinga 1.x with the 'notification_options' attribute with comma-separated state and type filters, Icinga 2 uses two configuration attributes for that. All state and type filter use long names OR'd with a pipe together notification_options w,u,c,r,f,s states = [ Warning, Unknown, Critical ] filters = [ Problem, Recovery, FlappingStart, FlappingEnd, DowntimeStart, DowntimeEnd, DowntimeRemoved ] Icinga 2 adds more fine-grained type filters for acknowledgements, downtime, and flapping type (start, end, ...). ### Dependencies and Parents In Icinga 1.x it's possible to define host parents to determine network reachability and keep a host's state unreachable rather than down. Furthermore there are host and service dependencies preventing unnecessary checks and notifications. A host must not depend on a service, and vice versa. All dependencies are configured as separate objects and cannot be set directly on the host or service object. A service can now depend on a host, and vice versa. A service has an implicit dependency (parent) to its host. A host to host dependency acts implicitly as host parent relation. The former `host_name` and `dependent_host_name` have been renamed to `parent_host_name` and `child_host_name` (same for the service attribute). When using apply rules the child attributes may be omitted. For detailed examples on how to use the dependencies please check the [dependencies](3-monitoring-basics.md#dependencies) chapter. Dependencies can be applied to hosts or services using the [apply rules](18-language-reference.md#apply). The `StatusDataWriter`, `IdoMysqlConnection` and `LivestatusListener` types support the Icinga 1.x schema with dependencies and parent attributes for compatibility reasons. ### Flapping The Icinga 1.x flapping detection uses the last 21 states of a service. This value is hardcoded and cannot be changed. The algorithm on determining a flapping state is as follows: flapping value = (number of actual state changes / number of possible state changes) The flapping value is then compared to the low and high flapping thresholds. The algorithm used in Icinga 2 does not store the past states but calculates the flapping threshold from a single value based on counters and half-life values. Icinga 2 compares the value with a single flapping threshold configuration attribute. ### Check Result Freshness Freshness of check results must be enabled explicitly in Icinga 1.x. The attribute `freshness_threshold` defines the threshold in seconds. Once the threshold is triggered, an active freshness check is executed defined by the `check_command` attribute. Both check methods (active and passive) use the same freshness check method. In Icinga 2 active check freshness is determined by the `check_interval` attribute and no incoming check results in that period of time (last check + check interval). Passive check freshness is calculated from the `check_interval` attribute if set. There is no extra `freshness_threshold` attribute in Icinga 2. If the freshness checks are invalid, a new service check is forced. ### Real Reload In Nagios / Icinga 1.x a daemon reload does the following: * receive reload signal SIGHUP * stop all events (checks, notifications, etc) * read the configuration from disk and validate all config objects in a single threaded fashion * validation NOT ok: stop the daemon (cannot restore old config state) * validation ok: start with new objects, dump status.dat / ido Unlike Icinga 1.x the Icinga 2 daemon reload does not block any event execution during config validation: * receive reload signal SIGHUP * fork a child process, start configuration validation in parallel work queues * parent process continues with old configuration objects and the event scheduling (doing checks, replicating cluster events, triggering alert notifications, etc.) * validation NOT ok: child process terminates, parent process continues with old configuration state (this is **essential** for the [cluster config synchronisation](13-distributed-monitoring-ha.md#cluster-zone-config-sync)) * validation ok: child process signals parent process to terminate and save its current state (all events until now) into the icinga2 state file * parent process shuts down writing icinga2.state file * child process waits for parent process gone, reads the icinga2 state file and synchronizes all historical and status data * child becomes the new session leader The DB IDO configuration dump and status/historical event updates use a queue not blocking event execution. Same goes for any other enabled feature. The configuration validation itself runs in parallel allowing fast verification checks. That way your monitoring does not stop during a configuration reload. ### State Retention Icinga 1.x uses the `retention.dat` file to save its state in order to be able to reload it after a restart. In Icinga 2 this file is called `icinga2.state`. The format is **not** compatible with Icinga 1.x. ### Logging Icinga 1.x supports syslog facilities and writes its own `icinga.log` log file and archives. These logs are used in Icinga 1.x Classic UI to generate historical reports. Icinga 2 compat library provides the CompatLogger object which writes the icinga.log and archive in Icinga 1.x format in order to stay compatible with Classic UI and other addons. The native Icinga 2 logging facilities are split into three configuration objects: SyslogLogger, FileLogger, StreamLogger. Each of them has their own severity and target configuration. The Icinga 2 daemon log does not log any alerts but is considered an application log only. ### Broker Modules and Features Icinga 1.x broker modules are incompatible with Icinga 2. In order to provide compatibility with Icinga 1.x the functionality of several popular broker modules was implemented for Icinga 2: * IDOUtils * Livestatus * Cluster (allows for high availability and load balancing) ### Distributed Monitoring Icinga 1.x uses the native "obsess over host/service" method which requires the NSCA addon passing the slave's check results passively onto the master's external command pipe. While this method may be used for check load distribution, it does not provide any configuration distribution out-of-the-box. Furthermore comments, downtimes, and other stateful runtime data is not synced between the master and slave nodes. There are addons available solving the check and configuration distribution problems Icinga 1.x distributed monitoring currently suffers from. Icinga 2 implements a new built-in [distributed monitoring architecture](13-distributed-monitoring-ha.md#distributed-monitoring-high-availability), including config and check distribution, IPv4/IPv6 support, SSL certificates and zone support for DMZ. High Availability and load balancing are also part of the Icinga 2 Cluster feature, next to local replay logs on connection loss ensuring that the event history is kept in sync. icinga2-2.4.1/doc/23-appendix.md000066400000000000000000001175151262555626500162030ustar00rootroot00000000000000# Appendix ## External Commands List Additional details can be found in the [Icinga 1.x Documentation](http://docs.icinga.org/latest/en/extcommands2.html) Command name | Parameters | Description ------------------------------------------|-----------------------------------|-------------------------- PROCESS_HOST_CHECK_RESULT | ;<host_name>;<status_code>;<plugin_output> (3) | - PROCESS_SERVICE_CHECK_RESULT | ;<host_name>;<service_name>;<return_code>;<plugin_output> (4) | - SCHEDULE_HOST_CHECK | ;<host_name>;<check_time> (2) | - SCHEDULE_FORCED_HOST_CHECK | ;<host_name>;<check_time> (2) | - SCHEDULE_SVC_CHECK | ;<host_name>;<service_name>;<check_time> (3) | - SCHEDULE_FORCED_SVC_CHECK | ;<host_name>;<service_name>;<check_time> (3) | - ENABLE_HOST_CHECK | ;<host_name> (1) | - DISABLE_HOST_CHECK | ;<host_name> (1) | - ENABLE_SVC_CHECK | ;<host_name>;<service_name> (2) | - DISABLE_SVC_CHECK | ;<host_name>;<service_name> (2) | - SHUTDOWN_PROCESS | - | - RESTART_PROCESS | - | - SCHEDULE_FORCED_HOST_SVC_CHECKS | ;<host_name>;<check_time> (2) | - SCHEDULE_HOST_SVC_CHECKS | ;<host_name>;<check_time> (2) | - ENABLE_HOST_SVC_CHECKS | ;<host_name> (1) | - DISABLE_HOST_SVC_CHECKS | ;<host_name> (1) | - ACKNOWLEDGE_SVC_PROBLEM | ;<host_name>;<service_name>;<sticky>;<notify>;<persistent>;<author>;<comment> (7) | Note: Icinga 2 treats all comments as persistent. ACKNOWLEDGE_SVC_PROBLEM_EXPIRE | ;<host_name>;<service_name>;<sticky>;<notify>;<persistent>;<timestamp>;<author>;<comment> (8) | Note: Icinga 2 treats all comments as persistent. REMOVE_SVC_ACKNOWLEDGEMENT | ;<host_name>;<service_name> (2) | - ACKNOWLEDGE_HOST_PROBLEM | ;<host_name>;<sticky>;<notify>;<persistent>;<author>;<comment> (6) | Note: Icinga 2 treats all comments as persistent. ACKNOWLEDGE_HOST_PROBLEM_EXPIRE | ;<host_name>;<sticky>;<notify>;<persistent>;<timestamp>;<author>;<comment> (7) | Note: Icinga 2 treats all comments as persistent. REMOVE_HOST_ACKNOWLEDGEMENT | ;<host_name> (1) | - DISABLE_HOST_FLAP_DETECTION | ;<host_name> (1) | - ENABLE_HOST_FLAP_DETECTION | ;<host_name> (1) | - DISABLE_SVC_FLAP_DETECTION | ;<host_name>;<service_name> (2) | - ENABLE_SVC_FLAP_DETECTION | ;<host_name>;<service_name> (2) | - ENABLE_HOSTGROUP_SVC_CHECKS | ;<hostgroup_name> (1) | - DISABLE_HOSTGROUP_SVC_CHECKS | ;<hostgroup_name> (1) | - ENABLE_SERVICEGROUP_SVC_CHECKS | ;<servicegroup_name> (1) | - DISABLE_SERVICEGROUP_SVC_CHECKS | ;<servicegroup_name> (1) | - ENABLE_PASSIVE_HOST_CHECKS | ;<host_name> (1) | - DISABLE_PASSIVE_HOST_CHECKS | ;<host_name> (1) | - ENABLE_PASSIVE_SVC_CHECKS | ;<host_name>;<service_name> (2) | - DISABLE_PASSIVE_SVC_CHECKS | ;<host_name>;<service_name> (2) | - ENABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS | ;<servicegroup_name> (1) | - DISABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS | ;<servicegroup_name> (1) | - ENABLE_HOSTGROUP_PASSIVE_SVC_CHECKS | ;<hostgroup_name> (1) | - DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS | ;<hostgroup_name> (1) | - PROCESS_FILE | ;<file_name>;<delete> (2) | - SCHEDULE_SVC_DOWNTIME | ;<host_name>;<service_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (9) | - DEL_SVC_DOWNTIME | ;<downtime_id> (1) | - SCHEDULE_HOST_DOWNTIME | ;<host_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) | - DEL_HOST_DOWNTIME | ;<downtime_id> (1) | - DEL_DOWNTIME_BY_HOST_NAME | ;<host_name>[;<service_name;>[;<start_time;>[;<comment_text;>]]] (1) | - SCHEDULE_HOST_SVC_DOWNTIME | ;<host_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) | - SCHEDULE_HOSTGROUP_HOST_DOWNTIME | ;<hostgroup_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) | - SCHEDULE_HOSTGROUP_SVC_DOWNTIME | ;<hostgroup_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) | - SCHEDULE_SERVICEGROUP_HOST_DOWNTIME | ;<servicegroup_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) | - SCHEDULE_SERVICEGROUP_SVC_DOWNTIME | ;<servicegroup_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) | - ADD_HOST_COMMENT | ;<host_name>;<persistent>;<author>;<comment> (4) | Note: Icinga 2 treats all comments as persistent. DEL_HOST_COMMENT | ;<comment_id> (1) | - ADD_SVC_COMMENT | ;<host_name>;<service_name>;<persistent>;<author>;<comment> (5) | Note: Icinga 2 treats all comments as persistent. DEL_SVC_COMMENT | ;<comment_id> (1) | - DEL_ALL_HOST_COMMENTS | ;<host_name> (1) | - DEL_ALL_SVC_COMMENTS | ;<host_name>;<service_name> (2) | - SEND_CUSTOM_HOST_NOTIFICATION | ;<host_name>;<options>;<author>;<comment> (4) | - SEND_CUSTOM_SVC_NOTIFICATION | ;<host_name>;<service_name>;<options>;<author>;<comment> (5) | - DELAY_HOST_NOTIFICATION | ;<host_name>;<notification_time> (2) | - DELAY_SVC_NOTIFICATION | ;<host_name>;<service_name>;<notification_time> (3) | - ENABLE_HOST_NOTIFICATIONS | ;<host_name> (1) | - DISABLE_HOST_NOTIFICATIONS | ;<host_name> (1) | - ENABLE_SVC_NOTIFICATIONS | ;<host_name>;<service_name> (2) | - DISABLE_SVC_NOTIFICATIONS | ;<host_name>;<service_name> (2) | - ENABLE_HOST_SVC_NOTIFICATIONS | ;<host_name> (1) | - DISABLE_HOST_SVC_NOTIFICATIONS | ;<host_name> (1) | - DISABLE_HOSTGROUP_HOST_CHECKS | ;<hostgroup_name> (1) | - DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS | ;<hostgroup_name> (1) | - DISABLE_SERVICEGROUP_HOST_CHECKS | ;<servicegroup_name> (1) | - DISABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS | ;<servicegroup_name> (1) | - ENABLE_HOSTGROUP_HOST_CHECKS | ;<hostgroup_name> (1) | - ENABLE_HOSTGROUP_PASSIVE_HOST_CHECKS | ;<hostgroup_name> (1) | - ENABLE_SERVICEGROUP_HOST_CHECKS | ;<servicegroup_name> (1) | - ENABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS | ;<servicegroup_name> (1) | - ENABLE_NOTIFICATIONS | - | - DISABLE_NOTIFICATIONS | - | - ENABLE_FLAP_DETECTION | - | - DISABLE_FLAP_DETECTION | - | - ENABLE_EVENT_HANDLERS | - | - DISABLE_EVENT_HANDLERS | - | - ENABLE_PERFORMANCE_DATA | - | - DISABLE_PERFORMANCE_DATA | - | - START_EXECUTING_HOST_CHECKS | - | - STOP_EXECUTING_HOST_CHECKS | - | - START_EXECUTING_SVC_CHECKS | - | - STOP_EXECUTING_SVC_CHECKS | - | - CHANGE_NORMAL_SVC_CHECK_INTERVAL | ;<host_name>;<service_name>;<check_interval> (3) | - CHANGE_NORMAL_HOST_CHECK_INTERVAL | ;<host_name>;<check_interval> (2) | - CHANGE_RETRY_SVC_CHECK_INTERVAL | ;<host_name>;<service_name>;<check_interval> (3) | - CHANGE_RETRY_HOST_CHECK_INTERVAL | ;<host_name>;<check_interval> (2) | - ENABLE_HOST_EVENT_HANDLER | ;<host_name> (1) | - DISABLE_HOST_EVENT_HANDLER | ;<host_name> (1) | - ENABLE_SVC_EVENT_HANDLER | ;<host_name>;<service_name> (2) | - DISABLE_SVC_EVENT_HANDLER | ;<host_name>;<service_name> (2) | - CHANGE_HOST_EVENT_HANDLER | ;<host_name>;<event_command_name> (2) | - CHANGE_SVC_EVENT_HANDLER | ;<host_name>;<service_name>;<event_command_name> (3) | - CHANGE_HOST_CHECK_COMMAND | ;<host_name>;<check_command_name> (2) | - CHANGE_SVC_CHECK_COMMAND | ;<host_name>;<service_name>;<check_command_name> (3) | - CHANGE_MAX_HOST_CHECK_ATTEMPTS | ;<host_name>;<check_attempts> (2) | - CHANGE_MAX_SVC_CHECK_ATTEMPTS | ;<host_name>;<service_name>;<check_attempts> (3) | - CHANGE_HOST_CHECK_TIMEPERIOD | ;<host_name>;<timeperiod_name> (2) | - CHANGE_SVC_CHECK_TIMEPERIOD | ;<host_name>;<service_name>;<timeperiod_name> | - CHANGE_CUSTOM_HOST_VAR | ;<host_name>;<var_name>;<var_value> (3) | - CHANGE_CUSTOM_SVC_VAR | ;<host_name>;<service_name>;<var_name>;<var_value> (4) | - CHANGE_CUSTOM_USER_VAR | ;<user_name>;<var_name>;<var_value> (3) | - CHANGE_CUSTOM_CHECKCOMMAND_VAR | ;<check_command_name>;<var_name>;<var_value> (3) | - CHANGE_CUSTOM_EVENTCOMMAND_VAR | ;<event_command_name>;<var_name>;<var_value> (3) | - CHANGE_CUSTOM_NOTIFICATIONCOMMAND_VAR | ;<notification_command_name>;<var_name>;<var_value> (3) | - ENABLE_HOSTGROUP_HOST_NOTIFICATIONS | ;<hostgroup_name> (1) | - ENABLE_HOSTGROUP_SVC_NOTIFICATIONS | ;<hostgroup_name> (1) | - DISABLE_HOSTGROUP_HOST_NOTIFICATIONS | ;<hostgroup_name> (1) | - DISABLE_HOSTGROUP_SVC_NOTIFICATIONS | ;<hostgroup_name> (1) | - ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS | ;<servicegroup_name> (1) | - DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS | ;<servicegroup_name> (1) | - ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS | ;<servicegroup_name> (1) | - DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS | ;<servicegroup_name> (1) | - ## Schemas By convention `CheckCommand`, `EventCommand`, and `NotificationCommand` objects are exported using a prefix. This is mandatory for unique objects in the command tables. Object | Prefix ------------------------|------------------------ CheckCommand | check_ EventCommand | event_ NotificationCommand | notification_ ### Status Files Status files used by Icinga 1.x Classic UI: `status.dat`, `objects.cache`. Icinga 2 specific extensions: * host and service objects support 'check_source' (added in Classic UI 1.10.0) * command objects support custom variables (added in Classic UI 1.11.2) * host and service objects support 'is_reachable' (added in Classic UI 1.11.3) * 2.2 adds custom attributes with arrays and dictionaries. They are dumped as JSON encoded string and `_is_json` is set as additional custom variable in `objects.cache`. ### DB IDO Schema There is a detailed documentation for the Icinga IDOUtils 1.x database schema available on [http://docs.icinga.org/latest/en/db_model.html] #### DB IDO Schema Extensions Icinga 2 specific extensions are shown below: New table: `endpointstatus` Table | Column | Type | Default | Description --------------------|--------------------|----------|---------|------------- endpoints | endpoint_object_id | bigint | NULL | FK: objects table endpoints | identity | TEXT | NULL | endpoint name endpoints | node | TEXT | NULL | local node name endpoints | zone_object_id | bigint | NULL | zone object where this endpoint is a member of New table: `endpointstatus` Table | Column | Type | Default | Description --------------------|--------------------|----------|---------|------------- endpointstatus | endpoint_object_id | bigint | NULL | FK: objects table endpointstatus | identity | TEXT | NULL | endpoint name endpointstatus | node | TEXT | NULL | local node name endpointstatus | is_connected | smallint | 0 | update on endpoint connect/disconnect endpointstatus | zone_object_id | bigint | NULL | zone object where this endpoint is a member of New tables: `zones` and `zonestatus`: Table | Column | Type | Default | Description --------------------|--------------------|----------|---------|------------- zones | zone_object_id | bigint | NULL | FK: objects table zones | parent_zone_object_id | bigint | NULL | FK: zones table zones | is_global | smallint | 0 | zone is global New columns: Table | Column | Type | Default | Description --------------------|-------------------------|----------|---------|------------- all status/history | endpoint_object_id | bigint | NULL | FK: objects table servicestatus | check_source | TEXT | NULL | node name where check was executed hoststatus | check_source | TEXT | NULL | node name where check was executed statehistory | check_source | TEXT | NULL | node name where check was executed servicestatus | is_reachable | integer | NULL | object reachability hoststatus | is_reachable | integer | NULL | object reachability logentries | object_id | bigint | NULL | FK: objects table (service associated with column) {host,service}group | notes | TEXT | NULL | - {host,service}group | notes_url | TEXT | NULL | - {host,service}group | action_url | TEXT | NULL | - customvariable* | is_json | integer | 0 | Defines whether `varvalue` is a json encoded string from custom attributes, or not servicestatus | original_attributes | TEXT | NULL | JSON encoded dictionary of original attributes if modified at runtime. hoststatus | original_attributes | TEXT | NULL | JSON encoded dictionary of original attributes if modified at runtime. Additional command custom variables populated from 'vars' dictionary. Additional global custom variables populated from 'Vars' constant (object_id is NULL). ### Livestatus Schema #### Livestatus Schema Extensions Icinga 2 specific extensions are shown below: New table: `endpoints`: Table | Column ----------|-------------- endpoints | name endpoints | identity endpoints | node endpoints | is_connected endpoints | zone New table: `zones`: Table | Column ----------|-------------- zone | name zone | endpoints zone | parent zone | global New columns: Table | Column ----------|-------------- hosts | is_reachable services | is_reachable hosts | cv_is_json services | cv_is_json contacts | cv_is_json hosts | check_source services | check_source downtimes | triggers downtimes | trigger_time commands | custom_variable_names commands | custom_variable_values commands | custom_variables commands | modified_attributes commands | modified_attributes_list status | custom_variable_names status | custom_variable_values status | custom_variables hosts | original_attributes services | original_attributes Command custom variables reflect the local 'vars' dictionary. Status custom variables reflect the global 'Vars' constant. #### Livestatus Hosts Table Attributes Key | Type | Note ----------------------|-----------|------------------------- name | string | . display_name | string | . alias | string | same as display_name. address | string | . address6 | string | NEW in Icinga. check_command | string | . check_command_expanded | string | . event_handler | string | . notification_period | string | host with notifications: period. check_period | string | . notes | string | . notes_expanded | string | . notes_url | string | . notes_url_expanded | string | . action_url | string | . action_url_expanded | string | . plugin_output | string | . perf_data | string | . icon_image | string | . icon_image_expanded | string | . icon_image_alt | stirng | . statusmap_image | string | . long_plugin_output | string | . max_check_attempts | int | . flap_detection_enabled | int | . check_freshness | int | . process_performance_data | int | . accept_passive_checks | int | . event_handler_enabled | int | . acknowledgement_type | int | Only 0 or 1. check_type | int | . last_state | int | . last_hard_state | int | . current_attempt | int | . last_notification | int | host with notifications: last notification. next_notification | int | host with notifications: next notification. next_check | int | . last_hard_state_change | int | . has_been_checked | int | . current_notification_number | int | host with notifications: number. total_services | int | . checks_enabled | int | . notifications_enabled | int | . acknowledged | int | . state | int | . state_type | int | . no_more_notifications | int | notification_interval == 0 && volatile == false. last_check | int | . last_state_change | int | . last_time_up | int | . last_time_down | int | . last_time_unreachable | int | . is_flapping | int | . scheduled_downtime_depth | int | . active_checks_enabled | int | . modified_attributes | array | . modified_attributes_list | array | . check_interval | double | . retry_interval | double | . notification_interval | double | host with notifications: smallest interval. low_flap_threshold | double | flapping_threshold high_flap_threshold | double | flapping_threshold latency | double | . execution_time | double | . percent_state_change | double | flapping. in_notification_period | int | host with notifications: matching period. in_check_period | int | . contacts | array | host with notifications, users and user groups. downtimes | array | id. downtimes_with_info | array | id+author+comment. comments | array | id. comments_with_info | array | id+author+comment. comments_with_extra_info | array | id+author+comment+entry_type+entry_time. custom_variable_names | array | . custom_variable_values | array | . custom_variables | array | Array of custom variable array pair. parents | array | Direct host parents. childs | array | Direct host children (Note: `childs` is inherited from the origin MK_Livestatus protocol). num_services | int | . worst_service_state | int | All services and their worst state. num_services_ok | int | All services with Ok state. num_services_warn | int | All services with Warning state. num_services_crit | int | All services with Critical state. num_services_unknown | int | All services with Unknown state. worst_service_hard_state | int | All services and their worst hard state. num_services_hard_ok | int | All services in a hard state with Ok state. num_services_hard_warn | int | All services in a hard state with Warning state. num_services_hard_crit | int | All services in a hard state with Critical state. num_services_hard_unknown | int | All services in a hard state with Unknown state. hard_state | int | Returns OK, if state is OK. Returns current state if now a hard state type. Returns last hard state otherwise. staleness | int | Indicates time since last check normalized onto the check_interval. groups | array | All hostgroups this host is a member of. contact_groups | array | All usergroups associated with this host through notifications. services | array | All services associated with this host. services_with_state | array | All services associated with this host with state and hasbeenchecked. services_with_info | array | All services associated with this host with state, hasbeenchecked and output. Not supported: `initial_state`, `pending_flex_downtime`, `check_flapping_recovery_notification`, `is_executing`, `check_options`, `obsess_over_host`, `first_notification_delay`, `x_3d`, `y_3d`, `z_3d`, `x_2d`, `y_2d`, `filename`, `pnpgraph_present`. #### Livestatus Hostgroups Table Attributes Key | Type | Note ----------------------|-----------|------------------------- name | string | . alias | string | `display_name` attribute. notes | string | . notes_url | string | . action_url | string | . members | array | . members_with_state | array | Host name and state. worst_host_state | int | Of all group members. num_hosts | int | In this group. num_hosts_pending | int | . num_hosts_up | int | . num_hosts_down | int | . num_hosts_unreach | int | . num_services | int | Number of services associated with hosts in this hostgroup. worst_services_state | int | . num_services_pending | int | . num_services_ok | int | . num_services_warn | int | . num_services_crit | int | . num_services_unknown | int | . worst_service_hard_state | int | . num_services_hard_ok | int | . num_services_hard_warn | int | . num_services_hard_crit | int | . num_services_hard_unknown | int | . #### Livestatus Services Table Attributes Key | Type | Note ----------------------|-----------|------------------------- description | string | . display_name | string | . alias | string | same as display_name. check_command | string | . check_command_expanded | string | . event_handler | string | . notification_period | string | host with notifications: period. check_period | string | . notes | string | . notes_expanded | string | . notes_url | string | . notes_url_expanded | string | . action_url | string | . action_url_expanded | string | . plugin_output | string | . perf_data | string | . icon_image | string | . icon_image_expanded | string | . icon_image_alt | stirng | . statusmap_image | string | . long_plugin_output | string | . max_check_attempts | int | . flap_detection_enabled | int | . check_freshness | int | . process_performance_data | int | . accept_passive_checks | int | . event_handler_enabled | int | . acknowledgement_type | int | Only 0 or 1. check_type | int | . last_state | int | . last_hard_state | int | . current_attempt | int | . last_notification | int | service with notifications: last notification. next_notification | int | service with notifications: next notification. next_check | int | . last_hard_state_change | int | . has_been_checked | int | . current_notification_number | int | service with notifications: number. checks_enabled | int | . notifications_enabled | int | . acknowledged | int | . state | int | . state_type | int | . no_more_notifications | int | notification_interval == 0 && volatile == false. last_check | int | . last_state_change | int | . last_time_ok | int | . last_time_warning | int | . last_time_critical | int | . last_time_unknown | int | . is_flapping | int | . scheduled_downtime_depth | int | . active_checks_enabled | int | . modified_attributes | array | . modified_attributes_list | array | . check_interval | double | . retry_interval | double | . notification_interval | double | service with notifications: smallest interval. low_flap_threshold | double | flapping_threshold high_flap_threshold | double | flapping_threshold latency | double | . execution_time | double | . percent_state_change | double | flapping. in_notification_period | int | service with notifications: matching period. in_check_period | int | . contacts | array | service with notifications, users and user groups. downtimes | array | id. downtimes_with_info | array | id+author+comment. comments | array | id. comments_with_info | array | id+author+comment. comments_with_extra_info | array | id+author+comment+entry_type+entry_time. custom_variable_names | array | . custom_variable_values | array | . custom_variables | array | Array of custom variable array pair. hard_state | int | Returns OK, if state is OK. Returns current state if now a hard state type. Returns last hard state otherwise. staleness | int | Indicates time since last check normalized onto the check_interval. groups | array | All hostgroups this host is a member of. contact_groups | array | All usergroups associated with this host through notifications. host_ | join | Prefix for attributes from implicit join with hosts table. Not supported: `initial_state`, `is_executing`, `check_options`, `obsess_over_service`, `first_notification_delay`, `pnpgraph_present`. #### Livestatus Servicegroups Table Attributes Key | Type | Note ----------------------|-----------|------------------------- name | string | . alias | string | `display_name` attribute. notes | string | . notes_url | string | . action_url | string | . members | array | CSV format uses `host|service` syntax. members_with_state | array | Host, service, hoststate, servicestate. worst_service_state | int | . num_services | int | . num_services_pending | int | . num_services_ok | int | . num_services_warn | int | . num_services_crit | int | . num_services_unknown | int | . num_services_hard_ok | int | . num_services_hard_warn | int | . num_services_hard_crit | int | . num_services_hard_unknown | int | . #### Livestatus Contacts Table Attributes Key | Type | Note ----------------------|-----------|------------------------- name | string | . alias | string | `display_name` attribute. email | string | . pager | string | . host_notification_period | string | . service_notification_period | string | . host_notifications_enabled | int | . service_notifications_enabled | int | . in_host_notification_period | int | . in_service_notification_period | int | . custom_variable_names | array | . custom_variable_values | array | . custom_variables | array | Array of customvariable array pairs. modified_attributes | array | . modified_attributes_list | array | . Not supported: `can_submit_commands`. #### Livestatus Contactgroups Table Attributes Key | Type | Note ----------------------|-----------|------------------------- name | string | . alias | string | `display_name` attribute. members | array | . #### Livestatus Commands Table Attributes Key | Type | Note ----------------------|-----------|------------------------- name | string | 3 types of commands in Icinga 2. line | string | . #### Livestatus Status Table Attributes Key | Type | Note ----------------------|-----------|------------------------- connections | int | Since application start. connections_rate | double | . service_checks | int | Since application start. service_checks_rate | double | . host_checks | int | Since application start. host_checks_rate | double | . external_commands | int | Since application start. external_commands_rate | double | . nagios_pid | string | Application PID. enable_notifications | int | . execute_service_checks | int | . accept_passive_service_checks | int | . execute_host_checks | int | . accept_passive_host_checks | int | . enable_event_handlers | int | . check_service_freshness | int | . check_host_freshness | int | . enable_flap_detection | int | . process_performance_data | int | . check_external_commands | int | Always enabled. program_start | int | In seconds. last_command_check | int | Always. interval_length | int | Compatibility mode: 60. num_hosts | int | . num_services | int | . program_version | string | 2.0. livestatus_active_connections | string | . Not supported: `neb_callbacks`, `neb_callbacks_rate`, `requests`, `requests_rate`, `forks`, `forks_rate`, `log_messages`, `log_messages_rate`, `livechecks`, `livechecks_rate`, `livecheck_overflows`, `livecheck_overflows_rate`, `obsess_over_services`, `obsess_over_hosts`, `last_log_rotation`, `external_command_buffer_slots`, `external_command_buffer_usage`, `external_command_buffer_max`, `cached_log_messages`, `livestatus_queued_connections`, `livestatus_threads`. #### Livestatus Comments Table Attributes Key | Type | Note ----------------------|-----------|------------------------- author | string | . comment | string | . id | int | legacy_id. entry_time | string | Seconds. type | int | 1=host, 2=service. is_service | int | . persistent | int | Always. source | string | Always external (1). entry_type | int | . expires | int | . expire_time | string | Seconds. service_ | join | Prefix for attributes from implicit join with services table. host_ | join | Prefix for attributes from implicit join with hosts table. #### Livestatus Downtimes Table Attributes Key | Type | Note ----------------------|-----------|------------------------- author | string | . comment | string | . id | int | legacy_id. entry_time | string | Seconds. type | int | 1=active, 0=pending. is_service | int | . start_time | string | Seconds. end_time | string | Seconds. fixed | int | 0=flexible, 1=fixed. duration | int | . triggered_by | int | legacy_id. triggers | int | NEW in Icinga 2. trigger_time | string | NEW in Icinga 2. service_ | join | Prefix for attributes from implicit join with services table. host_ | join | Prefix for attributes from implicit join with hosts table. #### Livestatus Timeperiod Table Attributes Key | Type | Note ----------------------|-----------|------------------------- name | string | . alias | string | `display_name` attribute. in | int | Current time is in timeperiod or not. #### Livestatus Log Table Attributes Key | Type | Note ----------------------|-----------|------------------------- time | int | Time of log event (unix timestamp). lineno | int | Line number in `CompatLogger` log file. class | int | Log message class: 0=info, 1=state, 2=program, 3=notification, 4=passive, 5=command. message | string | Complete message line. type | string | Text before the colon `:`. options | string | Text after the colon `:`. comment | string | Comment if available. plugin_output | string | Check output if available. state | int | Host or service state. state_type | int | State type if available. attempt | int | Current check attempt. service_description | string | . host_name | string | . contact_name | string | . command_name | string | . current_service_ | join | Prefix for attributes from implicit join with services table. current_host_ | join | Prefix for attributes from implicit join with hosts table. current_contact_ | join | Prefix for attributes from implicit join with contacts table. current_command_ | join | Prefix for attributes from implicit join with commands table. #### Livestatus Statehist Table Attributes Key | Type | Note ----------------------|-----------|------------------------- time | int | Time of log event (unix timestamp). lineno | int | Line number in `CompatLogger` log file. from | int | Start timestamp (unix timestamp). until | int | End timestamp (unix timestamp). duration | int | until-from. duration_part | double | duration / query_part. state | int | State: 0=ok, 1=warn, 2=crit, 3=unknown, -1=notmonitored. host_down | int | Host associated with the service is down or not. in_downtime | int | Host/service is in downtime. in_host_downtime | int | Host associated with the service is in a downtime or not. is_flapping | int | Host/service is flapping. in_notification_period | int | Host/service notification periods match or not. notification_period | string | Host/service notification period. host_name | string | . service_description | string | . log_output | string | Log file output for this state. duration_ok | int | until-from for OK state. duration_part_ok | double | . duration_warning | int | until-from for Warning state. duration_part_warning | double | . duration_critical | int | until-from for Critical state. duration_part_critical | double | . duration_unknown | int | until-from for Unknown state. duration_part_unknown | double | . duration_unmonitored | int | until-from for Not-Monitored state. duration_part_unmonitored | double | . current_service_ | join | Prefix for attributes from implicit join with services table. current_host_ | join | Prefix for attributes from implicit join with hosts table. Not supported: `debug_info`. #### Livestatus Hostsbygroup Table Attributes All (hosts)[19-appendix.md#schema-livestatus-hosts-table-attributes] table attributes grouped with the (hostgroups)[19-appendix.md#schema-livestatus-hostgroups-table-attributes] table prefixed with `hostgroup_`. #### Livestatus Servicesbygroup Table Attributes All (services)[19-appendix.md#schema-livestatus-services-table-attributes] table attributes grouped with the (servicegroups)[19-appendix.md#schema-livestatus-servicegroups-table-attributes] table prefixed with `servicegroup_`. #### Livestatus Servicesbyhostgroup Table Attributes All (services)[19-appendix.md#schema-livestatus-services-table-attributes] table attributes grouped with the (hostgroups)[19-appendix.md#schema-livestatus-hostgroups-table-attributes] table prefixed with `hostgroup_`. icinga2-2.4.1/doc/3-monitoring-basics.md000066400000000000000000002251321262555626500177330ustar00rootroot00000000000000# Monitoring Basics This part of the Icinga 2 documentation provides an overview of all the basic monitoring concepts you need to know to run Icinga 2. Keep in mind these examples are made with a linux server in mind, if you are using Windows you will need to change the services accordingly. See the [ITL reference](7-icinga-template-library.md#windows-plugins) for further information. ## Hosts and Services Icinga 2 can be used to monitor the availability of hosts and services. Hosts and services can be virtually anything which can be checked in some way: * Network services (HTTP, SMTP, SNMP, SSH, etc.) * Printers * Switches / routers * Temperature sensors * Other local or network-accessible services Host objects provide a mechanism to group services that are running on the same physical device. Here is an example of a host object which defines two child services: object Host "my-server1" { address = "10.0.0.1" check_command = "hostalive" } object Service "ping4" { host_name = "my-server1" check_command = "ping4" } object Service "http" { host_name = "my-server1" check_command = "http" } The example creates two services `ping4` and `http` which belong to the host `my-server1`. It also specifies that the host should perform its own check using the `hostalive` check command. The `address` attribute is used by check commands to determine which network address is associated with the host object. Details on troubleshooting check problems can be found [here](16-troubleshooting.md#troubleshooting). ### Host States Hosts can be in any of the following states: Name | Description ------------|-------------- UP | The host is available. DOWN | The host is unavailable. ### Service States Services can be in any of the following states: Name | Description ------------|-------------- OK | The service is working properly. WARNING | The service is experiencing some problems but is still considered to be in working condition. CRITICAL | The service is in a critical state. UNKNOWN | The check could not determine the service's state. ### Hard and Soft States When detecting a problem with a host/service Icinga re-checks the object a number of times (based on the `max_check_attempts` and `retry_interval` settings) before sending notifications. This ensures that no unnecessary notifications are sent for transient failures. During this time the object is in a `SOFT` state. After all re-checks have been executed and the object is still in a non-OK state the host/service switches to a `HARD` state and notifications are sent. Name | Description ------------|-------------- HARD | The host/service's state hasn't recently changed. SOFT | The host/service has recently changed state and is being re-checked. ### Host and Service Checks Hosts and services determine their state by running checks in a regular interval. object Host "router" { check_command = "hostalive" address = "10.0.0.1" } The `hostalive` command is one of several built-in check commands. It sends ICMP echo requests to the IP address specified in the `address` attribute to determine whether a host is online. A number of other [built-in check commands](7-icinga-template-library.md#plugin-check-commands) are also available. In addition to these commands the next few chapters will explain in detail how to set up your own check commands. ## Templates Templates may be used to apply a set of identical attributes to more than one object: template Service "generic-service" { max_check_attempts = 3 check_interval = 5m retry_interval = 1m enable_perfdata = true } apply Service "ping4" { import "generic-service" check_command = "ping4" assign where host.address } apply Service "ping6" { import "generic-service" check_command = "ping6" assign where host.address6 } In this example the `ping4` and `ping6` services inherit properties from the template `generic-service`. Objects as well as templates themselves can import an arbitrary number of other templates. Attributes inherited from a template can be overridden in the object if necessary. You can also import existing non-template objects. Note that templates and objects share the same namespace, i.e. you can't define a template that has the same name like an object. ## Custom Attributes In addition to built-in attributes you can define your own attributes: object Host "localhost" { vars.ssh_port = 2222 } Valid values for custom attributes include: * [Strings](18-language-reference.md#string-literals), [numbers](18-language-reference.md#numeric-literals) and [booleans](18-language-reference.md#boolean-literals) * [Arrays](18-language-reference.md#array) and [dictionaries](18-language-reference.md#dictionary) * [Functions](3-monitoring-basics.md#custom-attributes-functions) ### Functions as Custom Attributes Icinga 2 lets you specify [functions](18-language-reference.md#functions) for custom attributes. The special case here is that whenever Icinga 2 needs the value for such a custom attribute it runs the function and uses whatever value the function returns: object CheckCommand "random-value" { import "plugin-check-command" command = [ PluginDir + "/check_dummy", "0", "$text$" ] vars.text = {{ Math.random() * 100 }} } This example uses the [abbreviated lambda syntax](18-language-reference.md#nullary-lambdas). These functions have access to a number of variables: Variable | Description -------------|--------------- user | The User object (for notifications). service | The Service object (for service checks/notifications/event handlers). host | The Host object. command | The command object (e.g. a CheckCommand object for checks). Here's an example: vars.text = {{ host.check_interval }} In addition to these variables the `macro` function can be used to retrieve the value of arbitrary macro expressions: vars.text = {{ if (macro("$address$") == "127.0.0.1") { log("Running a check for localhost!") } return "Some text" }} The `resolve_arguments` can be used to resolve a command and its arguments much in the same fashion Icinga does this for the `command` and `arguments` attributes for commands. The `by_ssh` command uses this functionality to let users specify a command and arguments that should be executed via SSH: arguments = { "-C" = {{ var command = macro("$by_ssh_command$") var arguments = macro("$by_ssh_arguments$") if (typeof(command) == String && !arguments) { return command } var escaped_args = [] for (arg in resolve_arguments(command, arguments)) { escaped_args.add(escape_shell_arg(arg)) } return escaped_args.join(" ") }} ... } Acessing object attributes at runtime inside these functions is described in the [advanced topics](5-advanced-topics.md#access-object-attributes-at-runtime) chapter. ## Runtime Macros Macros can be used to access other objects' attributes at runtime. For example they are used in command definitions to figure out which IP address a check should be run against: object CheckCommand "my-ping" { import "plugin-check-command" command = [ PluginDir + "/check_ping", "-H", "$ping_address$" ] arguments = { "-w" = "$ping_wrta$,$ping_wpl$%" "-c" = "$ping_crta$,$ping_cpl$%" "-p" = "$ping_packets$" } vars.ping_address = "$address$" vars.ping_wrta = 100 vars.ping_wpl = 5 vars.ping_crta = 250 vars.ping_cpl = 10 vars.ping_packets = 5 } object Host "router" { check_command = "my-ping" address = "10.0.0.1" } In this example we are using the `$address$` macro to refer to the host's `address` attribute. We can also directly refer to custom attributes, e.g. by using `$ping_wrta$`. Icinga automatically tries to find the closest match for the attribute you specified. The exact rules for this are explained in the next section. > **Note** > > When using the `$` sign as single character you must escape it with an > additional dollar character (`$$`). ### Evaluation Order When executing commands Icinga 2 checks the following objects in this order to look up macros and their respective values: 1. User object (only for notifications) 2. Service object 3. Host object 4. Command object 5. Global custom attributes in the `Vars` constant This execution order allows you to define default values for custom attributes in your command objects. Here's how you can override the custom attribute `ping_packets` from the previous example: object Service "ping" { host_name = "localhost" check_command = "my-ping" vars.ping_packets = 10 // Overrides the default value of 5 given in the command } If a custom attribute isn't defined anywhere an empty value is used and a warning is written to the Icinga 2 log. You can also directly refer to a specific attribute - thereby ignoring these evaluation rules - by specifying the full attribute name: $service.vars.ping_wrta$ This retrieves the value of the `ping_wrta` custom attribute for the service. This returns an empty value if the service does not have such a custom attribute no matter whether another object such as the host has this attribute. ### Host Runtime Macros The following host custom attributes are available in all commands that are executed for hosts or services: Name | Description -----------------------------|-------------- host.name | The name of the host object. host.display_name | The value of the `display_name` attribute. host.state | The host's current state. Can be one of `UNREACHABLE`, `UP` and `DOWN`. host.state_id | The host's current state. Can be one of `0` (up), `1` (down) and `2` (unreachable). host.state_type | The host's current state type. Can be one of `SOFT` and `HARD`. host.check_attempt | The current check attempt number. host.max_check_attempts | The maximum number of checks which are executed before changing to a hard state. host.last_state | The host's previous state. Can be one of `UNREACHABLE`, `UP` and `DOWN`. host.last_state_id | The host's previous state. Can be one of `0` (up), `1` (down) and `2` (unreachable). host.last_state_type | The host's previous state type. Can be one of `SOFT` and `HARD`. host.last_state_change | The last state change's timestamp. host.downtime_depth | The number of active downtimes. host.duration_sec | The time since the last state change. host.latency | The host's check latency. host.execution_time | The host's check execution time. host.output | The last check's output. host.perfdata | The last check's performance data. host.last_check | The timestamp when the last check was executed. host.check_source | The monitoring instance that performed the last check. host.num_services | Number of services associated with the host. host.num_services_ok | Number of services associated with the host which are in an `OK` state. host.num_services_warning | Number of services associated with the host which are in a `WARNING` state. host.num_services_unknown | Number of services associated with the host which are in an `UNKNOWN` state. host.num_services_critical | Number of services associated with the host which are in a `CRITICAL` state. ### Service Runtime Macros The following service macros are available in all commands that are executed for services: Name | Description ---------------------------|-------------- service.name | The short name of the service object. service.display_name | The value of the `display_name` attribute. service.check_command | The short name of the command along with any arguments to be used for the check. service.state | The service's current state. Can be one of `OK`, `WARNING`, `CRITICAL` and `UNKNOWN`. service.state_id | The service's current state. Can be one of `0` (ok), `1` (warning), `2` (critical) and `3` (unknown). service.state_type | The service's current state type. Can be one of `SOFT` and `HARD`. service.check_attempt | The current check attempt number. service.max_check_attempts | The maximum number of checks which are executed before changing to a hard state. service.last_state | The service's previous state. Can be one of `OK`, `WARNING`, `CRITICAL` and `UNKNOWN`. service.last_state_id | The service's previous state. Can be one of `0` (ok), `1` (warning), `2` (critical) and `3` (unknown). service.last_state_type | The service's previous state type. Can be one of `SOFT` and `HARD`. service.last_state_change | The last state change's timestamp. service.downtime_depth | The number of active downtimes. service.duration_sec | The time since the last state change. service.latency | The service's check latency. service.execution_time | The service's check execution time. service.output | The last check's output. service.perfdata | The last check's performance data. service.last_check | The timestamp when the last check was executed. service.check_source | The monitoring instance that performed the last check. ### Command Runtime Macros The following custom attributes are available in all commands: Name | Description -----------------------|-------------- command.name | The name of the command object. ### User Runtime Macros The following custom attributes are available in all commands that are executed for users: Name | Description -----------------------|-------------- user.name | The name of the user object. user.display_name | The value of the display_name attribute. ### Notification Runtime Macros Name | Description -----------------------|-------------- notification.type | The type of the notification. notification.author | The author of the notification comment, if existing. notification.comment | The comment of the notification, if existing. ### Global Runtime Macros The following macros are available in all executed commands: Name | Description -----------------------|-------------- icinga.timet | Current UNIX timestamp. icinga.long_date_time | Current date and time including timezone information. Example: `2014-01-03 11:23:08 +0000` icinga.short_date_time | Current date and time. Example: `2014-01-03 11:23:08` icinga.date | Current date. Example: `2014-01-03` icinga.time | Current time including timezone information. Example: `11:23:08 +0000` icinga.uptime | Current uptime of the Icinga 2 process. The following macros provide global statistics: Name | Description ----------------------------------|-------------- icinga.num_services_ok | Current number of services in state 'OK'. icinga.num_services_warning | Current number of services in state 'Warning'. icinga.num_services_critical | Current number of services in state 'Critical'. icinga.num_services_unknown | Current number of services in state 'Unknown'. icinga.num_services_pending | Current number of pending services. icinga.num_services_unreachable | Current number of unreachable services. icinga.num_services_flapping | Current number of flapping services. icinga.num_services_in_downtime | Current number of services in downtime. icinga.num_services_acknowledged | Current number of acknowledged service problems. icinga.num_hosts_up | Current number of hosts in state 'Up'. icinga.num_hosts_down | Current number of hosts in state 'Down'. icinga.num_hosts_unreachable | Current number of unreachable hosts. icinga.num_hosts_flapping | Current number of flapping hosts. icinga.num_hosts_in_downtime | Current number of hosts in downtime. icinga.num_hosts_acknowledged | Current number of acknowledged host problems. ## Apply Rules Instead of assigning each object ([Service](6-object-types.md#objecttype-service), [Notification](6-object-types.md#objecttype-notification), [Dependency](6-object-types.md#objecttype-dependency), [ScheduledDowntime](6-object-types.md#objecttype-scheduleddowntime)) based on attribute identifiers for example `host_name` objects can be [applied](18-language-reference.md#apply). Before you start using the apply rules keep the following in mind: * Define the best match. * A set of unique [custom attributes](3-monitoring-basics.md#custom-attributes) for these hosts/services? * Or [group](3-monitoring-basics.md#groups) memberships, e.g. a host being a member of a hostgroup, applying services to it? * A generic pattern [match](18-language-reference.md#function-calls) on the host/service name? * [Multiple expressions combined](3-monitoring-basics.md#using-apply-expressions) with `&&` or `||` [operators](18-language-reference.md#expression-operators) * All expressions must return a boolean value (an empty string is equal to `false` e.g.) > **Note** > > You can set/override object attributes in apply rules using the respectively available > objects in that scope (host and/or service objects). [Custom attributes](3-monitoring-basics.md#custom-attributes) can also store nested dictionaries and arrays. That way you can use them for not only matching for their existance or values in apply expressions, but also assign ("inherit") their values into the generated objected from apply rules. * [Apply services to hosts](3-monitoring-basics.md#using-apply-services) * [Apply notifications to hosts and services](3-monitoring-basics.md#using-apply-notifications) * [Apply dependencies to hosts and services](3-monitoring-basics.md#using-apply-dependencies) * [Apply scheduled downtimes to hosts and services](3-monitoring-basics.md#using-apply-scheduledowntimes) A more advanced example is using [apply with for loops on arrays or dictionaries](3-monitoring-basics.md#using-apply-for) for example provided by [custom atttributes](3-monitoring-basics.md#custom-attributes) or groups. > **Tip** > > Building configuration in that dynamic way requires detailed information > of the generated objects. Use the `object list` [CLI command](8-cli-commands.md#cli-command-object) > after successful [configuration validation](8-cli-commands.md#config-validation). ### Apply Rules Expressions You can use simple or advanced combinations of apply rule expressions. Each expression must evaluate into the boolean `true` value. An empty string will be for instance interpreted as `false`. In a similar fashion undefined attributes will return `false`. Returns `false`: assign where host.vars.attribute_does_not_exist Multiple `assign where` condition rows are evaluated as `OR` condition. You can combine multiple expressions for matching only a subset of objects. In some cases, you want to be able to add more than one assign/ignore where expression which matches a specific condition. To achieve this you can use the logical `and` and `or` operators. Match all `*mysql*` patterns in the host name and (`&&`) custom attribute `prod_mysql_db` matches the `db-*` pattern. All hosts with the custom attribute `test_server` set to `true` should be ignored, or any host name ending with `*internal` pattern. object HostGroup "mysql-server" { display_name = "MySQL Server" assign where match("*mysql*", host.name) && match("db-*", host.vars.prod_mysql_db) ignore where host.vars.test_server == true ignore where match("*internal", host.name) } Similar example for advanced notification apply rule filters: If the service attribute `notes` contains the `has gold support 24x7` string `AND` one of the two condition passes: Either the `customer` host custom attribute is set to `customer-xy` `OR` the host custom attribute `always_notify` is set to `true`. The notification is ignored for services whose host name ends with `*internal` `OR` the `priority` custom attribute is [less than](18-language-reference.md#expression-operators) `2`. template Notification "cust-xy-notification" { users = [ "noc-xy", "mgmt-xy" ] command = "mail-service-notification" } apply Notification "notify-cust-xy-mysql" to Service { import "cust-xy-notification" assign where match("*has gold support 24x7*", service.notes) && (host.vars.customer == "customer-xy" || host.vars.always_notify == true) ignore where match("*internal", host.name) || (service.vars.priority < 2 && host.vars.is_clustered == true) } ### Apply Services to Hosts The sample configuration already includes a detailed example in [hosts.conf](4-configuring-icinga-2.md#hosts-conf) and [services.conf](4-configuring-icinga-2.md#services-conf) for this use case. The example for `ssh` applies a service object to all hosts with the `address` attribute being defined and the custom attribute `os` set to the string `Linux` in `vars`. apply Service "ssh" { import "generic-service" check_command = "ssh" assign where host.address && host.vars.os == "Linux" } Other detailed scenario examples are used in their respective chapters, for example [apply services with custom command arguments](3-monitoring-basics.md#command-passing-parameters). ### Apply Notifications to Hosts and Services Notifications are applied to specific targets (`Host` or `Service`) and work in a similar manner: apply Notification "mail-noc" to Service { import "mail-service-notification" user_groups = [ "noc" ] assign where host.vars.notification.mail } In this example the `mail-noc` notification will be created as object for all services having the `notification.mail` custom attribute defined. The notification command is set to `mail-service-notification` and all members of the user group `noc` will get notified. It is also possible to generally apply a notification template and dynamically overwrite values from the template by checking for custom attributes. This can be achieved by using [conditional statements](18-language-reference.md#conditional-statements): apply Notification "host-mail-noc" to Host { import "mail-host-notification" // replace interval inherited from `mail-host-notification` template with new notfication interval set by a host custom attribute if (host.vars.notification_interval) { interval = host.vars.notification_interval } // same with notification period if (host.vars.notification_period) { period = host.vars.notification_period } // Send SMS instead of email if the host's custom attribute `notification_type` is set to `sms` if (host.vars.notification_type == "sms") { command = "sms-host-notification" } else { command = "mail-host-notification" } user_groups = [ "noc" ] assign where host.address } In the example above, the notification template `mail-host-notification`, which contains all relevant notification settings, is applied on all host objects where the `host.address` is defined. Each host object is then checked for custom attributes (`host.vars.notification_interval`, `host.vars.notification_period` and `host.vars.notification_type`). Depending if the custom attibute is set or which value it has, the value from the notification template is dynamically overwritten. The corresponding Host object could look like this: object Host "host1" { import "host-linux-prod" display_name = "host1" address = "192.168.1.50" vars.notification_interval = 1h vars.notification_period = "24x7" vars.notification_type = "sms" } ### Apply Dependencies to Hosts and Services Detailed examples can be found in the [dependencies](3-monitoring-basics.md#dependencies) chapter. ### Apply Recurring Downtimes to Hosts and Services The sample configuration includes an example in [downtimes.conf](4-configuring-icinga-2.md#downtimes-conf). Detailed examples can be found in the [recurring downtimes](5-advanced-topics.md#recurring-downtimes) chapter. ### Using Apply For Rules Next to the standard way of using [apply rules](3-monitoring-basics.md#using-apply) there is the requirement of applying objects based on a set (array or dictionary) using [apply for](18-language-reference.md#apply-for) expressions. The sample configuration already includes a detailed example in [hosts.conf](4-configuring-icinga-2.md#hosts-conf) and [services.conf](4-configuring-icinga-2.md#services-conf) for this use case. Take the following example: A host provides the snmp oids for different service check types. This could look like the following example: object Host "router-v6" { check_command = "hostalive" address6 = "::1" vars.oids["if01"] = "1.1.1.1.1" vars.oids["temp"] = "1.1.1.1.2" vars.oids["bgp"] = "1.1.1.1.5" } Now we want to create service checks for `if01` and `temp` but not `bgp`. Furthermore we want to pass the snmp oid stored as dictionary value to the custom attribute called `vars.snmp_oid` - this is the command argument required by the [snmp](7-icinga-template-library.md#plugin-check-command-snmp) check command. The service's `display_name` should be set to the identifier inside the dictionary. apply Service for (identifier => oid in host.vars.oids) { check_command = "snmp" display_name = identifier vars.snmp_oid = oid ignore where identifier == "bgp" //don't generate service for bgp checks } Icinga 2 evaluates the `apply for` rule for all objects with the custom attribute `oids` set. It then iterates over all list items inside the `for` loop and evaluates the `assign/ignore where` expressions. You can access the loop variable in these expressions, e.g. for ignoring certain values. In this example we'd ignore the `bgp` identifier and avoid generating an unwanted service. We could extend the configuration by also matching the `oid` value on certain regex/wildcard patterns for example. > **Note** > > You don't need an `assign where` expression only checking for existance > of the custom attribute. That way you'll save duplicated apply rules by combining them into one generic `apply for` rule generating the object name with or without a prefix. #### Apply For and Custom Attribute Override Imagine a different more advanced example: You are monitoring your network device (host) with many interfaces (services). The following requirements/problems apply: * Each interface service check should be named with a prefix and a name defined in your host object (which could be generated from your CMDB, etc) * Each interface has its own vlan tag * Some interfaces have QoS enabled * Additional attributes such as `display_name` or `notes`, `notes_url` and `action_url` must be dynamically generated Tip: Define the snmp community as global constant in your [constants.conf](4-configuring-icinga-2.md#constants-conf) file. const IftrafficSnmpCommunity = "public" By defining the `interfaces` dictionary with three example interfaces on the `cisco-catalyst-6509-34` host object, you'll make sure to pass the [custom attribute](3-monitoring-basics.md#custom-attributes) storage required by the for loop in the service apply rule. object Host "cisco-catalyst-6509-34" { import "generic-host" display_name = "Catalyst 6509 #34 VIE21" address = "127.0.1.4" /* "GigabitEthernet0/2" is the interface name, * and key name in service apply for later on */ vars.interfaces["GigabitEthernet0/2"] = { /* define all custom attributes with the * same name required for command parameters/arguments * in service apply (look into your CheckCommand definition) */ iftraffic_units = "g" iftraffic_community = IftrafficSnmpCommunity iftraffic_bandwidth = 1 vlan = "internal" qos = "disabled" } vars.interfaces["GigabitEthernet0/4"] = { iftraffic_units = "g" //iftraffic_community = IftrafficSnmpCommunity iftraffic_bandwidth = 1 vlan = "renote" qos = "enabled" } vars.interfaces["MgmtInterface1"] = { iftraffic_community = IftrafficSnmpCommunity vlan = "mgmt" interface_address = "127.99.0.100" #special management ip } } You can also omit the `"if-"` string, then all generated service names are directly taken from the `if_name` variable value. The config dictionary contains all key-value pairs for the specific interface in one loop cycle, like `iftraffic_units`, `vlan`, and `qos` for the specified interface. You can either map the custom attributes from the `interface_config` dictionary to local custom attributes stashed into `vars`. If the names match the required command argument parameters already (for example `iftraffic_units`), you could also add the `interface_config` dictionary to the `vars` dictionary using the `+=` operator. After `vars` is fully populated, all object attributes can be set calculated from provided host attributes. For strings, you can use string concatention with the `+` operator. You can also specifiy the display_name, check command, interval, notes, notes_url, action_url, etc. attributes that way. Attribute strings can be [concatenated](18-language-reference.md#expression-operators), for example for adding a more detailed service `display_name`. This example also uses [if conditions](18-language-reference.md#conditional-statements) if specific values are not set, adding a local default value. The other way around you can override specific custom attributes inherited from a service template, if set. /* loop over the host.vars.interfaces dictionary * for (key => value in dict) means `interface_name` as key * and `interface_config` as value. Access config attributes * with the indexer (`.`) character. */ apply Service "if-" for (interface_name => interface_config in host.vars.interfaces) { import "generic-service" check_command = "iftraffic" display_name = "IF-" + interface_name /* use the key as command argument (no duplication of values in host.vars.interfaces) */ vars.iftraffic_interface = interface_name /* map the custom attributes as command arguments */ vars.iftraffic_units = interface_config.iftraffic_units vars.iftraffic_community = interface_config.iftraffic_community /* the above can be achieved in a shorter fashion if the names inside host.vars.interfaces * are the _exact_ same as required as command parameter by the check command * definition. */ vars += interface_config /* set a default value for units and bandwidth */ if (interface_config.iftraffic_units == "") { vars.iftraffic_units = "m" } if (interface_config.iftraffic_bandwidth == "") { vars.iftraffic_bandwidth = 1 } if (interface_config.vlan == "") { vars.vlan = "not set" } if (interface_config.qos == "") { vars.qos = "not set" } /* set the global constant if not explicitely * not provided by the `interfaces` dictionary on the host */ if (len(interface_config.iftraffic_community) == 0 || len(vars.iftraffic_community) == 0) { vars.iftraffic_community = IftrafficSnmpCommunity } /* Calculate some additional object attributes after populating the `vars` dictionary */ notes = "Interface check for " + interface_name + " (units: '" + interface_config.iftraffic_units + "') in VLAN '" + vars.vlan + "' with ' QoS '" + vars.qos + "'" notes_url = "http://foreman.company.com/hosts/" + host.name action_url = "http://snmp.checker.company.com/" + host.name + "/if-" + interface_name } This example makes use of the [check_iftraffic](https://exchange.icinga.org/exchange/iftraffic) plugin. The `CheckCommand` definition can be found in the [contributed plugin check commands](7-icinga-template-library.md#plugins-contrib-command-iftraffic) - make sure to include them in your [icinga2 configuration file](4-configuring-icinga-2.md#icinga2-conf). > **Tip** > > Building configuration in that dynamic way requires detailed information > of the generated objects. Use the `object list` [CLI command](8-cli-commands.md#cli-command-object) > after successful [configuration validation](8-cli-commands.md#config-validation). Verify that the apply-for-rule successfully created the service objects with the inherited custom attributes: # icinga2 daemon -C # icinga2 object list --type Service --name *catalyst* Object 'cisco-catalyst-6509-34!if-GigabitEthernet0/2' of type 'Service': ...... * vars % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 59:3-59:26 * iftraffic_bandwidth = 1 * iftraffic_community = "public" % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 53:3-53:65 * iftraffic_interface = "GigabitEthernet0/2" % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 49:3-49:43 * iftraffic_units = "g" % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 52:3-52:57 * qos = "disabled" * vlan = "internal" Object 'cisco-catalyst-6509-34!if-GigabitEthernet0/4' of type 'Service': ... * vars % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 59:3-59:26 * iftraffic_bandwidth = 1 * iftraffic_community = "public" % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 53:3-53:65 % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 79:5-79:53 * iftraffic_interface = "GigabitEthernet0/4" % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 49:3-49:43 * iftraffic_units = "g" % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 52:3-52:57 * qos = "enabled" * vlan = "renote" Object 'cisco-catalyst-6509-34!if-MgmtInterface1' of type 'Service': ... * vars % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 59:3-59:26 * iftraffic_bandwidth = 1 % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 66:5-66:32 * iftraffic_community = "public" % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 53:3-53:65 * iftraffic_interface = "MgmtInterface1" % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 49:3-49:43 * iftraffic_units = "m" % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 52:3-52:57 % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 63:5-63:30 * interface_address = "127.99.0.100" * qos = "not set" % = modified in '/etc/icinga2/conf.d/iftraffic.conf', lines 72:5-72:24 * vlan = "mgmt" ### Use Object Attributes in Apply Rules Since apply rules are evaluated after the generic objects, you can reference existing host and/or service object attributes as values for any object attribute specified in that apply rule. object Host "opennebula-host" { import "generic-host" address = "10.1.1.2" vars.hosting["xyz"] = { http_uri = "/shop" customer_name = "Customer xyz" customer_id = "7568" support_contract = "gold" } vars.hosting["abc"] = { http_uri = "/shop" customer_name = "Customer xyz" customer_id = "7568" support_contract = "silver" } } apply Service for (customer => config in host.vars.hosting) { import "generic-service" check_command = "ping4" vars.qos = "disabled" vars += config vars.http_uri = "/" + vars.customer + "/" + config.http_uri display_name = "Shop Check for " + vars.customer_name + "-" + vars.customer_id notes = "Support contract: " + vars.support_contract + " for Customer " + vars.customer_name + " (" + vars.customer_id + ")." notes_url = "http://foreman.company.com/hosts/" + host.name action_url = "http://snmp.checker.company.com/" + host.name + "/" + vars.customer_id } ## Groups A group is a collection of similar objects. Groups are primarily used as a visualization aid in web interfaces. Group membership is defined at the respective object itself. If you have a hostgroup name `windows` for example, and want to assign specific hosts to this group for later viewing the group on your alert dashboard, first create a HostGroup object: object HostGroup "windows" { display_name = "Windows Servers" } Then add your hosts to this group: template Host "windows-server" { groups += [ "windows" ] } object Host "mssql-srv1" { import "windows-server" vars.mssql_port = 1433 } object Host "mssql-srv2" { import "windows-server" vars.mssql_port = 1433 } This can be done for service and user groups the same way: object UserGroup "windows-mssql-admins" { display_name = "Windows MSSQL Admins" } template User "generic-windows-mssql-users" { groups += [ "windows-mssql-admins" ] } object User "win-mssql-noc" { import "generic-windows-mssql-users" email = "noc@example.com" } object User "win-mssql-ops" { import "generic-windows-mssql-users" email = "ops@example.com" } ### Group Membership Assign Instead of manually assigning each object to a group you can also assign objects to a group based on their attributes: object HostGroup "prod-mssql" { display_name = "Production MSSQL Servers" assign where host.vars.mssql_port && host.vars.prod_mysql_db ignore where host.vars.test_server == true ignore where match("*internal", host.name) } In this example all hosts with the `vars` attribute `mssql_port` will be added as members to the host group `mssql`. However, all `\*internal` hosts or with the `test_server` attribute set to `true` are not added to this group. Details on the `assign where` syntax can be found in the [Language Reference](18-language-reference.md#apply) ## Notifications Notifications for service and host problems are an integral part of your monitoring setup. When a host or service is in a downtime, a problem has been acknowledged or the dependency logic determined that the host/service is unreachable, no notifications are sent. You can configure additional type and state filters refining the notifications being actually sent. There are many ways of sending notifications, e.g. by e-mail, XMPP, IRC, Twitter, etc. On its own Icinga 2 does not know how to send notifications. Instead it relies on external mechanisms such as shell scripts to notify users. More notification methods are listed in the [addons and plugins](14-addons-plugins.md#notification-scripts-interfaces) chapter. A notification specification requires one or more users (and/or user groups) who will be notified in case of problems. These users must have all custom attributes defined which will be used in the `NotificationCommand` on execution. The user `icingaadmin` in the example below will get notified only on `WARNING` and `CRITICAL` states and `problem` and `recovery` notification types. object User "icingaadmin" { display_name = "Icinga 2 Admin" enable_notifications = true states = [ OK, Warning, Critical ] types = [ Problem, Recovery ] email = "icinga@localhost" } If you don't set the `states` and `types` configuration attributes for the `User` object, notifications for all states and types will be sent. Details on troubleshooting notification problems can be found [here](16-troubleshooting.md#troubleshooting). > **Note** > > Make sure that the [notification](8-cli-commands.md#enable-features) feature is enabled > in order to execute notification commands. You should choose which information you (and your notified users) are interested in case of emergency, and also which information does not provide any value to you and your environment. An example notification command is explained [here](3-monitoring-basics.md#notification-commands). You can add all shared attributes to a `Notification` template which is inherited to the defined notifications. That way you'll save duplicated attributes in each `Notification` object. Attributes can be overridden locally. template Notification "generic-notification" { interval = 15m command = "mail-service-notification" states = [ Warning, Critical, Unknown ] types = [ Problem, Acknowledgement, Recovery, Custom, FlappingStart, FlappingEnd, DowntimeStart, DowntimeEnd, DowntimeRemoved ] period = "24x7" } The time period `24x7` is included as example configuration with Icinga 2. Use the `apply` keyword to create `Notification` objects for your services: apply Notification "notify-cust-xy-mysql" to Service { import "generic-notification" users = [ "noc-xy", "mgmt-xy" ] assign where match("*has gold support 24x7*", service.notes) && (host.vars.customer == "customer-xy" || host.vars.always_notify == true ignore where match("*internal", host.name) || (service.vars.priority < 2 && host.vars.is_clustered == true) } Instead of assigning users to notifications, you can also add the `user_groups` attribute with a list of user groups to the `Notification` object. Icinga 2 will send notifications to all group members. > **Note** > > Only users who have been notified of a problem before (`Warning`, `Critical`, `Unknown` > states for services, `Down` for hosts) will receive `Recovery` notifications. ### Notification Escalations When a problem notification is sent and a problem still exists at the time of re-notification you may want to escalate the problem to the next support level. A different approach is to configure the default notification by email, and escalate the problem via SMS if not already solved. You can define notification start and end times as additional configuration attributes making the `Notification` object a so-called `notification escalation`. Using templates you can share the basic notification attributes such as users or the `interval` (and override them for the escalation then). Using the example from above, you can define additional users being escalated for SMS notifications between start and end time. object User "icinga-oncall-2nd-level" { display_name = "Icinga 2nd Level" vars.mobile = "+1 555 424642" } object User "icinga-oncall-1st-level" { display_name = "Icinga 1st Level" vars.mobile = "+1 555 424642" } Define an additional [NotificationCommand](3-monitoring-basics.md#notification-commands) for SMS notifications. > **Note** > > The example is not complete as there are many different SMS providers. > Please note that sending SMS notifications will require an SMS provider > or local hardware with a SIM card active. object NotificationCommand "sms-notification" { command = [ PluginDir + "/send_sms_notification", "$mobile$", "..." } The two new notification escalations are added onto the local host and its service `ping4` using the `generic-notification` template. The user `icinga-oncall-2nd-level` will get notified by SMS (`sms-notification` command) after `30m` until `1h`. > **Note** > > The `interval` was set to 15m in the `generic-notification` > template example. Lower that value in your escalations by using a secondary > template or by overriding the attribute directly in the `notifications` array > position for `escalation-sms-2nd-level`. If the problem does not get resolved nor acknowledged preventing further notifications the `escalation-sms-1st-level` user will be escalated `1h` after the initial problem was notified, but only for one hour (`2h` as `end` key for the `times` dictionary). apply Notification "mail" to Service { import "generic-notification" command = "mail-notification" users = [ "icingaadmin" ] assign where service.name == "ping4" } apply Notification "escalation-sms-2nd-level" to Service { import "generic-notification" command = "sms-notification" users = [ "icinga-oncall-2nd-level" ] times = { begin = 30m end = 1h } assign where service.name == "ping4" } apply Notification "escalation-sms-1st-level" to Service { import "generic-notification" command = "sms-notification" users = [ "icinga-oncall-1st-level" ] times = { begin = 1h end = 2h } assign where service.name == "ping4" } ### Notification Delay Sometimes the problem in question should not be notified when the notification is due (the object reaching the `HARD` state) but a defined time duration afterwards. In Icinga 2 you can use the `times` dictionary and set `begin = 15m` as key and value if you want to postpone the notification window for 15 minutes. Leave out the `end` key - if not set, Icinga 2 will not check against any end time for this notification. Make sure to specify a relatively low notification `interval` to get notified soon enough again. apply Notification "mail" to Service { import "generic-notification" command = "mail-notification" users = [ "icingaadmin" ] interval = 5m times.begin = 15m // delay notification window assign where service.name == "ping4" } ### Disable Re-notifications If you prefer to be notified only once, you can disable re-notifications by setting the `interval` attribute to `0`. apply Notification "notify-once" to Service { import "generic-notification" command = "mail-notification" users = [ "icingaadmin" ] interval = 0 // disable re-notification assign where service.name == "ping4" } ### Notification Filters by State and Type If there are no notification state and type filter attributes defined at the `Notification` or `User` object Icinga 2 assumes that all states and types are being notified. Available state and type filters for notifications are: template Notification "generic-notification" { states = [ Warning, Critical, Unknown ] types = [ Problem, Acknowledgement, Recovery, Custom, FlappingStart, FlappingEnd, DowntimeStart, DowntimeEnd, DowntimeRemoved ] } If you are familiar with Icinga 1.x `notification_options` please note that they have been split into type and state to allow more fine granular filtering for example on downtimes and flapping. You can filter for acknowledgements and custom notifications too. ## Commands Icinga 2 uses three different command object types to specify how checks should be performed, notifications should be sent, and events should be handled. ### Check Commands [CheckCommand](6-object-types.md#objecttype-checkcommand) objects define the command line how a check is called. [CheckCommand](6-object-types.md#objecttype-checkcommand) objects are referenced by [Host](6-object-types.md#objecttype-host) and [Service](6-object-types.md#objecttype-service) objects using the `check_command` attribute. > **Note** > > Make sure that the [checker](8-cli-commands.md#enable-features) feature is enabled in order to > execute checks. #### Integrate the Plugin with a CheckCommand Definition [CheckCommand](6-object-types.md#objecttype-checkcommand) objects require the [ITL template](7-icinga-template-library.md#itl-plugin-check-command) `plugin-check-command` to support native plugin based check methods. Unless you have done so already, download your check plugin and put it into the [PluginDir](4-configuring-icinga-2.md#constants-conf) directory. The following example uses the `check_mysql` plugin contained in the Monitoring Plugins package. The plugin path and all command arguments are made a list of double-quoted string arguments for proper shell escaping. Call the `check_disk` plugin with the `--help` parameter to see all available options. Our example defines warning (`-w`) and critical (`-c`) thresholds for the disk usage. Without any partition defined (`-p`) it will check all local partitions. icinga@icinga2 $ /usr/lib64/nagios/plugins/check_mysql --help ... This program tests connections to a MySQL server Usage: check_mysql [-d database] [-H host] [-P port] [-s socket] [-u user] [-p password] [-S] [-l] [-a cert] [-k key] [-C ca-cert] [-D ca-dir] [-L ciphers] [-f optfile] [-g group] Next step is to understand how [command parameters](3-monitoring-basics.md#command-passing-parameters) are being passed from a host or service object, and add a [CheckCommand](6-object-types.md#objecttype-checkcommand) definition based on these required parameters and/or default values. Please continue reading in the [plugins section](14-addons-plugins.md#plugins) for additional integration examples. #### Passing Check Command Parameters from Host or Service Check command parameters are defined as custom attributes which can be accessed as runtime macros by the executed check command. The check command parameters for ITL provided plugin check command definitions are documented [here](7-icinga-template-library.md#plugin-check-commands), for example [disk](7-icinga-template-library.md#plugin-check-command-disk). In order to practice passing command parameters you should [integrate your own plugin](3-monitoring-basics.md#command-plugin-integration). The following example will use `check_mysql` provided by the [Monitoring Plugins installation](2-getting-started.md#setting-up-check-plugins). Define the default check command custom attributes, for example `mysql_user` and `mysql_password` (freely definable naming schema) and optional their default threshold values. You can then use these custom attributes as runtime macros for [command arguments](3-monitoring-basics.md#command-arguments) on the command line. > **Tip** > > Use a common command type as prefix for your command arguments to increase > readability. `mysql_user` helps understanding the context better than just > `user` as argument. The default custom attributes can be overridden by the custom attributes defined in the host or service using the check command `my-mysql`. The custom attributes can also be inherited from a parent template using additive inheritance (`+=`). # vim /etc/icinga2/conf.d/commands.conf object CheckCommand "my-mysql" { import "plugin-check-command" command = [ PluginDir + "/check_mysql" ] //constants.conf -> const PluginDir arguments = { "-H" = "$mysql_host$" "-u" = { required = true value = "$mysql_user$" } "-p" = "$mysql_password$" "-P" = "$mysql_port$" "-s" = "$mysql_socket$" "-a" = "$mysql_cert$" "-d" = "$mysql_database$" "-k" = "$mysql_key$" "-C" = "$mysql_ca_cert$" "-D" = "$mysql_ca_dir$" "-L" = "$mysql_ciphers$" "-f" = "$mysql_optfile$" "-g" = "$mysql_group$" "-S" = { set_if = "$mysql_check_slave$" description = "Check if the slave thread is running properly." } "-l" = { set_if = "$mysql_ssl$" description = "Use ssl encryption" } } vars.mysql_check_slave = false vars.mysql_ssl = false vars.mysql_host = "$address$" } The check command definition also sets `mysql_host` to the `$address$` default value. You can override this command parameter if for example your MySQL host is not running on the same server's ip address. Make sure pass all required command parameters, such as `mysql_user`, `mysql_password` and `mysql_database`. `MysqlUsername` and `MysqlPassword` are specified as [global constants](4-configuring-icinga-2.md#constants-conf) in this example. # vim /etc/icinga2/conf.d/services.conf apply Service "mysql-icinga-db-health" { import "generic-service" check_command = "my-mysql" vars.mysql_user = MysqlUsername vars.mysql_password = MysqlPassword vars.mysql_database = "icinga" vars.mysql_host = "192.168.33.11" assign where match("icinga2*", host.name) ignore where host.vars.no_health_check == true } Take a different example: The example host configuration in [hosts.conf](4-configuring-icinga-2.md#hosts-conf) also applies an `ssh` service check. Your host's ssh port is not the default `22`, but set to `2022`. You can pass the command parameter as custom attribute `ssh_port` directly inside the service apply rule inside [services.conf](4-configuring-icinga-2.md#services-conf): apply Service "ssh" { import "generic-service" check_command = "ssh" vars.ssh_port = 2022 //custom command parameter assign where (host.address || host.address6) && host.vars.os == "Linux" } If you prefer this being configured at the host instead of the service, modify the host configuration object instead. The runtime macro resolving order is described [here](3-monitoring-basics.md#macro-evaluation-order). object Host NodeName { ... vars.ssh_port = 2022 } #### Passing Check Command Parameters Using Apply For The host `localhost` with the generated services from the `basic-partitions` dictionary (see [apply for](3-monitoring-basics.md#using-apply-for) for details) checks a basic set of disk partitions with modified custom attributes (warning thresholds at `10%`, critical thresholds at `5%` free disk space). The custom attribute `disk_partition` can either hold a single string or an array of string values for passing multiple partitions to the `check_disk` check plugin. object Host "my-server" { import "generic-host" address = "127.0.0.1" address6 = "::1" vars.local_disks["basic-partitions"] = { disk_partitions = [ "/", "/tmp", "/var", "/home" ] } } apply Service for (disk => config in host.vars.local_disks) { import "generic-service" check_command = "my-disk" vars += config vars.disk_wfree = "10%" vars.disk_cfree = "5%" } More details on using arrays in custom attributes can be found in [this chapter](3-monitoring-basics.md#custom-attributes). #### Command Arguments By defining a check command line using the `command` attribute Icinga 2 will resolve all macros in the static string or array. Sometimes it is required to extend the arguments list based on a met condition evaluated at command execution. Or making arguments optional - only set if the macro value can be resolved by Icinga 2. object CheckCommand "check_http" { import "plugin-check-command" command = [ PluginDir + "/check_http" ] arguments = { "-H" = "$http_vhost$" "-I" = "$http_address$" "-u" = "$http_uri$" "-p" = "$http_port$" "-S" = { set_if = "$http_ssl$" } "--sni" = { set_if = "$http_sni$" } "-a" = { value = "$http_auth_pair$" description = "Username:password on sites with basic authentication" } "--no-body" = { set_if = "$http_ignore_body$" } "-r" = "$http_expect_body_regex$" "-w" = "$http_warn_time$" "-c" = "$http_critical_time$" "-e" = "$http_expect$" } vars.http_address = "$address$" vars.http_ssl = false vars.http_sni = false } The example shows the `check_http` check command defining the most common arguments. Each of them is optional by default and will be omitted if the value is not set. For example if the service calling the check command does not have `vars.http_port` set, it won't get added to the command line. If the `vars.http_ssl` custom attribute is set in the service, host or command object definition, Icinga 2 will add the `-S` argument based on the `set_if` numeric value to the command line. String values are not supported. If the macro value cannot be resolved, Icinga 2 will not add the defined argument to the final command argument array. Empty strings for macro values won't omit the argument. That way you can use the `check_http` command definition for both, with and without SSL enabled checks saving you duplicated command definitions. Details on all available options can be found in the [CheckCommand object definition](6-object-types.md#objecttype-checkcommand). #### Environment Variables The `env` command object attribute specifies a list of environment variables with values calculated from either runtime macros or custom attributes which should be exported as environment variables prior to executing the command. This is useful for example for hiding sensitive information on the command line output when passing credentials to database checks: object CheckCommand "mysql-health" { import "plugin-check-command" command = [ PluginDir + "/check_mysql" ] arguments = { "-H" = "$mysql_address$" "-d" = "$mysql_database$" } vars.mysql_address = "$address$" vars.mysql_database = "icinga" vars.mysql_user = "icinga_check" vars.mysql_pass = "password" env.MYSQLUSER = "$mysql_user$" env.MYSQLPASS = "$mysql_pass$" } ### Notification Commands [NotificationCommand](6-object-types.md#objecttype-notificationcommand) objects define how notifications are delivered to external interfaces (E-Mail, XMPP, IRC, Twitter, etc). [NotificationCommand](6-object-types.md#objecttype-notificationcommand) objects are referenced by [Notification](6-object-types.md#objecttype-notification) objects using the `command` attribute. `NotificationCommand` objects require the [ITL template](7-icinga-template-library.md#itl-plugin-notification-command) `plugin-notification-command` to support native plugin-based notifications. > **Note** > > Make sure that the [notification](8-cli-commands.md#enable-features) feature is enabled > in order to execute notification commands. Below is an example using runtime macros from Icinga 2 (such as `$service.output$` for the current check output) sending an email to the user(s) associated with the notification itself (`$user.email$`). If you want to specify default values for some of the custom attribute definitions, you can add a `vars` dictionary as shown for the `CheckCommand` object. object NotificationCommand "mail-service-notification" { import "plugin-notification-command" command = [ SysconfDir + "/icinga2/scripts/mail-notification.sh" ] env = { NOTIFICATIONTYPE = "$notification.type$" SERVICEDESC = "$service.name$" HOSTALIAS = "$host.display_name$" HOSTADDRESS = "$address$" SERVICESTATE = "$service.state$" LONGDATETIME = "$icinga.long_date_time$" SERVICEOUTPUT = "$service.output$" NOTIFICATIONAUTHORNAME = "$notification.author$" NOTIFICATIONCOMMENT = "$notification.comment$" HOSTDISPLAYNAME = "$host.display_name$" SERVICEDISPLAYNAME = "$service.display_name$" USEREMAIL = "$user.email$" } } The command attribute in the `mail-service-notification` command refers to the following shell script. The macros specified in the `env` array are exported as environment variables and can be used in the notification script: #!/usr/bin/env bash template=$(cat <