diff --git a/doc/2-getting-started.md b/doc/2-getting-started.md index eb5de1d17..2b7846e36 100644 --- a/doc/2-getting-started.md +++ b/doc/2-getting-started.md @@ -88,6 +88,12 @@ Icinga 2 supports [C/C++-style comments](#comments). The `include` directive can be used to include other files. + /** + * The zones.conf defines zones for a cluster setup. + * Not required for single instance setups. + */ + include "zones.conf" + /** * The Icinga Template Library (ITL) provides a number of useful templates * and command definitions. @@ -136,6 +142,17 @@ The `constants.conf` configuration file can be used to define global constants: /* Our local zone name. */ const ZoneName = NodeName +### zones.conf + +The `zones.conf` configuration file can be used to configure `Endpoint` and `Zone` objects +required for a [distributed zone setup](#distributed-monitoring-high-availability). By default +a local dummy zone is defined based on the `NodeName` constant defined in +[constants.conf](#constants-conf). + +> **Note** +> +> Not required for single instance installations. + ### localhost.conf diff --git a/etc/CMakeLists.txt b/etc/CMakeLists.txt index 133d1cd3a..961302396 100644 --- a/etc/CMakeLists.txt +++ b/etc/CMakeLists.txt @@ -21,6 +21,7 @@ configure_file(icinga/icinga-classic-apache.conf.cmake ${CMAKE_CURRENT_BINARY_DI install_if_not_exists(icinga2/icinga2.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2) install_if_not_exists(icinga2/constants.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2) +install_if_not_exists(icinga2/zones.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2) install_if_not_exists(icinga2/conf.d/commands.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d) install_if_not_exists(icinga2/conf.d/downtimes.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d) install_if_not_exists(icinga2/conf.d/generic-host.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d) diff --git a/etc/icinga2/features-available/api.conf b/etc/icinga2/features-available/api.conf index 802100a0f..104d82c75 100644 --- a/etc/icinga2/features-available/api.conf +++ b/etc/icinga2/features-available/api.conf @@ -7,21 +7,3 @@ object ApiListener "api" { key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key" ca_path = SysconfDir + "/icinga2/pki/ca.crt" } - -object Endpoint NodeName { - host = NodeName -} - -object Zone ZoneName { - endpoints = [ NodeName ] -} - -/*object Endpoint "satellite.example.org" { - host = "satellite.example.org" -} - -object Zone "satellite" { - parent = "master" - endpoints = [ "satellite.example.org" ] -}*/ - diff --git a/etc/icinga2/icinga2.conf b/etc/icinga2/icinga2.conf index 1f1372435..ff2df086f 100644 --- a/etc/icinga2/icinga2.conf +++ b/etc/icinga2/icinga2.conf @@ -12,6 +12,12 @@ */ include "constants.conf" +/** + * The zones.conf defines zones for a cluster setup. + * Not required for single instance setups. + */ +include "zones.conf" + /** * The Icinga Template Library (ITL) provides a number of useful templates * and command definitions. diff --git a/etc/icinga2/zones.conf b/etc/icinga2/zones.conf new file mode 100644 index 000000000..e7a1d99ce --- /dev/null +++ b/etc/icinga2/zones.conf @@ -0,0 +1,38 @@ +/* + * Endpoint and Zone configuration for a cluster setup + * This local example requires `NodeName` defined in + * constants.conf. + */ + +object Endpoint NodeName { + host = NodeName +} + +object Zone ZoneName { + endpoints = [ NodeName ] +} + +/* + * Read the documentation on how to configure + * a cluster setup with multiple zones. + */ + +/* +object Endpoint "master.example.org" { + host = "master.example.org" +} + +object Endpoint "satellite.example.org" { + host = "satellite.example.org" +} + +object Zone "master" { + endpoints = [ "master.example.org" ] +} + +object Zone "satellite" { + parent = "master" + endpoints = [ "satellite.example.org" ] +} +*/ + diff --git a/icinga2.spec b/icinga2.spec index 355f5ad5d..8ab13c448 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -409,6 +409,7 @@ exit 0 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/zones.d %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf +%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.conf %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/*.conf %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/localhost/*.conf