From d06d4f254067ff00cf305c492105ef5f82cefa3f Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Sat, 10 May 2014 18:23:08 +0200 Subject: [PATCH] Include monitoring plugin commands seperately. Fixes #6130 --- config.h.cmake | 1 + doc/2-getting-started.md | 13 +- doc/5-configuring-icinga-2.md | 2 +- doc/7-migration.md | 7 +- doc/8-appendix.md | 529 +++++++++--------- etc/icinga2/icinga2.conf | 4 +- icinga-app/icinga.cpp | 4 +- icinga2.spec | 6 +- itl/CMakeLists.txt | 4 +- itl/command-icinga.conf | 27 + ...mmand-common.conf => command-plugins.conf} | 9 - itl/{itl.conf => itl} | 2 +- itl/plugins | 25 + lib/base/application.cpp | 20 + lib/base/application.h | 3 + 15 files changed, 379 insertions(+), 277 deletions(-) create mode 100644 itl/command-icinga.conf rename itl/{command-common.conf => command-plugins.conf} (97%) rename itl/{itl.conf => itl} (98%) create mode 100644 itl/plugins diff --git a/config.h.cmake b/config.h.cmake index 9982f8abb..71e42eee7 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -11,5 +11,6 @@ #define ICINGA_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}" #define ICINGA_LOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}" #define ICINGA_PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/icinga2" +#define ICINGA_INCLUDECONFDIR "${CMAKE_INSTALL_FULL_DATADIR}/icinga2/include" #endif /* CONFIG_H */ diff --git a/doc/2-getting-started.md b/doc/2-getting-started.md index aea3cc655..4a48aa56f 100644 --- a/doc/2-getting-started.md +++ b/doc/2-getting-started.md @@ -56,7 +56,7 @@ By default Icinga 2 uses the following files and directories: /usr/bin/icinga2-* | Migration and certificate build scripts. /usr/sbin/icinga2* | The Icinga 2 binary and feature enable/disable scripts. /usr/share/doc/icinga2 | Documentation files that come with Icinga 2. - /usr/share/icinga2/itl | The Icinga Template Library. + /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. @@ -91,8 +91,10 @@ The `include` directive can be used to include other files. /** * The Icinga Template Library (ITL) provides a number of useful templates * and command definitions. + * Common monitoring plugin command definitions are included seperately. */ - include + include + include /** * The features-available directory contains a number of configuration @@ -208,9 +210,10 @@ Template Library require an `address` custom attribute. check_command = "disk" } -The command objects `icinga`, `http_ip`, `ssh`, `load`, `processes`, `users` -and `disk` are all provided by the Icinga Template Library (ITL) which -we enabled earlier by including the `itl/itl.conf` configuration file. +The command object `icinga` for the embedded health check is provided by the +[Icinga Template Library (ITL)](#itl) while `http_ip`, `ssh`, `load`, `processes`, +`users` and `disk` are all provided by the plugin check commands which we enabled +earlier by including the `itl` and `plugins` configuration file. > **Best Practice** > diff --git a/doc/5-configuring-icinga-2.md b/doc/5-configuring-icinga-2.md index 6ee68f751..bbf0d4e26 100644 --- a/doc/5-configuring-icinga-2.md +++ b/doc/5-configuring-icinga-2.md @@ -470,7 +470,7 @@ Wildcard includes are not recursive. Icinga also supports include search paths similar to how they work in a C/C++ compiler: - include + 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 diff --git a/doc/7-migration.md b/doc/7-migration.md index 8af479ef1..1abe97dde 100644 --- a/doc/7-migration.md +++ b/doc/7-migration.md @@ -91,10 +91,11 @@ a separate option and add the directory and an option pattern. include_recursive "conf.d" "*.conf" A global search path for includes is available for advanced features like -the Icinga Template Library (ITL). The file suffix does not matter as long -as it matches the (wildcard) include expression. +the Icinga Template Library (ITL) or additional monitoring plugins check +command configuration. - include + include + include By convention the `.conf` suffix is used for Icinga 2 configuration files. diff --git a/doc/8-appendix.md b/doc/8-appendix.md index ec1a39212..f95d02f88 100644 --- a/doc/8-appendix.md +++ b/doc/8-appendix.md @@ -10,259 +10,11 @@ definitions for commonly used services. You can include the ITL by using the `include` directive in your configuration file: - include + include -The ITL assumes that there's a global constant named `PluginDir` which contains -the path of the plugins from the Monitoring Plugins project. - -### Check Commands - -#### ping4 - -Check command object for the `check_ping` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -ping_address | **Optional.** The host's IPv4 address. Defaults to "$address$". -ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 100. -ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 5. -ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 200. -ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 15. -ping_packets | **Optional.** The number of packets to send. Defaults to 5. -ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout). - -#### ping6 - -Check command object for the `check_ping` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -ping_address | **Optional.** The host's IPv6 address. Defaults to "$address6$". -ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 100. -ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 5. -ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 200. -ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 15. -ping_packets | **Optional.** The number of packets to send. Defaults to 5. -ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout). - -#### hostalive - -Check command object for the `check_ping` plugin with host check default values. - -Custom Attributes: - -Name | Description -----------------|-------------- -ping_address | **Optional.** The host's IPv4 address. Defaults to "$address$". -ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 3000. -ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 80. -ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 5000. -ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 100. -ping_packets | **Optional.** The number of packets to send. Defaults to 5. -ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout). - -#### dummy - -Check command object for the `check_dummy` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -dummy_state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 (critical) and 3 (unknown). Defaults to 0. -dummy_text | **Optional.** Plugin output. Defaults to "Check was successful.". - -#### passive - -Specialised check command object for passive checks executing the `check_dummy` plugin with appropriate default values. - -Custom Attributes: - -Name | Description -----------------|-------------- -dummy_state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 (critical) and 3 (unknown). Defaults to 3. -dummy_text | **Optional.** Plugin output. Defaults to "No Passive Check Result Received.". - -#### tcp - -Check command object for the `check_tcp` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -tcp_address | **Optional.** The host's address. Defaults to "$address$". -tcp_port | **Required.** The port that should be checked. - -#### udp - -Check command object for the `check_udp` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -udp_address | **Optional.** The host's address. Defaults to "$address$". -udp_port | **Required.** The port that should be checked. - -#### http - -Check command object for the `check_http` plugin. - -Custom Attributes: - -Name | Description --------------------|-------------- -http_address | **Optional.** The host's address. Defaults to "$address". -http_vhost | **Optional.** The virtual host that should be sent in the "Host" header. -http_uri | **Optional.** The request URI. -http_port | **Optional.** The TCP port. Defaults to 80 when not using SSL, 443 otherwise. -http_ssl | **Optional.** Whether to use SSL. Defaults to false. -http_warn_time | **Optional.** The warning threshold. -http_critical_time | **Optional.** The critical threshold. - -#### smtp - -Check command object for the `check_smtp` plugin. - -Custom Attributes: - -Name | Description ----------------------|-------------- -smtp_address | **Optional.** The host's address. Defaults to "$address$". - -#### ssmtp - -Check command object for the `check_ssmtp` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -ssmtp_address | **Required.** The host's address. Defaults to "$address$". -ssmtp_port | **Optional.** The port that should be checked. Defaults to 465. - -#### ntp_time - -Check command object for the `check_ntp_time` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -ntp_address | **Optional.** The host's address. Defaults to "$address$". - -#### ssh - -Check command object for the `check_ssh` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -ssh_address | **Optional.** The host's address. Defaults to "$address$". -ssh_port | **Optional.** The port that should be checked. Defaults to 22. - -#### disk - -Check command object for the `check_disk` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -disk_wfree | **Optional.** The free space warning threshold in %. Defaults to 20. -disk_cfree | **Optional.** The free space critical threshold in %. Defaults to 10. - -#### users - -Check command object for the `check_disk` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -users_wgreater | **Optional.** The user count warning threshold. Defaults to 20. -users_cgreater | **Optional.** The user count critical threshold. Defaults to 50. - -#### procs - -Check command object for the `check_procs` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -procs_wgreater | **Optional.** The process count warning threshold. Defaults to 250. -procs_cgreater | **Optional.** The process count critical threshold. Defaults to 400. - -#### swap - -Check command object for the `check_swap` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -swap_wfree | **Optional.** The free swap space warning threshold in %. Defaults to 50. -swap_cfree | **Optional.** The free swap space critical threshold in %. Defaults to 25. - -#### load - -Check command object for the `check_load` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -load_wload1 | **Optional.** The 1-minute warning threshold. Defaults to 5. -load_wload5 | **Optional.** The 5-minute warning threshold. Defaults to 4. -load_wload15 | **Optional.** The 15-minute warning threshold. Defaults to 3. -load_cload1 | **Optional.** The 1-minute critical threshold. Defaults to 10. -load_cload5 | **Optional.** The 5-minute critical threshold. Defaults to 6. -load_cload15 | **Optional.** The 15-minute critical threshold. Defaults to 4. - -#### snmp - -Check command object for the `check_snmp` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -snmp_address | **Optional.** The host's address. Defaults to "$address$". -snmp_oid | **Required.** The SNMP OID. -snmp_community | **Optional.** The SNMP community. Defaults to "public". - -#### snmp-uptime - -Check command object for the `check_snmp` plugin. - -Custom Attributes: - -Name | Description -----------------|-------------- -snmp_address | **Optional.** The host's address. Defaults to "$address$". -snmp_oid | **Optional.** The SNMP OID. Defaults to "1.3.6.1.2.1.1.3.0". -snmp_community | **Optional.** The SNMP community. Defaults to "public". - -#### apt - -Check command for the `check_apt` plugin. - -The `apt` check command does not support any vars. - -#### icinga - -Check command for the built-in `icinga` check. This check returns performance -data for the current Icinga instance. - -The `icinga` check command does not support any vars. +### Generic Templates +These templates are imported by the provided example configuration. #### plugin-check-command @@ -282,6 +34,281 @@ Check command template for event handler scripts executed by Icinga 2. The `plugin-event-command` check command does not support any vars. +### Check Commands + +These check commands are embedded into Icinga 2 and do not require any external +plugin scripts. + +#### icinga + +Check command for the built-in `icinga` check. This check returns performance +data for the current Icinga instance. + +The `icinga` check command does not support any vars. + +#### cluster + +Check command for the built-in `cluster` check. This check returns performance +data for the current Icinga instance and connected endpoints. + +The `cluster` check command does not support any vars. + + + +## Plugin Check Commands + +### Overview + +The Plugin Check Commands provides example configuration for plugin check commands +provided by the the Monitoring Plugins project. + +You can include the plugin check command definitions by using the `include` +directive in your configuration file: + + include + +The plugin check commands assume that there's a global constant named `PluginDir` +which contains the path of the plugins from the Monitoring Plugins project. + + +#### ping4 + +Check command object for the `check_ping` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +ping_address | **Optional.** The host's IPv4 address. Defaults to "$address$". +ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 100. +ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 5. +ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 200. +ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 15. +ping_packets | **Optional.** The number of packets to send. Defaults to 5. +ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout). + +#### ping6 + +Check command object for the `check_ping` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +ping_address | **Optional.** The host's IPv6 address. Defaults to "$address6$". +ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 100. +ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 5. +ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 200. +ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 15. +ping_packets | **Optional.** The number of packets to send. Defaults to 5. +ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout). + +#### hostalive + +Check command object for the `check_ping` plugin with host check default values. + +Custom Attributes: + +Name | Description +----------------|-------------- +ping_address | **Optional.** The host's IPv4 address. Defaults to "$address$". +ping_wrta | **Optional.** The RTA warning threshold in milliseconds. Defaults to 3000. +ping_wpl | **Optional.** The packet loss warning threshold in %. Defaults to 80. +ping_crta | **Optional.** The RTA critical threshold in milliseconds. Defaults to 5000. +ping_cpl | **Optional.** The packet loss critical threshold in %. Defaults to 100. +ping_packets | **Optional.** The number of packets to send. Defaults to 5. +ping_timeout | **Optional.** The plugin timeout in seconds. Defaults to 0 (no timeout). + +#### dummy + +Check command object for the `check_dummy` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +dummy_state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 (critical) and 3 (unknown). Defaults to 0. +dummy_text | **Optional.** Plugin output. Defaults to "Check was successful.". + +#### passive + +Specialised check command object for passive checks executing the `check_dummy` plugin with appropriate default values. + +Custom Attributes: + +Name | Description +----------------|-------------- +dummy_state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 (critical) and 3 (unknown). Defaults to 3. +dummy_text | **Optional.** Plugin output. Defaults to "No Passive Check Result Received.". + +#### tcp + +Check command object for the `check_tcp` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +tcp_address | **Optional.** The host's address. Defaults to "$address$". +tcp_port | **Required.** The port that should be checked. + +#### udp + +Check command object for the `check_udp` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +udp_address | **Optional.** The host's address. Defaults to "$address$". +udp_port | **Required.** The port that should be checked. + +#### http + +Check command object for the `check_http` plugin. + +Custom Attributes: + +Name | Description +-------------------|-------------- +http_address | **Optional.** The host's address. Defaults to "$address". +http_vhost | **Optional.** The virtual host that should be sent in the "Host" header. +http_uri | **Optional.** The request URI. +http_port | **Optional.** The TCP port. Defaults to 80 when not using SSL, 443 otherwise. +http_ssl | **Optional.** Whether to use SSL. Defaults to false. +http_warn_time | **Optional.** The warning threshold. +http_critical_time | **Optional.** The critical threshold. + +#### smtp + +Check command object for the `check_smtp` plugin. + +Custom Attributes: + +Name | Description +---------------------|-------------- +smtp_address | **Optional.** The host's address. Defaults to "$address$". + +#### ssmtp + +Check command object for the `check_ssmtp` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +ssmtp_address | **Required.** The host's address. Defaults to "$address$". +ssmtp_port | **Optional.** The port that should be checked. Defaults to 465. + +#### ntp_time + +Check command object for the `check_ntp_time` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +ntp_address | **Optional.** The host's address. Defaults to "$address$". + +#### ssh + +Check command object for the `check_ssh` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +ssh_address | **Optional.** The host's address. Defaults to "$address$". +ssh_port | **Optional.** The port that should be checked. Defaults to 22. + +#### disk + +Check command object for the `check_disk` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +disk_wfree | **Optional.** The free space warning threshold in %. Defaults to 20. +disk_cfree | **Optional.** The free space critical threshold in %. Defaults to 10. + +#### users + +Check command object for the `check_disk` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +users_wgreater | **Optional.** The user count warning threshold. Defaults to 20. +users_cgreater | **Optional.** The user count critical threshold. Defaults to 50. + +#### procs + +Check command object for the `check_procs` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +procs_wgreater | **Optional.** The process count warning threshold. Defaults to 250. +procs_cgreater | **Optional.** The process count critical threshold. Defaults to 400. + +#### swap + +Check command object for the `check_swap` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +swap_wfree | **Optional.** The free swap space warning threshold in %. Defaults to 50. +swap_cfree | **Optional.** The free swap space critical threshold in %. Defaults to 25. + +#### load + +Check command object for the `check_load` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +load_wload1 | **Optional.** The 1-minute warning threshold. Defaults to 5. +load_wload5 | **Optional.** The 5-minute warning threshold. Defaults to 4. +load_wload15 | **Optional.** The 15-minute warning threshold. Defaults to 3. +load_cload1 | **Optional.** The 1-minute critical threshold. Defaults to 10. +load_cload5 | **Optional.** The 5-minute critical threshold. Defaults to 6. +load_cload15 | **Optional.** The 15-minute critical threshold. Defaults to 4. + +#### snmp + +Check command object for the `check_snmp` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +snmp_address | **Optional.** The host's address. Defaults to "$address$". +snmp_oid | **Required.** The SNMP OID. +snmp_community | **Optional.** The SNMP community. Defaults to "public". + +#### snmp-uptime + +Check command object for the `check_snmp` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +snmp_address | **Optional.** The host's address. Defaults to "$address$". +snmp_oid | **Optional.** The SNMP OID. Defaults to "1.3.6.1.2.1.1.3.0". +snmp_community | **Optional.** The SNMP community. Defaults to "public". + +#### apt + +Check command for the `check_apt` plugin. + +The `apt` check command does not support any vars. ## Schemas diff --git a/etc/icinga2/icinga2.conf b/etc/icinga2/icinga2.conf index a511dd660..208e70efb 100644 --- a/etc/icinga2/icinga2.conf +++ b/etc/icinga2/icinga2.conf @@ -15,8 +15,10 @@ include "constants.conf" /** * The Icinga Template Library (ITL) provides a number of useful templates * and command definitions. + * Common monitoring plugin command definitions are included seperately. */ -include +include +include /** * The features-available directory contains a number of configuration diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index 3058376b5..3d49fd6a0 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.cpp @@ -246,6 +246,7 @@ int Main(void) Application::DeclareSysconfDir(prefix + "\\etc"); Application::DeclareLocalStateDir(prefix + "\\var"); Application::DeclarePkgDataDir(prefix + "\\share\\icinga2"); + Application::DeclareIncludeConfDir(prefix + "\\share\\icinga2\\include"); builtinPaths = false; } @@ -261,6 +262,7 @@ int Main(void) Application::DeclareSysconfDir(ICINGA_SYSCONFDIR); Application::DeclareLocalStateDir(ICINGA_LOCALSTATEDIR); Application::DeclarePkgDataDir(ICINGA_PKGDATADIR); + Application::DeclareIncludeConfDir(ICINGA_INCLUDECONFDIR); #ifdef _WIN32 } #endif /* _WIN32 */ @@ -419,7 +421,7 @@ int Main(void) } } - ConfigCompiler::AddIncludeSearchDir(Application::GetPkgDataDir()); + ConfigCompiler::AddIncludeSearchDir(Application::GetIncludeConfDir()); if (g_AppParams.count("include")) { BOOST_FOREACH(const String& includePath, g_AppParams["include"].as >()) { diff --git a/icinga2.spec b/icinga2.spec index 7351b6621..78421db1d 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -433,7 +433,7 @@ exit 0 %exclude %{_libdir}/%{name}/libdb_ido_pgsql* %{_libdir}/%{name} %{_datadir}/%{name} -%exclude %{_datadir}/%{name}/itl +%exclude %{_datadir}/%{name}/include %{_mandir}/man8/%{name}.8.gz %attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/cache/%{name} @@ -452,8 +452,8 @@ exit 0 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp -%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/itl -%{_datadir}/%{name}/itl +%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/include +%{_datadir}/%{name}/include %files doc %defattr(-,root,root,-) diff --git a/itl/CMakeLists.txt b/itl/CMakeLists.txt index c156b97e7..75714a369 100644 --- a/itl/CMakeLists.txt +++ b/itl/CMakeLists.txt @@ -16,6 +16,6 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. install( - FILES command.conf command-common.conf itl.conf timeperiod.conf - DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2/itl + FILES itl command.conf command-icinga.conf timeperiod.conf plugins command-plugins.conf + DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2/include ) diff --git a/itl/command-icinga.conf b/itl/command-icinga.conf new file mode 100644 index 000000000..34496366e --- /dev/null +++ b/itl/command-icinga.conf @@ -0,0 +1,27 @@ +/****************************************************************************** + * Icinga 2 * + * Copyright (C) 2012-2014 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. * + ******************************************************************************/ + +object CheckCommand "icinga" { + import "icinga-check-command" +} + +object CheckCommand "cluster" { + import "cluster-check-command" +} + diff --git a/itl/command-common.conf b/itl/command-plugins.conf similarity index 97% rename from itl/command-common.conf rename to itl/command-plugins.conf index d019d869c..1d3d564ff 100644 --- a/itl/command-common.conf +++ b/itl/command-plugins.conf @@ -286,12 +286,3 @@ object CheckCommand "apt" { PluginDir + "/check_apt" ] } - -object CheckCommand "icinga" { - import "icinga-check-command" -} - -object CheckCommand "cluster" { - import "cluster-check-command" -} - diff --git a/itl/itl.conf b/itl/itl similarity index 98% rename from itl/itl.conf rename to itl/itl index 597fde139..1fa32eab6 100644 --- a/itl/itl.conf +++ b/itl/itl @@ -23,5 +23,5 @@ */ include "command.conf" -include "command-common.conf" +include "command-icinga.conf" include "timeperiod.conf" diff --git a/itl/plugins b/itl/plugins new file mode 100644 index 000000000..67a110530 --- /dev/null +++ b/itl/plugins @@ -0,0 +1,25 @@ +/****************************************************************************** + * Icinga 2 * + * Copyright (C) 2012-2014 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. * + ******************************************************************************/ + +/** + * This is the Icinga Templare Library, a collection of general purpose Icinga + * configuration templates. This part includes the plugin commands. + */ + +include "command-plugins.conf" diff --git a/lib/base/application.cpp b/lib/base/application.cpp index bf9f8d342..e7a41aaa1 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -822,6 +822,26 @@ void Application::DeclarePkgDataDir(const String& path) ScriptVariable::Set("PkgDataDir", path, false); } +/** + * Retrieves the path for the include conf dir. + * + * @returns The path. + */ +String Application::GetIncludeConfDir(void) +{ + return ScriptVariable::Get("IncludeConfDir"); +} + +/** + * Sets the path for the package data dir. + * + * @param path The new path. + */ +void Application::DeclareIncludeConfDir(const String& path) +{ + ScriptVariable::Set("IncludeConfDir", path, false); +} + /** * Retrieves the path for the state file. * diff --git a/lib/base/application.h b/lib/base/application.h index 3be23547e..1980afd24 100644 --- a/lib/base/application.h +++ b/lib/base/application.h @@ -87,6 +87,9 @@ public: static String GetPkgDataDir(void); static void DeclarePkgDataDir(const String& path); + static String GetIncludeConfDir(void); + static void DeclareIncludeConfDir(const String& path); + static String GetStatePath(void); static void DeclareStatePath(const String& path);