diff --git a/doc/5-service-monitoring.md b/doc/5-service-monitoring.md index 42184b75e..4d439bdea 100644 --- a/doc/5-service-monitoring.md +++ b/doc/5-service-monitoring.md @@ -38,12 +38,12 @@ by trying to run it on the console using whichever user Icinga 2 is running as: $ /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. +documentation and/or the included README file 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. +the plugin it might be easier to create a symbolic link to make sure it doesn't get overwritten during the next update. Sometimes there are plugins which do not exactly fit your requirements. -Either you'll modify an existing plugin or you'll write one by yourself. +In that case you can modify an existing plugin or just write your own. ### CheckCommand Definition @@ -53,20 +53,20 @@ configuration which can be used in the [Service](9-object-types.md#objecttype-se Please check if the Icinga 2 package already provides an [existing CheckCommand definition](10-icinga-template-library.md#plugin-check-commands). -If yes throroughly check the required parameters and integrate the check command +If that's the case, throroughly check the required parameters and integrate the check command into your host and service objects. -There are the following conventions to follow when adding a new command object definition: +Please make sure to follow these conventions 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 +* Always import the `plugin-check-command` template. +* Use 3-monitoring-basics.md#command-arguments whenever possible. The `command` attribute +must be an array in `[ ... ]` for shell escaping. +* Define a unique `prefix` for the command's specific 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 command argument default values, e.g. for thresholds. * Use [advanced conditions](9-object-types.md#objecttype-checkcommand) like `set_if` definitions. -Example for a custom `my-snmp-int` check command: +This is an example for a custom `my-snmp-int` check command: object CheckCommand "my-snmp-int" { import "plugin-check-command" @@ -98,51 +98,47 @@ Example for a custom `my-snmp-int` check command: For further information on your monitoring configuration read the [Monitoring Basics](3-monitoring-basics.md#monitoring-basics) chapter. -If you have created your own `CheckCommand` definition please kindly -[send it upstream](https://wiki.icinga.org/display/community/Contribute+Icinga+2+ITL+Plugin+Check+Command+Definitions) +If you have created your own `CheckCommand` definition, please kindly +[send it upstream](https://wiki.icinga.org/display/community/Contribute+Icinga+2+ITL+Plugin+Check+Command+Definitions). ### 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). +Currently Icinga 2 supports the native plugin API specification from the Monitoring Plugins project. It is defined in the [Monitoring Plugins Development Guidelines](https://www.monitoring-plugins.org/doc/guidelines.html). ## Service Monitoring Overview -The following examples should get you started with your own integration ideas. -There is a variety of common plugins available. This collection is not complete -- -if you have any updates please send a documentation patch upstream. +The following examples should help you to start implementing your own ideas. +There is a variety of plugins available. This collection is not complete -- +if you have any updates, please send a documentation patch upstream. -## General Monitoring +### General Monitoring -If the remote service is available using a network protocol and port, -and a check plugin 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](10-icinga-template-library.md#icinga-template-library) -already ships various examples like +If the remote service is available (via a network protocol and port), +and if a check plugin is also available, you don't necessarily need a local client. +Instead, choose a plugin and configure its parameters and thresholds. The following examples are included in the [Icinga 2 Template Library](10-icinga-template-library.md#icinga-template-library): * [ping4](10-icinga-template-library.md#plugin-check-command-ping4), [ping6](10-icinga-template-library.md#plugin-check-command-ping6), [fping4](10-icinga-template-library.md#plugin-check-command-fping4), [fping6](10-icinga-template-library.md#plugin-check-command-fping6), [hostalive](10-icinga-template-library.md#plugin-check-command-hostalive) * [tcp](10-icinga-template-library.md#plugin-check-command-tcp), [udp](10-icinga-template-library.md#plugin-check-command-udp), [ssl](10-icinga-template-library.md#plugin-check-command-ssl) * [ntp_time](10-icinga-template-library.md#plugin-check-command-ntp-time) -## Linux Monitoring +### Linux Monitoring * [disk](10-icinga-template-library.md#plugin-check-command-disk) * [mem](10-icinga-template-library.md#plugin-contrib-command-mem), [swap](10-icinga-template-library.md#plugin-check-command-swap) * [running_kernel](10-icinga-template-library.md#plugin-contrib-command-running_kernel) -* Package repositores ([apt](10-icinga-template-library.md#plugin-check-command-apt), [yum](10-icinga-template-library.md#plugin-contrib-command-yum), etc.) +* package management: [apt](10-icinga-template-library.md#plugin-check-command-apt), [yum](10-icinga-template-library.md#plugin-contrib-command-yum), etc. * [ssh](10-icinga-template-library.md#plugin-check-command-ssh) -* Performance ([iostat](10-icinga-template-library.md#plugin-contrib-command-iostat), [check_sar_perf](https://github.com/dnsmichi/icinga-plugins/blob/master/scripts/check_sar_perf.py)) +* performance: [iostat](10-icinga-template-library.md#plugin-contrib-command-iostat), [check_sar_perf](https://github.com/dnsmichi/icinga-plugins/blob/master/scripts/check_sar_perf.py) -## Windows Monitoring +### Windows Monitoring * [check_wmi_plus](http://www.edcint.co.nz/checkwmiplus/) * [NSClient++](https://www.nsclient.org) (in combination with the Icinga 2 client as [nscp-local](10-icinga-template-library.md#nscp-plugin-check-commands) check commands) * [Icinga 2 Windows Plugins](10-icinga-template-library.md#windows-plugins) (disk, load, memory, network, performance counters, ping, procs, service, swap, updates, uptime, users * vbs and Powershell scripts -## Database Monitoring +### Database Monitoring * MySQL/MariaDB: [mysql_health](10-icinga-template-library.md#plugin-contrib-command-mysql_health), [mysql](10-icinga-template-library.md#plugin-check-command-mysql), [mysql_query](10-icinga-template-library.md#plugin-check-command-mysql-query) * PostgreSQL: [postgres](10-icinga-template-library.md#plugin-contrib-command-postgres) @@ -153,19 +149,19 @@ already ships various examples like * Elasticsearch: [elasticsearch](10-icinga-template-library.md#plugin-contrib-command-elasticsearch) * Redis: [redis](10-icinga-template-library.md#plugin-contrib-command-redis) -## SNMP Monitoring +### SNMP Monitoring * [Manubulon plugins](10-icinga-template-library.md#snmp-manubulon-plugin-check-commands) (interface, storage, load, memory, process) * [snmp](10-icinga-template-library.md#plugin-check-command-snmp), [snmpv3](10-icinga-template-library.md#plugin-check-command-snmpv3) -## Network Monitoring +### Network Monitoring * [nwc_health](10-icinga-template-library.md#plugin-contrib-command-nwc_health) * [interfaces](10-icinga-template-library.md#plugin-contrib-command-interfaces) * [interfacetable](10-icinga-template-library.md#plugin-contrib-command-interfacetable) * [iftraffic](10-icinga-template-library.md#plugin-contrib-command-iftraffic), [iftraffic64](10-icinga-template-library.md#plugin-contrib-command-iftraffic64) -## Web Monitoring +### Web Monitoring * [http](10-icinga-template-library.md#plugin-check-command-http) * [ftp](10-icinga-template-library.md#plugin-check-command-ftp) @@ -176,52 +172,52 @@ already ships various examples like * [kdc](10-icinga-template-library.md#plugin-contrib-command-kdc) * [rbl](10-icinga-template-library.md#plugin-contrib-command-rbl) -## Java Monitoring +### Java Monitoring * [jmx4perl](10-icinga-template-library.md#plugin-contrib-command-jmx4perl) -## DNS Monitoring +### DNS Monitoring * [dns](10-icinga-template-library.md#plugin-check-command-dns) * [dig](10-icinga-template-library.md#plugin-check-command-dig) * [dhcp](10-icinga-template-library.md#plugin-check-command-dhcp) -## Backup Monitoring +### Backup Monitoring * [check_bareos](https://github.com/widhalmt/check_bareos) -## Log Monitoring +### Log Monitoring * [check_logfiles](https://labs.consol.de/nagios/check_logfiles/) * [check_logstash](https://github.com/widhalmt/check_logstash) * [check_graylog2_stream](https://github.com/Graylog2/check-graylog2-stream) -## Virtualization Monitoring +### Virtualization Monitoring -## VMWare Monitoring +### VMware Monitoring * [esxi_hardware](10-icinga-template-library.md#plugin-contrib-command-esxi-hardware) -* [VMWare](10-icinga-template-library.md#plugin-contrib-vmware) +* [VMware](10-icinga-template-library.md#plugin-contrib-vmware) -**Tip**: If you are encountering timeouts using the VMWare Perl SDK +**Tip**: If you are encountering timeouts using the VMware Perl SDK, check [this blog entry](http://www.claudiokuenzler.com/blog/650/slow-vmware-perl-sdk-soap-request-error-libwww-version). -## SAP Monitoring +### SAP Monitoring * [check_sap_health](https://labs.consol.de/nagios/check_sap_health/index.html) * [SAP CCMS](https://sourceforge.net/projects/nagios-sap-ccms/) -## Mail Monitoring +### Mail Monitoring * [smtp](10-icinga-template-library.md#plugin-check-command-smtp), [ssmtp](10-icinga-template-library.md#plugin-check-command-ssmtp) * [imap](10-icinga-template-library.md#plugin-check-command-imap), [simap](10-icinga-template-library.md#plugin-check-command-simap) * [pop](10-icinga-template-library.md#plugin-check-command-pop), [spop](10-icinga-template-library.md#plugin-check-command-spop) -## Hardware Monitoring +### Hardware Monitoring * [hpasm](10-icinga-template-library.md#plugin-contrib-command-hpasm) * [ipmi-sensor](10-icinga-template-library.md#plugin-contrib-command-ipmi-sensor) -## Metrics Monitoring +### Metrics Monitoring * [graphite](10-icinga-template-library.md#plugin-contrib-command-graphite) diff --git a/doc/6-distributed-monitoring.md b/doc/6-distributed-monitoring.md index e43b3ed12..35dee1c1c 100644 --- a/doc/6-distributed-monitoring.md +++ b/doc/6-distributed-monitoring.md @@ -1,10 +1,10 @@ -# Distributed Monitoring with Masters, Satellites and Clients +# Distributed Monitoring with Master, Satellites, and Clients This chapter will guide you through the setup of a distributed monitoring -environment. This includes High-Availability clustering and Icinga 2 client -setup details. +environment, including high-availability clustering and setup details +for the Icinga 2 client. -## Roles: Master, Satellite and Clients +## Roles: Master, Satellites, and Clients Icinga 2 nodes can be given names for easier understanding: @@ -12,30 +12,31 @@ Icinga 2 nodes can be given names for easier understanding: * A `satellite` node which is a child of a `master` node * A `client` node which works as an `agent` connected to `master` and/or `satellite` nodes -The following sections will refer to these roles and explain -their possibilities and differences in detail. +The following sections will refer to these roles and explain the +differences and the possibilities this kind of setup offers. > **Tip**: > -> If you just want to install a single master node with several hosts -> monitored with Icinga 2 clients continue reading, we'll start with +> If you just want to install a single master node that monitors several hosts +> (i.e. Icinga 2 clients), continue reading -- we'll start with > simple examples. > In case you are planning a huge cluster setup with multiple levels and -> lots of clients - read on, we'll deal with these examples later on. +> lots of clients, read on -- we'll deal with these cases later on. -The installation on each system is the same -- you need to install the -Icinga 2 package. The required configuration steps are mostly helped with CLI commands. +The installation on each system is the same: You need to install the +Icinga 2 package. The required configuration steps are mostly happening +on the command line. -The first thing you need learn about a distributed setup -- the overall hierarchy. +The first thing you need learn about a distributed setup is the hierarchy of the single components. ## Zones -The Icinga 2 hierarchy consists of so-called [Zone](9-object-types.md#objecttype-zone) objects. -Zones depend on a parent-child relationship for trusting each other. +The Icinga 2 hierarchy consists of so-called [zone](9-object-types.md#objecttype-zone) objects. +Zones depend on a parent-child relationship in order to trust each other. ![Icinga 2 Distributed Zones](images/distributed-monitoring/icinga2_distributed_zones.png) -Example for the satellite zones which have the `master` zone as parent zone: +Have a look at this example for the `satellite` zones which have the `master` zone as a parent zone: object Zone "master" { //... @@ -51,8 +52,8 @@ Example for the satellite zones which have the `master` zone as parent zone: //... } -There are certain limitations for child zones - e.g. their members are not allowed -to send configuration to the parent zone members. Vice versa the +There are certain limitations for child zones, e.g. their members are not allowed +to send configuration commands to the parent zone members. Vice versa, the trust hierarchy allows for example the `master` zone to send configuration files to the `satellite` zone. Read more about this in the [security section](6-distributed-monitoring.md#distributed-monitoring-security). @@ -66,7 +67,7 @@ Nodes which are a member of a zone are so-called [Endpoint](9-object-types.md#ob ![Icinga 2 Distributed Endpoints](images/distributed-monitoring/icinga2_distributed_endpoints.png) -Example configuration for two endpoints in different zones: +Here is an example configuration for two endpoints in different zones: object Endpoint "icinga2-master1.localdomain" { host = "192.168.56.101" @@ -85,26 +86,27 @@ Example configuration for two endpoints in different zones: parent = "master" } -All endpoints in the same zone work as High-Availability setup. If you have for -example two nodes in the `master` zone, they will load-balance the check execution. +All endpoints in the same zone work as high-availability setup. For +example, if you have two nodes in the `master` zone, they will load-balance the check execution. Endpoint objects are important for specifying the connection -information e.g. if the master should actively try to connect to a client. +information, e.g. if the master should actively try to connect to a client. The zone membership is defined inside the `Zone` object definition using the `endpoints` attribute with an array of `Endpoint` names. ## ApiListener -In case you are using the CLI commands later you won't directly see -this configuration object. The [ApiListener](9-object-types.md#objecttype-apilistener) -object is used to load the SSL certificates and specify restrictions -for e.g. accepting configuration. +In case you are using the CLI commands later, you don't have to write +this configuration from scratch in a text editor. +The [ApiListener](9-object-types.md#objecttype-apilistener) +object is used to load the SSL certificates and specify restrictions, e.g. +for accepting configuration commands. -It is further used for the [Icinga 2 REST API](12-icinga2-api.md#icinga2-api) which shares +It is also used for the [Icinga 2 REST API](12-icinga2-api.md#icinga2-api) which shares the same host and port with the Icinga 2 Cluster protocol. -The object configuration is stored as feature in `/etc/icinga2/features-enabled/api.conf` +The object configuration is stored as a feature in `/etc/icinga2/features-enabled/api.conf` by default. In order to use the `api` feature you need to enable it and restart Icinga 2. @@ -115,52 +117,53 @@ In order to use the `api` feature you need to enable it and restart Icinga 2. By convention all nodes should be configured using their FQDN. -Furthermore you must ensure that the following configuration names -are exact the same: +Furthermore, you must ensure that the following names +are exactly the same in all configuration files: * Host certificate common name (CN) * Endpoint configuration object * NodeName constant -The cli commands will help you here already and minimize the effort. Just keep in mind --- use the FQDN for endpoints and common names when asked. +Setting this up on the command line will help you to minimize the effort. Just keep in mind that +you need to use the FQDN for endpoints and for common names when asked. ## Security -While there are certain capabilities to ensure the safe communication between all -nodes (firewalls, policies, software hardening, etc.) the Icinga 2 also provides -additional security itself: +While there are certain mechanisms to ensure a secure communication between all +nodes (firewalls, policies, software hardening, etc.), Icinga 2 also provides +additional security: -* SSL certificates are mandatory for cluster communication. There are CLI commands helping with their creation. +* SSL certificates are mandatory for cluster communication. The CLI commands +create those certs automatically. * 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. +* Zones cannot interfere with other zones and influence each other. Every checked object is assigned to only one zone. * All nodes in a zone trust each other. -* [Config sync]() and [remote command endpoint execution]() is disabled by default. +* [Config sync](6-distributed-monitoring.md#distributed-monitoring-top-down-config-sync) and [remote command endpoint execution](6-distributed-monitoring.md#distributed-monitoring-top-down-command-endpoint) is disabled by default. ## Master Setup This section explains how to install a central single master node using -the `node wizard` command. If you prefer to do a manual installation please -refer to the [manual setup]() section. +the `node wizard` command. If you prefer to do an automated installation, please +refer to the [automated setup](6-distributed-monitoring.md#distributed-monitoring-advanced-hints-automation) section. Required information: Parameter | Description --------------------|-------------------- Common name (CN) | **Required.** By convention this should be the host's FQDN. Defaults to the FQDN. - API bind host | **Optional.** Allows to specify the address where the ApiListener is bound to. For advanced usage only. - API bind port | **Optional.** Allows to specify the port where the ApiListener is bound to. For advanced usage only (requires changing the default port 5665 everywhere). + API bind host | **Optional.** Allows to specify the address the ApiListener is bound to. For advanced usage only. + API bind port | **Optional.** Allows to specify the port the ApiListener is bound to. For advanced usage only (requires changing the default port 5665 everywhere). The setup wizard will ensure that the following steps are taken: -* Setup the `api` feature -* Generate a new certificate authority (CA) in `/var/lib/icinga2/ca` if not existing -* Create a certificate signing request (CSR) for the local node -* Sign the CSR with the local CA and copy all files into the `/etc/icinga2/pki` directory -* Update the `zones.conf` file with the new zone hierarchy -* Update `/etc/icinga2/features-enabled/api.conf` and `constants.conf` +* Enable the `api` feature. +* Generate a new certificate authority (CA) in `/var/lib/icinga2/ca` if it doesn't exist. +* Create a certificate signing request (CSR) for the local node. +* Sign the CSR with the local CA and copy all files to the `/etc/icinga2/pki` directory. +* Update the `zones.conf` file with the new zone hierarchy. +* Update `/etc/icinga2/features-enabled/api.conf` and `constants.conf`. -Example master setup for the `icinga2-master1.localdomain` node on CentOS 7: +Here is an example of a master setup for the `icinga2-master1.localdomain` node on CentOS 7: [root@icinga2-master1.localdomain /]# icinga2 node wizard Welcome to the Icinga 2 Setup Wizard! @@ -201,30 +204,30 @@ Example master setup for the `icinga2-master1.localdomain` node on CentOS 7: [root@icinga2-master1.localdomain /]# systemctl restart icinga2 -The CA public and private key are stored in the `/var/lib/icinga2/ca` directory. Keep this path secure and include +As you can see, the CA public and private key are stored in the `/var/lib/icinga2/ca` directory. Keep this path secure and include it in your backups. -Once the master setup is completed, you can also use this node as primary CSR auto-signing -master. The following chapter will explain how to use the cli commands fetching their +Once the master setup is complete, you can also use this node as primary CSR auto-signing +master. The following section will explain how to use the CLI commands in order to fetch their signed certificate from this master node. ## Client/Satellite Setup This section describes the setup of a satellite and/or client connected to an -existing master node setup. If you haven't done so already please [run the master setup](6-distributed-monitoring.md#distributed-monitoring-setup-master). +existing master node setup. If you haven't done so already, please [run the master setup](6-distributed-monitoring.md#distributed-monitoring-setup-master). Icinga 2 on the master node must be running and accepting connections on port `5665`. ### CSR Auto-Signing -The `node wizard` cli command will setup a satellite/client using CSR auto-signing. This -involves that the setup wizard sends a certificate signing request (CSR) to the +The `node wizard` command will set up a satellite/client using CSR auto-signing. This +involves the setup wizard sending a certificate signing request (CSR) to the master node. There is a security mechanism in place which requires the client to send in a valid ticket for CSR auto-signing. This ticket must be generated beforehand. The `ticket_salt` attribute for the [ApiListener](9-object-types.md#objecttype-apilistener) -must be properly configured in order to make this work. +must be configured properly in order to make this work. There are two possible ways to retrieve the ticket: @@ -237,8 +240,7 @@ Required information: --------------------|-------------------- Common name (CN) | **Required.** The common name for the satellite/client. By convention this should be the FQDN. -Example for the client `icinga2-client1.localdomain` generating a ticket on the master node -`icinga2-master1.localdomain`: +The following example shows how to generate a ticket on the master node `icinga2-master1.localdomain` for the client `icinga2-client1.localdomain`: [root@icinga2-master1.localdomain /]# icinga2 pki ticket --cn icinga2-client1.localdomain @@ -254,7 +256,7 @@ object with at least the `actions/generate-ticket`. [root@icinga2-master1.localdomain /]# systemctl restart icinga2 -Retrieve the ticket on the client node `icinga2-client1.localdomain` with curl for example: +Retrieve the ticket on the client node `icinga2-client1.localdomain` with `curl`, for example: [root@icinga2-client1.localdomain /]# curl -k -s -u client-pki-ticket:bea11beb7b810ea9ce6ea -H 'Accept: application/json' \ -X POST 'https://icinga2-master1.localdomain:5665/v1/actions/generate-ticket' -d '{ "cn": "icinga2-client1.localdomain" }' @@ -263,7 +265,7 @@ Store that ticket number for the satellite/client setup below. ### Client/Satellite Linux Setup -Please ensure that you've run all the steps mentioned in the [client/satellite chapter](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client). +Please ensure that you've run all the steps mentioned in the [client/satellite section](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client). Required information: @@ -272,26 +274,25 @@ Required information: Common name (CN) | **Required.** By convention this should be the host's FQDN. Defaults to the FQDN. Master common name | **Required.** Use the common name you've specified for your master node before. Establish connection to the master | **Optional.** Whether the client should attempt to connect the to master or not. Defaults to `y`. - Master endpoint host | **Required if the the client should connect to the master.** The master's IP address or FQDN. This information is written to the `Endpoint` object configuration in the `zones.conf` file. - Master endpoint port | **Optional if the the client should connect to the master.** The master's listening port. This information is written to the `Endpoint` object configuration. + Master endpoint host | **Required if the the client needs to connect to the master.** The master's IP address or FQDN. This information is included in the `Endpoint` object configuration in the `zones.conf` file. + Master endpoint port | **Optional if the the client needs to connect to the master.** The master's listening port. This information is included in the `Endpoint` object configuration. Add more master endpoints | **Optional.** If you have multiple master nodes configured, add them here. Master connection for CSR auto-signing | **Required.** The master node's IP address or FQDN and port where the client should request a certificate from. Defaults to the master endpoint host. Certificate information | **Required.** Verify that the connecting host really is the requested master node. Request ticket | **Required.** Paste the previously generated [ticket number](6-distributed-monitoring.md#distributed-monitoring-setup-csr-auto-signing). - API bind host | **Optional.** Allows to specify the address where the ApiListener is bound to. For advanced usage only. - API bind port | **Optional.** Allows to specify the port where the ApiListener is bound to. For advanced usage only (requires changing the default port 5665 everywhere). - Accept config | **Optional.** Whether this node accepts configuration sync from the master node (required for [config sync mode](6-distributed-monitoring.md#distributed-monitoring-top-down-config-sync). Defaults to 'n'. - Accept commands | **Optional.** Whether this node accepts command execution message from the master node (required for [command endpoint mode](6-distributed-monitoring.md#distributed-monitoring-top-down-command-endpoint). Defaults to 'n'. + API bind host | **Optional.** Allows to specify the address the ApiListener is bound to. For advanced usage only. + API bind port | **Optional.** Allows to specify the port the ApiListener is bound to. For advanced usage only (requires changing the default port 5665 everywhere). + Accept config | **Optional.** Whether this node accepts configuration sync from the master node (required for [config sync mode](6-distributed-monitoring.md#distributed-monitoring-top-down-config-sync)). Defaults to `n`. + Accept commands | **Optional.** Whether this node accepts command execution messages from the master node (required for [command endpoint mode](6-distributed-monitoring.md#distributed-monitoring-top-down-command-endpoint)). Defaults to `n`. -Example for the client `icinga2-client1.localdomain` generating a ticket on the master node -`icinga2-master1.localdomain`: +In this example we're generating a ticket on the master node `icinga2-master1.localdomain` for the client `icinga2-client1.localdomain`: [root@icinga2-master1.localdomain /]# icinga2 pki ticket --cn icinga2-client1.localdomain 4f75d2ecd253575fe9180938ebff7cbca262f96e -Example client setup for the `icinga2-client1.localdomain` node on CentOS 7. This client -is configured to receive configuration sync and also accept commands. +The following example shows a client setup for the `icinga2-client1.localdomain` node on CentOS 7. This client +is configured to accept configuration and commands from the master: [root@icinga2-client1.localdomain /]# icinga2 node wizard Welcome to the Icinga 2 Setup Wizard! @@ -350,7 +351,7 @@ is configured to receive configuration sync and also accept commands. Now restart your Icinga 2 daemon to finish the installation! -Now that you've succesfully installed a satellite/client please proceed to the +Now that you've succesfully installed a satellite/client, please proceed to the [configuration modes](6-distributed-monitoring.md#distributed-monitoring-configuration-modes). @@ -361,9 +362,9 @@ Download the MSI-Installer package from [http://packages.icinga.org/windows/](ht 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. +* [Microsoft .NET Framework 2.0](http://www.microsoft.com/de-de/download/details.aspx?id=1639) -The installer package includes the [NSClient++](http://www.nsclient.org/) so Icinga 2 can +The installer package includes the [NSClient++](http://www.nsclient.org/) so that Icinga 2 can use its built-in plugins. You can use the [nscp-local commands from the ITL](10-icinga-template-library.md#nscp-plugin-check-commands) for these plugins. @@ -374,17 +375,16 @@ for these plugins. ![Icinga 2 Windows Setup](images/distributed-monitoring/icinga2_windows_setup_installer_05.png) The graphical installer will offer to run the Icinga 2 setup wizard after the installation. -You can also manually run the Icinga 2 setup wizard from the start menu. +You can also manually run the Icinga 2 setup wizard from the Start menu. -On a fresh installation the setup wizard will guide you through the initial configuration -as well as the required details for SSL certificate generation using CSR-Autosigning. +On a fresh installation the setup wizard will guide you through the initial configuration and offer to use CSR auto-signing for generating the SSL certificate. You'll need the following configuration details: -* The client common name (CN). Defaults to FQDN. -* The request ticket number generated on your master for CSR Auto-Signing +* The client common name (CN) (defaults to FQDN) +* The request ticket number generated on your master for CSR auto-signing -Example for the client `icinga2-client2.localdomain` generating a ticket on the master node +This example shows how to generate a ticket for the client `icinga2-client2.localdomain` on the master node `icinga2-master1.localdomain`: [root@icinga2-master1.localdomain /]# icinga2 pki ticket --cn DESKTOP-IHRPO96 @@ -395,12 +395,12 @@ Fill in the required information and click `Add` to add a new master connection. Add the following details: -* 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 master endpoint name. Have a look at the file `zones.conf` on the master node to find out the proper name. +* The master endpoint connection information, i.e., your master's IP address and port (defaults to 5665). ![Icinga 2 Windows Setup](images/distributed-monitoring/icinga2_windows_setup_wizard_02.png) -You can optionally enable the following settings: +Optionally, you can enable the following settings: * Accept config updates from master (client with [config sync mode](6-distributed-monitoring.md#distributed-monitoring-top-down-config-sync)) * Accept commands from master (client as [command endpoint](6-distributed-monitoring.md#distributed-monitoring-top-down-command-endpoint)). @@ -421,90 +421,88 @@ Finish the setup wizard. ![Icinga 2 Windows Setup](images/distributed-monitoring/icinga2_windows_setup_wizard_06.png) -Once install and configuration is done, Icinga 2 is automatically started as a Windows service. +After the installation and configuration Icinga 2 is automatically started as a Windows service. ![Icinga 2 Windows Setup](images/distributed-monitoring/icinga2_windows_running_service.png) -The Icinga 2 configuration is located inside the `C:\ProgramData\icinga2` directory. -If you click `Examine Config` in the setup wizard, it will open a new explorer window. +The Icinga 2 configuration is stored inside the `C:\ProgramData\icinga2` directory. +If you click `Examine Config` in the setup wizard, it will open a new Explorer window. ![Icinga 2 Windows Setup](images/distributed-monitoring/icinga2_windows_setup_wizard_examine_config.png) The configuration files can be modified with your favorite editor. -Configuration validation is done similar to the linux pendant on the Windows shell: +To validate the configuration on Windows open a terminal and enter the following command: C:> icinga2.exe daemon -C -**Note**: You have to run this command in a shell with `administrator` permissions. +**Note**: You have to run this command in a shell with `administrator` privileges. In case you want to restart the Icinga 2 service, run `services.msc` and restart the -`icinga2` service. Alternatively you can use the `net {start,stop}` CLI commands. +`icinga2` service. Alternatively, you can use the `net {start,stop}` CLI commands. -Now that you've succesfully installed a satellite/client please proceed to the +Now that you've succesfully installed a satellite/client, please proceed to the [configuration modes](6-distributed-monitoring.md#distributed-monitoring-configuration-modes). ## Configuration Modes There are different ways to ensure that the Icinga 2 cluster nodes execute -checks, send notifications, etc. +checks, send notifications, etc. -The following modes differ in the way the host/service object -configuration is synchronized among nodes and checks are executed. +Two different modes are available for synchronizing the host/service object's configuration between nodes and for executing checks: -* [Top down](6-distributed-monitoring.md#distributed-monitoring-top-down). This mode syncs the configuration and commands from the master into child zones. +* [Top down](6-distributed-monitoring.md#distributed-monitoring-top-down): This mode sends the configuration and commands from the master to the child zones. * [Bottom up](6-distributed-monitoring.md#distributed-monitoring-bottom-up). This mode leaves the configuration on the child nodes and requires an import on the parent nodes. -Read the chapter carefully and decide upon your requirements which way fits -best for your environments. You should not mix them -- that will overly complicate -your setup. +The next sections describe the differences and how to set up the two modes. +Read them carefully before you decide on one of the two options -- do not +mix them, as this will make things unnecessarily complicated. -Check results are synced all the way up from the child nodes to the parent nodes. -That happens automatically and is ensured by the cluster protocol. +**Note**: Check results are always send from the child nodes to the parent nodes. That happens automatically and is ensured by the cluster protocol. ### Top Down -This is the most commonly used mode gathered from community feedback. +According to feedback that we've received from the community, This is the most commonly used mode. -There are two different behaviours with check execution: +There are two different behaviors with check execution: -* Send a command execution event remotely, the scheduler still runs on the parent node -* Sync the host/service objects directly to the child node, checks are executed locally +* Send a command execution event remotely: The scheduler still runs on the parent node. +* Sync the host/service objects directly to the child node: Checks are executed locally. -Again -- it does not matter whether this is a `client` or a `satellite` +Again, it does not matter whether this is a `client` or a `satellite` which is receiving configuration or command execution events. ### Top Down Command Endpoint This mode will force the Icinga 2 node to execute commands remotely on a specified endpoint. The host/service object configuration is located on the master/satellite and the client only -needs the CheckCommand object definitions used. +needs the CheckCommand object definitions being used there. ![Icinga 2 Distributed Top Down Command Endpoint](images/distributed-monitoring/icinga2_distributed_top_down_command_endpoint.png) Advantages: -* No local checks defined on the child node (client) +* No local checks need to be defined on the child node (client). * Light-weight remote check execution (asynchronous events) -* No replay log necessary on child node disconnect (ensure to set `log_duration=0` on the parent node) -* Pin checks to specific endpoints (if the child zone consists of 2 endpoints) +* No [replay log](6-distributed-monitoring.md#distributed-monitoring-advanced-hints-command-endpoint-log-duration) is necessary for the child node. +* Pin checks to specific endpoints (if the child zone consists of 2 endpoints). Disadvantages: -* If the child node is not connected, no more checks are executed -* Requires additional configuration attribute specified in host/service objects +* If the child node is not connected, no more checks are executed. +* Requires additional configuration attribute specified in host/service objects. * Requires local `CheckCommand` object configuration. Best practice is to use a [global config zone](6-distributed-monitoring.md#distributed-monitoring-global-zone-config-sync). -In order that all involved nodes will accept configuration and/or -commands you'll need to configure the `Zone` and `Endpoint` hierarchy +To make sure that all nodes involved will accept configuration and/or +commands, you need to configure the `Zone` and `Endpoint` hierarchy on all nodes. * `icinga2-master1.localdomain` is the configuration master in this scenario. -* `icinga2-client2.localdomain` acts as client which receives command execution messages via command endpoint from the master. In addition it receives global check command configuration from the master. +* `icinga2-client2.localdomain` acts as client which receives command execution messages via command endpoint from the master. In addition, it receives the global check command configuration from the master. -Put the endpoint and zone configuration on **both** nodes into `/etc/icinga2/zones.conf`. +Include the endpoint and zone configuration on **both** nodes in the file `/etc/icinga2/zones.conf`. -The endpoint configuration could look like this: +The endpoint configuration could look like this, for example: object Endpoint "icinga2-master1.localdomain" { host = "192.168.56.101" @@ -514,15 +512,14 @@ The endpoint configuration could look like this: host = "192.168.56.112" } -Then you'll need to define two zones. There is no naming convention but best practice -is to either use `master`, `satellite`/`client-fqdn` or go by region names. +Next, you need to define two zones. There is no naming convention, best practice is to either use `master`, `satellite`/`client-fqdn` or to choose region names for example `Europe`, `USA` and `Asia`, though. > **Note** > > Each client requires its own zone and endpoint configuration. Best practice -> has been to use the client's FQDN for all object names. +> is to use the client's FQDN for all object names. -The `master` zone is a parent of the `icinga2-client2.localdomain` zone. +The `master` zone is a parent of the `icinga2-client2.localdomain` zone: object Zone "master" { endpoints = [ "icinga2-master1.localdomain" ] //array with endpoint names @@ -534,16 +531,16 @@ The `master` zone is a parent of the `icinga2-client2.localdomain` zone. parent = "master" //establish zone hierarchy } -In addition to that add a [global zone](6-distributed-monitoring.md#distributed-monitoring-global-zone-config-sync) -for syncing check commands later. +In addition, add a [global zone](6-distributed-monitoring.md#distributed-monitoring-global-zone-config-sync) +for syncing check commands later: object Zone "global-templates" { global = true } Edit the `api` feature on the client `icinga2-client2.localdomain` in -the `/etc/icinga2/features-enabled/api.conf` file and ensure to set -`accept_commands` and `accept_config` to `true`. +the `/etc/icinga2/features-enabled/api.conf` file and make sure to set +`accept_commands` and `accept_config` to `true`: [root@icinga2-client1.localdomain /]# vim /etc/icinga2/features-enabled/api.conf @@ -553,7 +550,7 @@ the `/etc/icinga2/features-enabled/api.conf` file and ensure to set accept_config = true } -Now it is time to validate the configuration and restart the Icinga 2 daemon +Now it is time to validate the configuration and to restart the Icinga 2 daemon on both nodes. Example on CentOS 7: @@ -564,17 +561,17 @@ Example on CentOS 7: [root@icinga2-master1.localdomain /]# icinga2 daemon -C [root@icinga2-master1.localdomain /]# systemctl restart icinga2 -Once the clients have connected you are ready for the next step - **execute +Once the clients have successfully connected, you are ready for the next step: **execute a remote check on the client using the command endpoint**. -Put the host and service object configuration into the `master` zone --- this will help adding a secondary master for High-Availability later. +Include the host and service object configuration in the `master` zone +-- this will help adding a secondary master for high-availability later. [root@icinga2-master1.localdomain /]# mkdir -p /etc/icinga2/zones.d/master Add the host and service objects you want to monitor. There is -no limitation with files and directories -- best practice is to -keep things organised by type. +no limitation for files and directories -- best practice is to +sort things by type. By convention a master/satellite/client host object should use the same name as the endpoint object. You can also add multiple hosts which execute checks against remote services/clients. @@ -589,7 +586,7 @@ You can also add multiple hosts which execute checks against remote services/cli vars.client_endpoint = host.name //follows the convention host name == endpoint name } -Given that you are monitoring a Linux client we'll just add a remote [disk](10-icinga-template-library.md#plugin-check-command-disk) +Given that you are monitoring a Linux client, we'll just add a remote [disk](10-icinga-template-library.md#plugin-check-command-disk) check. [root@icinga2-master1.localdomain /etc/icinga2/zones.d/master]# vim services.conf @@ -603,7 +600,7 @@ check. assign where host.vars.client_endpoint } -In case that you have your own custom CheckCommand add it to the global zone. +If you have your own custom CheckCommand, add it to the global zone: [root@icinga2-master1.localdomain /]# mkdir -p /etc/icinga2/zones.d/global-templates [root@icinga2-master1.localdomain /]# vim /etc/icinga2/zones.d/global-templates/commands.conf @@ -614,7 +611,7 @@ In case that you have your own custom CheckCommand add it to the global zone. //... } -Save and validate the configuration on the master node. +Save the changes and validate the configuration on the master node: [root@icinga2-master1.localdomain /]# icinga2 daemon -C @@ -622,25 +619,24 @@ Restart the Icinga 2 daemon (example for CentOS 7): [root@icinga2-master1.localdomain /]# systemctl restart icinga2 -Now the following happens: +The following things happen: * Icinga 2 validates the configuration on `icinga2-master1.localdomain` and restarts. * The `icinga2-master1.localdomain` node schedules and executes the checks. * The `icinga2-client2.localdomain` node receives the execute command event with additional command parameters. -* The `icinga2-client2.localdomain` node maps the command parameters onto the local check command, executes the check locally and sends back the check result message. +* The `icinga2-client2.localdomain` node maps the command parameters to the local check command, executes the check locally, and sends back the check result message. -You'll see - no reload or any interaction required on the client -itself. +As you can see, no interaction from your side is required on the client itself, and it's not necessary to reload the Icinga 2 service on the client. -Now you have learned the basics about command endpoint checks. Proceed in +You have learned the basics about command endpoint checks. Proceed with the [scenarios](6-distributed-monitoring.md#distributed-monitoring-scenarios) -chapter for more details on extending the setup. +section where you can find detailed information on extending the setup. ### Top Down Config Sync This mode syncs the object configuration files within specified zones. -This comes in handy if you want to configure everything on the master node +It comes in handy if you want to configure everything on the master node and sync the satellite checks (disk, memory, etc.). The satellites run their own local scheduler and will send the check result messages back to the master. @@ -649,7 +645,7 @@ own local scheduler and will send the check result messages back to the master. Advantages: * Sync the configuration files from the parent zone to the child zones. -* No manual restart required on the child nodes - sync, validation and restarts happen automatically. +* No manual restart is required on the child nodes, as syncing, validation, and restarts happen automatically. * Execute checks directly on the child node's scheduler. * Replay log if the connection drops (important for keeping the check history in sync, e.g. for SLA reports). * Use a global zone for syncing templates, groups, etc. @@ -657,17 +653,17 @@ Advantages: Disadvantages: * Requires a config directory on the master node with the zone name underneath `/etc/icinga2/zones.d`. -* Additional zone and endpoint configuration. -* Replay log is replicated on reconnect. This might generate an overload on the used connection. +* Additional zone and endpoint configuration needed. +* Replay log is replicated on reconnect. This might increase the data transfer and create an overload on the connection. -In order that all involved nodes will accept configuration and/or -commands you'll need to configure the `Zone` and `Endpoint` hierarchy +To make sure that all involved nodes accept configuration and/or +commands, you need to configure the `Zone` and `Endpoint` hierarchy on all nodes. * `icinga2-master1.localdomain` is the configuration master in this scenario. * `icinga2-client1.localdomain` acts as client which receives configuration from the master. -Put the endpoint and zone configuration on **both** nodes into `/etc/icinga2/zones.conf`. +Include the endpoint and zone configuration on **both** nodes in the file `/etc/icinga2/zones.conf`. The endpoint configuration could look like this: @@ -679,15 +675,14 @@ The endpoint configuration could look like this: host = "192.168.56.111" } -Then you'll need to define two zones. There is no naming convention but best practice -is to either use `master`, `satellite`/`client-fqdn` or go by region names. +Next, you need to define two zones. There is no naming convention, best practice is to either use `master`, `satellite`/`client-fqdn` or to choose region names for example `Europe`, `USA` and `Asia`, though. > **Note** > > Each client requires its own zone and endpoint configuration. Best practice -> has been to use the client's FQDN for all object names. +> is to use the client's FQDN for all object names. -The `master` zone is a parent of the `icinga2-client1.localdomain` zone. +The `master` zone is a parent of the `icinga2-client1.localdomain` zone: object Zone "master" { endpoints = [ "icinga2-master1.localdomain" ] //array with endpoint names @@ -700,7 +695,7 @@ The `master` zone is a parent of the `icinga2-client1.localdomain` zone. } Edit the `api` feature on the client `icinga2-client1.localdomain` in -the `/etc/icinga2/features-enabled/api.conf` file and ensure to set +the `/etc/icinga2/features-enabled/api.conf` file and set `accept_config` to `true`. [root@icinga2-client1.localdomain /]# vim /etc/icinga2/features-enabled/api.conf @@ -710,7 +705,7 @@ the `/etc/icinga2/features-enabled/api.conf` file and ensure to set accept_config = true } -Now it is time to validate the configuration and restart the Icinga 2 daemon +Now it is time to validate the configuration and to restart the Icinga 2 daemon on both nodes. Example on CentOS 7: @@ -727,18 +722,18 @@ Example on CentOS 7: > Best practice is to use a [global zone](6-distributed-monitoring.md#distributed-monitoring-global-zone-config-sync) > for common configuration items (check commands, templates, groups, etc.). -Once the clients have connected you are ready for the next step - **execute +Once the clients have connected successfully, it's time for the next step: **execute a local check on the client using the configuration sync**. -Therefore navigate into `/etc/icinga2/zones.d` on your config master +Navigate to `/etc/icinga2/zones.d` on your master node `icinga2-master1.localdomain` and create a new directory with the same -name as your satellite/client zone name. +name as your satellite/client zone name: [root@icinga2-master1.localdomain /]# mkdir -p /etc/icinga2/zones.d/icinga2-client1.localdomain Add the host and service objects you want to monitor. There is -no limitation with files and directories -- best practice is to -keep things organised by type. +no limitation for files and directories -- best practice is to +sort things by type. By convention a master/satellite/client host object should use the same name as the endpoint object. You can also add multiple hosts which execute checks against remote services/clients. @@ -763,7 +758,7 @@ check. check_command = "disk" } -Save and validate the configuration on the master node. +Save the changes and validate the configuration on the master node: [root@icinga2-master1.localdomain /]# icinga2 daemon -C @@ -771,54 +766,55 @@ Restart the Icinga 2 daemon (example for CentOS 7): [root@icinga2-master1.localdomain /]# systemctl restart icinga2 -Now the following happens: +The following things happen: -* Icinga 2 validates the configuration on `icinga2-master1.localdomain` -* Icinga 2 copies the configuration into its zone config store in `/var/lib/icinga2/api/zones` +* Icinga 2 validates the configuration on `icinga2-master1.localdomain`. +* Icinga 2 copies the configuration into its zone config store in `/var/lib/icinga2/api/zones`. * The `icinga2-master1.localdomain` node sends a config update event to all endpoints in the same or direct child zones. * The `icinga2-client1.localdomain` node accepts config and populates the local zone config store with the received config files. * The `icinga2-client1.localdomain` node validates the configuration and automatically restarts. -You'll see - no reload or any interaction required on the client +Again, there is no interaction required on the client itself. -You can also use the config sync inside a High-Availability zone to +You can also use the config sync inside a high-availability zone to ensure that all config objects are synced among zone members. > **Note** > > You can only have one so-called "config master" in a zone which stores -> configuration in `zones.d`. Everything else breaks and is not supported. +> the configuration in `zones.d`. Everything else is not supported. -Now you have learned the basics about the configuration sync. Proceed in +Now that you've learned the basics about the configuration sync, proceed with the [scenarios](6-distributed-monitoring.md#distributed-monitoring-scenarios) -chapter for more details on extending the setup. +section where you can find detailed information on extending the setup. ### Bottom Up Import -This mode requires you to manage the configuration on the client itself. -Edit the configuration files underneath `/etc/icinga2/conf.d` or any other +This mode requires that you manage the configuration on the client itself. +Edit the configuration files in `/etc/icinga2/conf.d` or any other directory included in the `icinga2.conf` file. -The client will send the configured objects to the parent zone members -where they can generate configuration objects gathered from that information. +The client will send information about the configured objects to +the parent zone members where they can generate configuration +objects. ![Icinga 2 Distributed Bottom Up](images/distributed-monitoring/icinga2_distributed_bottom_up.png) Advantages: * Each child node comes preconfigured with the most common local checks. -* Central management for zones, endpoints, hosts and services with configuration repository import. +* Central management for zones, endpoints, hosts, and services with configuration repository import. Disadvantages: -* No object attribute sync. Parent nodes cannot filter for specific attributes in assign expressions. +* No object attribute sync. Parent nodes cannot filter specific attributes in assign expressions. * Does not reliably work with a HA parent zone (single master preferred). * Configuration management of many client nodes is hard or impossible if you don't have access to them. -You can list and import the configuration sent from clients on the master -node. Example for listing all client services on the master node `icinga2-master1.localdomain`: +On the master node, you can list and import the configuration sent from all the clients. +This example shows all client services on the master node `icinga2-master1.localdomain`: [root@icinga2-master1.localdomain /]# icinga2 node list Node 'icinga2-client1.localdomain' (last seen: Sun Aug 14 11:19:14 2016) @@ -849,24 +845,25 @@ node. Example for listing all client services on the master node `icinga2-master The object configuration must exist on the master node as well in order to receive check results from the clients. Therefore -you'll need to invoke the `node update-config` cli command. +you need to invoke the `node update-config` command: [root@icinga2-master1.localdomain /]# icinga2 node update-config information/cli: Updating node configuration for ... The generated configuration objects are located in `/etc/icinga2/repository.d`. -If you have accidentally added specific hosts or services you can safely purge -them from this directory and restart icinga 2. +If you have accidentally added specific hosts or services, you can safely purge +them from this directory and restart Icinga 2. -In case you want to blacklist or whitelist several hosts and/or services -to not generate configuration on the master, use the `icinga2 node {black,white}list` -cli commands. +> **Tip** In case you want to blacklist or whitelist certain hosts and/or services +> on the master, use the `icinga2 node {black,white}list` +> commands. -Example for blacklisting all `ping*` services, but allowing only `probe` host with `ping4`: +In this example we're first putting all `ping*` services on all hosts on the blacklist. +With the next command we allow the host `probe` to run the service `ping4`: # icinga2 node blacklist add --zone "*" --host "*" --service "ping*" - # icinga2 node whitelist add --zone "*" --host "probe" --service "ping*" + # icinga2 node whitelist add --zone "*" --host "probe" --service "ping4" You can `list` and `remove` existing blacklists: @@ -876,7 +873,7 @@ You can `list` and `remove` existing blacklists: # icinga2 node whitelist list Listing all whitelist entries: - whitelist filter for Node: '*' Host: 'probe' Service: 'ping*'. + whitelist filter for Node: '*' Host: 'probe' Service: 'ping4'. There are certain limitations with this mode. Currently the repository does not sync object attributes (custom attributes, group memberships) @@ -889,14 +886,14 @@ or group memberships required for Icinga Web 2 and addons. ## Scenarios -These examples should give you an idea how you can build your own +The following examples should give you an idea on how to build your own distributed monitoring environment. We've seen them all in production environments and received feedback from our [community](https://www.icinga.org/community/get-help/) -and [partner support](https://www.icinga.org/services/support/) channels. +and [partner support](https://www.icinga.org/services/support/) channels: * Single master with clients * HA master with clients as command endpoint -* Three level cluster with config HA masters, satellites receiving config sync and clients checked using command_endpoint +* Three level cluster with config HA masters, satellites receiving config sync, and clients checked using command endpoint ### Master with Clients @@ -907,8 +904,8 @@ and [partner support](https://www.icinga.org/services/support/) channels. Setup requirements: -* Install `icinga2-master1.localdomain` as [master setup](6-distributed-monitoring.md#distributed-monitoring-setup-master) -* Install `icinga2-client1.localdomain` and `icinga2-client2.localdomain` as [client setup](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client) +* Set up `icinga2-master1.localdomain` as [master](6-distributed-monitoring.md#distributed-monitoring-setup-master) +* Set up `icinga2-client1.localdomain` and `icinga2-client2.localdomain` as [client](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client) Edit the `zones.conf` configuration file on the master: @@ -943,9 +940,9 @@ Edit the `zones.conf` configuration file on the master: } The two client nodes do not necessarily need to know about each other. The only important thing -is that they know about the parent zone and their endpoint members and optional the global zone. +is that they know about the parent zone and their endpoint members (and optionally the global zone). -If you specify the `host` attribute in the `icinga2-master1.localdomain` endpoint object +If you specify the `host` attribute in the `icinga2-master1.localdomain` endpoint object, the client will actively try to connect to the master node. Since we've specified the client endpoint's attribute on the master node already, we don't want the clients to connect to the master. Choose one connection direction. @@ -995,14 +992,14 @@ master. Choose one connection direction. } Now it is time to define the two client hosts and apply service checks using -the command endpoint execution method to them. Note: You can also use the +the command endpoint execution method on them. Note: You can also use the config sync mode here. -Create a new configuration directory on the master node. +Create a new configuration directory on the master node: [root@icinga2-master1.localdomain /]# mkdir -p /etc/icinga2/zones.d/master -Add the two client nodes as host objects. +Add the two client nodes as host objects: [root@icinga2-master1.localdomain /]# cd /etc/icinga2/zones.d/master [root@icinga2-master1.localdomain /etc/icinga2/zones.d/master]# vim hosts.conf @@ -1019,7 +1016,7 @@ Add the two client nodes as host objects. vars.client_endpoint = host.name //follows the convention host name == endpoint name } -Add services using command endpoint checks. +Add services using command endpoint checks: [root@icinga2-master1.localdomain /etc/icinga2/zones.d/master]# vim services.conf @@ -1040,52 +1037,47 @@ Add services using command endpoint checks. Validate the configuration and restart Icinga 2 on the master node `icinga2-master1.localdomain`. -Open Icinga Web 2 and check the 2 newly created clients hosts with two new services +Open Icinga Web 2 and check the two newly created client hosts with two new services -- one executed locally (`ping4`) and one using command endpoint (`disk`). ### High-Availability Master with Clients ![Icinga 2 Distributed High Availability Master with Clients](images/distributed-monitoring/icinga2_distributed_scenarios_ha_master_clients.png) -This scenario is quite the same as you have already found in the [chapter before](6-distributed-monitoring.md#distributed-monitoring-master-clients). +This scenario is similar to the one in the [previous section](6-distributed-monitoring.md#distributed-monitoring-master-clients). The only difference is that we will now set up two master nodes in a high-availablity setup. +These nodes must be configured as zone and endpoints objects. -The real difference is that we will now setup two master nodes in a High-Availablity setup. -These nodes must be configured into zone and endpoints objects. - -This scenario uses the capabilities of the Icinga 2 cluster. All zone members -replicate cluster events amongst each other. In addition to that several Icinga 2 +The setup uses the capabilities of the Icinga 2 cluster. All zone members +replicate cluster events amongst each other. In addition to that, several Icinga 2 features can enable HA functionality. -> **Notes** -> All nodes in the same zone require the same features enabled for High Availability (HA) -> amongst them. +> **Note** +> All nodes in the same zone require that you enable the same features for high-availability (HA). Overview: -* `icinga2-master1.localdomain` is the config master master node -* `icinga2-master2.localdomain` is the secondary master master node without config in `zones.d` -* `icinga2-client1.localdomain` and `icinga2-client2.localdomain` are two child nodes as clients +* `icinga2-master1.localdomain` is the config master master node. +* `icinga2-master2.localdomain` is the secondary master master node without config in `zones.d`. +* `icinga2-client1.localdomain` and `icinga2-client2.localdomain` are two child nodes as clients. Setup requirements: -* Install `icinga2-master1.localdomain` as [master setup](6-distributed-monitoring.md#distributed-monitoring-setup-master) -* Install `icinga2-master2.localdomain` as [client setup](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client) (we will modify the generated configuration) -* Install `icinga2-client1.localdomain` and `icinga2-client2.localdomain` as [client setup](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client) (when asked for adding multiple masters, tick 'y' and add the secondary master `icinga2-master2.localdomain`). +* Set up `icinga2-master1.localdomain` as [master](6-distributed-monitoring.md#distributed-monitoring-setup-master). +* Set up `icinga2-master2.localdomain` as [client](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client) (we will modify the generated configuration). +* Set up `icinga2-client1.localdomain` and `icinga2-client2.localdomain` as [clients](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client) (when asked for adding multiple masters, set to `y` and add the secondary master `icinga2-master2.localdomain`). -In case you not want to use the cli commands you can also manually create and sync the -required SSL certificates. We will modify and discuss the generated configuration here -in detail. +In case you don't want to use the CLI commands, you can also manually create and sync the +required SSL certificates. We will modify and discuss all the details of the automatically generated configuration here. -Since there are now two nodes in the same zone we must consider the +Since there are now two nodes in the same zone, we must consider the [high-availability features](6-distributed-monitoring.md#distributed-monitoring-high-availability-features). -* Checks and notifiations are balanced between the two master nodes. That's fine but requires check plugins and notification scripts to exist on both nodes. -* The IDO feature will only be active on one node by default. Since all events are replicated between both nodes it is easier to just have one central database. +* Checks and notifiations are balanced between the two master nodes. That's fine, but it requires check plugins and notification scripts to exist on both nodes. +* The IDO feature will only be active on one node by default. Since all events are replicated between both nodes, it is easier to just have one central database. -Decide whether you want to use a dedicated MySQL cluster VIP (external application cluster) -and leave the IDO feature with enabled HA capabilities. Or you'll configure the feature to -disable HA and write to a local installed database on each node. Both implementation methods -require you to configure Icinga Web 2 accordingly (Monitoring backend - IDO database, used transports). +One possibility is to use a dedicated MySQL cluster VIP (external application cluster) +and leave the IDO feature with enabled HA capabilities. Alternatively, you can disable the HA feature and write to a local database on each node. Both methods +require that you configure Icinga Web 2 accordingly (monitoring backend, IDO database, used transports, etc.). The zone hierarchy could look like this. It involves putting the two master nodes `icinga2-master1.localdomain` and `icinga2-master2.localdomain` into the `master` zone. @@ -1126,10 +1118,10 @@ The zone hierarchy could look like this. It involves putting the two master node } The two client nodes do not necessarily need to know about each other. The only important thing -is that they know about the parent zone and their endpoint members and optional the global zone. +is that they know about the parent zone and their endpoint members (and optionally about the global zone). If you specify the `host` attribute in the `icinga2-master1.localdomain` and `icinga2-master2.localdomain` -endpoint objects the client will actively try to connect to the master node. Since we've specified the client +endpoint objects, the client will actively try to connect to the master node. Since we've specified the client endpoint's attribute on the master node already, we don't want the clients to connect to the master nodes. Choose one connection direction. @@ -1186,7 +1178,7 @@ master nodes. Choose one connection direction. } Now it is time to define the two client hosts and apply service checks using -the command endpoint execution method to them. Note: You can also use the +the command endpoint execution method. Note: You can also use the config sync mode here. Create a new configuration directory on the master node `icinga2-master1.localdomain`. @@ -1195,7 +1187,7 @@ configuration using the [config sync mode](6-distributed-monitoring.md#distribut [root@icinga2-master1.localdomain /]# mkdir -p /etc/icinga2/zones.d/master -Add the two client nodes as host objects. +Add the two client nodes as host objects: [root@icinga2-master1.localdomain /]# cd /etc/icinga2/zones.d/master [root@icinga2-master1.localdomain /etc/icinga2/zones.d/master]# vim hosts.conf @@ -1212,7 +1204,7 @@ Add the two client nodes as host objects. vars.client_endpoint = host.name //follows the convention host name == endpoint name } -Add services using command endpoint checks. +Add services using command endpoint checks: [root@icinga2-master1.localdomain /etc/icinga2/zones.d/master]# vim services.conf @@ -1233,48 +1225,49 @@ Add services using command endpoint checks. Validate the configuration and restart Icinga 2 on the master node `icinga2-master1.localdomain`. -Open Icinga Web 2 and check the 2 newly created clients hosts with two new services +Open Icinga Web 2 and check the two newly created client hosts with two new services -- one executed locally (`ping4`) and one using command endpoint (`disk`). -In addition to that you should add [health checks](6-distributed-monitoring.md#distributed-monitoring-health-checks) -ensuring that your cluster notifies you in case of failure. +> **Tip** +> It's a good idea to add [health checks](6-distributed-monitoring.md#distributed-monitoring-health-checks) +> to make sure that your cluster notifies you in case of failure. -### Three Levels with Master, Satellites and Clients +### Three Levels with Master, Satellites, and Clients ![Icinga 2 Distributed Master and Satellites with Clients](images/distributed-monitoring/icinga2_distributed_scenarios_master_satellite_client.png) -This scenario combines everything you've learned so far. High-availability masters, -satellites receiving their config from the master zone, clients checked via command +This scenario combines everything you've learned so far: High-availability masters, +satellites receiving their config from the master zone, and clients checked via command endpoint from the satellite zones. > **Tip** > -> It can get complicated so take pen and paper and bring your thoughts to life. -> Play around with a test setup before putting such a thing into production too! +> It can get complicated, so grab a pen and paper and bring your thoughts to life. +> Play around with a test setup before using it in a production environment! Overview: -* `icinga2-master1.localdomain` is the config master master node -* `icinga2-master2.localdomain` is the secondary master master node without config in `zones.d` -* `icinga2-satellite1.localdomain` and `icinga2-satellite2.localdomain` are satellite nodes in a `master` child zone -* `icinga2-client1.localdomain` and `icinga2-client2.localdomain` are two child nodes as clients +* `icinga2-master1.localdomain` is the config master master node. +* `icinga2-master2.localdomain` is the secondary master master node without configuration in `zones.d`. +* `icinga2-satellite1.localdomain` and `icinga2-satellite2.localdomain` are satellite nodes in a `master` child zone. +* `icinga2-client1.localdomain` and `icinga2-client2.localdomain` are two child nodes as clients. Setup requirements: -* Install `icinga2-master1.localdomain` as [master setup](6-distributed-monitoring.md#distributed-monitoring-setup-master) -* Install `icinga2-master2.localdomain`, `icinga2-satellite1.localdomain` and `icinga2-satellite2.localdomain` as [client setup](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client) (we will modify the generated configuration) -* Install `icinga2-client1.localdomain` and `icinga2-client2.localdomain` as [client setup](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client) +* Set up `icinga2-master1.localdomain` as [master](6-distributed-monitoring.md#distributed-monitoring-setup-master). +* Set up `icinga2-master2.localdomain`, `icinga2-satellite1.localdomain` and `icinga2-satellite2.localdomain` as [clients](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client) (we will modify the generated configuration). +* Set up `icinga2-client1.localdomain` and `icinga2-client2.localdomain` as [clients](6-distributed-monitoring.md#distributed-monitoring-setup-satellite-client). -Once you are asked for the master endpoint providing CSR auto-signing capabilities -please add the master node which holds the CA and has the ApiListener feature configured. +When being asked for the master endpoint providing CSR auto-signing capabilities, +please add the master node which holds the CA and has the `ApiListener` feature configured and enabled. The parent endpoint must still remain the satellite endpoint name. Example for `icinga2-client1.localdomain`: Please specify the master endpoint(s) this node should connect to: -"master" is the first satellite `icinga2-satellite1.localdomain`. +Master is the first satellite `icinga2-satellite1.localdomain`: Master Common Name (CN from your master setup): icinga2-satellite1.localdomain Do you want to establish a connection to the master from this node? [Y/n]: y @@ -1282,7 +1275,7 @@ Example for `icinga2-client1.localdomain`: Master endpoint host (Your master's IP address or FQDN): 192.168.56.105 Master endpoint port [5665]: -Add more "masters", the second satellite `icinga2-satellite2.localdomain`. +Add the second satellite `icinga2-satellite2.localdomain` as master: Add more master endpoints? [y/N]: y Master Common Name (CN from your master setup): icinga2-satellite2.localdomain @@ -1292,7 +1285,7 @@ Add more "masters", the second satellite `icinga2-satellite2.localdomain`. Master endpoint port [5665]: Add more master endpoints? [y/N]: n -Specify the master node `icinga2-master2.localdomain`with the CA private key and ticket salt configured. +Specify the master node `icinga2-master2.localdomain`with the CA private key and ticket salt: Please specify the master connection for CSR auto-signing (defaults to master endpoint host): Host [192.168.56.106]: icinga2-master1.localdomain @@ -1300,9 +1293,9 @@ Specify the master node `icinga2-master2.localdomain`with the CA private key and In case you cannot connect to the master node from your clients, you'll manually need to [generate the SSL certificates](6-distributed-monitoring.md#distributed-monitoring-advanced-hints-certificates) -and modify the configuration. +and modify the configuration accordingly. -We'll discuss the required configuration in detail below. +We'll discuss the details of the required configuration below. The zone hierarchy can look like this. We'll define only the directly connected zones here. @@ -1341,10 +1334,11 @@ using the `host` attribute. global = true } -Note: The master nodes do not need to know about the indirectly connected clients -for connection reasons. But since we want to use command endpoint check configuration, -we'll need them. In order to maximize the effort, we'll sync the client zone and endpoint -config to the satellites where the connection information is needed as well. +> **Note** +> The master nodes do not need to know about the indirectly connected clients. +> But since we want to use command endpoint check configuration, +> we'll need them. In order to maximize the effort, we'll sync the client zone and +> endpoint config to the satellites where the connection information is needed as well. [root@icinga2-master1.localdomain /]# mkdir -p /etc/icinga2/zones.d/{master,satellite,global-templates} [root@icinga2-master1.localdomain /]# cd /etc/icinga2/zones.d/satellite @@ -1369,11 +1363,11 @@ config to the satellites where the connection information is needed as well. endpoints = [ "icinga2-client2.localdomain" ] } -The two client nodes themselves do not necessarily need to know about each other. The only important thing -is that they know about the parent zone and their endpoint members and optional the global zone. +The two client nodes do not necessarily need to know about each other, either. The only important thing +is that they know about the parent zone and their endpoint members (and optionally the global zone). If you specify the `host` attribute in the `icinga2-master1.localdomain` and `icinga2-master2.localdomain` -endpoint objects the client will actively try to connect to the master node. Since we've specified the client +endpoint objects, the client will actively try to connect to the master node. Since we've specified the client endpoint's attribute on the master node already, we don't want the clients to connect to the master nodes. Choose one connection direction. @@ -1431,10 +1425,11 @@ master nodes. Choose one connection direction. Now it is time to define the two client hosts on the master, sync them to the satellites and apply service checks using the command endpoint execution method to them. +Add the two client nodes as host objects to the `satellite` zone. -Add the two client nodes as host objects into the `satellite` zone. -**Note**: We've previously created the directories in `zones.d` and files for the -zone and endpoint configuration for the clients already. +> **Note** +> We've already created the directories in `zones.d`, the files for the +> zone and endpoint configuration for the clients. [root@icinga2-master1.localdomain /]# cd /etc/icinga2/zones.d/satellite [root@icinga2-master1.localdomain /etc/icinga2/zones.d/satellite]# vim icinga2-client1.localdomain.conf @@ -1474,44 +1469,53 @@ Add services using command endpoint checks. Pin the apply rules to the `satellit Validate the configuration and restart Icinga 2 on the master node `icinga2-master1.localdomain`. -Open Icinga Web 2 and check the 2 newly created clients hosts with two new services +Open Icinga Web 2 and check the two newly created client hosts with two new services -- one executed locally (`ping4`) and one using command endpoint (`disk`). -In addition to that you should add [health checks](6-distributed-monitoring.md#distributed-monitoring-health-checks) -ensuring that your cluster notifies you in case of failure. - +> **Tip** +> It's a good idea to add [health checks](6-distributed-monitoring.md#distributed-monitoring-health-checks) +> to make sure that your cluster notifies you in case of failure. ## Best Practice -A collection of best practices we've learned from the community. - -Join the [community channels](https://www.icinga.org/community/get-help/) -and share your tips and tricks with us! +We've put together a collection of configuration examples from the community. +If you like to share your tips and tricks with us, please join the [community channels](https://www.icinga.org/community/get-help/)! ### Global Zone for Config Sync -The idea behind a global zone is not to add endpoints to it. That would -not work with the implemented cluster hierarchy. +Global zones can be used to sync generic configuration objects +to all nodes depending on them. Common examples are: -It was rather designed with the problem in mind - the configuration synced -to each node must be valid. What if my templates and check commands are -only available on the master node? +* Templates which are imported into zone specific objects +* Command objects referenced by Host, Service, Notification objects +* Apply rules for services, notifications, dependencies and scheduled downtimes +* User objects referenced in notifications +* Group objects +* TimePeriod objects -Therefore it is possible to use the config sync mode with a global zone. +Plugin scripts and binaries cannot be synced, this is for Icinga 2 +configuration files only. Use your preferred package repository +and/or configuration management tool (Puppet, Ansible, Chef, etc.) +for that. + +> **Note** +> +> Checkable objects (hosts and services) cannot be put into a global +> zone. The configuration validation will terminate with an error. The zone object configuration must be deployed on all nodes which should receive -the global configuration files. +the global configuration files: object Zone "global-templates" { global = true } Similar to the zone configuration sync you'll need to create a new directory in -`/etc/icinga2/zones.d` +`/etc/icinga2/zones.d`: [root@icinga2-master1.localdomain /]# mkdir -p /etc/icinga2/zones.d/global-templates -Then add a new check command for example. +Next, add a new check command, for example: [root@icinga2-master1.localdomain /]# vim /etc/icinga2/zones.d/global-templates/commands.conf @@ -1525,20 +1529,27 @@ Restart the client(s) which should receive the global zone first. Then validate the configuration on the master node and restart Icinga 2. -**Note**: Host/Service objects must not be put into a global zone. The configuration -validation will throw an error. +> **Tip** +> +> You can copy the example configuration files located in `/etc/icinga2/conf.d` +> into your global zone. + +Example: + + [root@icinga2-master1.localdomain /]# cd /etc/icinga2/conf.d + [root@icinga2-master1.localdomain /etc/icinga2/conf.d]# cp {commands,downtimes,groups,notifications,templates,timeperiods,users}.conf /etc/icinga2/zones.d/global-templates ### Health Checks -In case of network failures or any other problem your monitoring could +In case of network failures or other problems, your monitoring might either have late check results or just send out mass alarms for unknown checks. -In order to minimize the problems caused by this you should configure +In order to minimize the problems caused by this, you should configure additional health checks. -The `cluster` check will check if all endpoints in the current zone and the directly -connected zones are working properly. +The `cluster` check, for example, will check if all endpoints in the current zone and the directly +connected zones are working properly: object Service "cluster" { check_command = "cluster" @@ -1549,7 +1560,7 @@ connected zones are working properly. } The `cluster-zone` check will test whether the configured target zone is currently -connected or not. +connected or not: apply Service "child-health" { check_command = "cluster-zone" @@ -1560,8 +1571,8 @@ connected or not. assign where host.vars.has_client } -In case you cannot assign the `cluster_zone` attribute that generic add specific -checks to your cluster. +In case you cannot assign the `cluster_zone` attribute, add specific +checks to your cluster: object Service "cluster-zone-satellite" { check_command = "cluster-zone" @@ -1573,8 +1584,8 @@ checks to your cluster. } -In case you are using top down checks with command endpoint configuration you can -for example add a dependency which prevents notifications for all other failing services: +If you are using top down checks with command endpoint configuration, you can +add a dependency which prevents notifications for all other failing services: apply Dependency "health-check" to Service { parent_service_name = "child-health" @@ -1588,10 +1599,10 @@ for example add a dependency which prevents notifications for all other failing ### Windows Client and Plugins -The Icinga 2 package on Windows already provides several plugins. There is -a detailed documentation for all available check command definitions over [here](10-icinga-template-library.md#windows-plugins). +The Icinga 2 package on Windows already provides several plugins. +Detailed [documentation](10-icinga-template-library.md#windows-plugins) is available for all check command definitions. -Add the following inclusion on all your nodes (master, satellite, client): +Add the following `include` statement on all your nodes (master, satellite, client): vim /etc/icinga2/icinga2.conf @@ -1600,7 +1611,7 @@ Add the following inclusion on all your nodes (master, satellite, client): Based on the [master with clients](6-distributed-monitoring.md#distributed-monitoring-master-clients) scenario we'll now add a local disk check. -Add the client node as host object. +First, add the client node as host object: [root@icinga2-master1.localdomain /]# cd /etc/icinga2/zones.d/master [root@icinga2-master1.localdomain /etc/icinga2/zones.d/master]# vim hosts.conf @@ -1612,8 +1623,8 @@ Add the client node as host object. vars.os_type = "windows" } -Add the disk check using command endpoint checks (details in the -[disk-windows](10-icinga-template-library.md#windows-plugins-disk-windows) documentation). +Next, add the disk check using command endpoint checks (details in the +[disk-windows](10-icinga-template-library.md#windows-plugins-disk-windows) documentation): [root@icinga2-master1.localdomain /etc/icinga2/zones.d/master]# vim services.conf @@ -1633,12 +1644,12 @@ Add the disk check using command endpoint checks (details in the The [Windows setup](6-distributed-monitoring.md#distributed-monitoring-setup-client-windows) already allows you to install the NSClient++ package. In addition to the Windows plugins you can -also use the [nscp-local commands](10-icinga-template-library.md#nscp-plugin-check-commands) +use the [nscp-local commands](10-icinga-template-library.md#nscp-plugin-check-commands) provided by the Icinga Template Library (ITL). ![Icinga 2 Distributed Monitoring Windows Client with NSClient++](images/distributed-monitoring/icinga2_distributed_windows_nscp.png) -Add the following inclusion on all your nodes (master, satellite, client): +Add the following `include` statement on all your nodes (master, satellite, client): vim /etc/icinga2/icinga2.conf @@ -1650,7 +1661,7 @@ to the `nscp.exe` binary. Based on the [master with clients](6-distributed-monitoring.md#distributed-monitoring-master-clients) scenario we'll now add a local nscp check querying a given performance counter. -Add the client node as host object. +First, add the client node as host object: [root@icinga2-master1.localdomain /]# cd /etc/icinga2/zones.d/master [root@icinga2-master1.localdomain /etc/icinga2/zones.d/master]# vim hosts.conf @@ -1661,8 +1672,8 @@ Add the client node as host object. vars.client_endpoint = host.name //follows the convention host name == endpoint name } -Add performance counter check using command endpoint checks (details in the -[nscp-local-counter](10-icinga-template-library.md#nscp-check-local-counter) documentation). +Next, add a performance counter check using command endpoint checks (details in the +[nscp-local-counter](10-icinga-template-library.md#nscp-check-local-counter) documentation): [root@icinga2-master1.localdomain /etc/icinga2/zones.d/master]# vim services.conf @@ -1686,18 +1697,17 @@ Add performance counter check using command endpoint checks (details in the You can find additional hints in this section if you prefer to go your own route with automating setups (setup, certificates, configuration). -### High Availability for Icinga 2 features +### High-Availability for Icinga 2 Features -All nodes in the same zone require the same features enabled for High Availability (HA) -amongst them. +All nodes in the same zone require that you enable the same features for high-availability (HA). -By default the following features provide advanced HA functionality: +By default, the following features provide advanced HA functionality: * [Checks](6-distributed-monitoring.md#distributed-monitoring-high-availability-checks) (load balanced, automated failover) * [Notifications](6-distributed-monitoring.md#distributed-monitoring-high-availability-notifications) (load balanced, automated failover) * [DB IDO](6-distributed-monitoring.md#distributed-monitoring-high-availability-db-ido) (Run-Once, automated failover) -#### High Availability with Checks +#### High-Availability with Checks All instances within the same zone (e.g. the `master` zone as HA cluster) must have the `checker` feature enabled. @@ -1706,10 +1716,10 @@ Example: # icinga2 feature enable checker -All nodes in the same zone load-balance the check execution. When one instance shuts down +All nodes in the same zone load-balance the check execution. If one instance shuts down, the other nodes will automatically take over the remaining checks. -#### High Availability with Notifications +#### High-Availability with Notifications All instances within the same zone (e.g. the `master` zone as HA cluster) must have the `notification` feature enabled. @@ -1718,13 +1728,13 @@ Example: # icinga2 feature enable notification -Notifications are load balanced amongst all nodes in a zone. By default this functionality +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 +If your nodes should send out notifications independently from any other nodes (this will cause duplicated notifications if not properly handled!), you can set `enable_ha = false` in the [NotificationComponent](9-object-types.md#objecttype-notificationcomponent) feature. -#### High Availability with DB IDO +#### 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. @@ -1752,7 +1762,7 @@ 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: +by running the following query command: icinga=> SELECT status_update_time, endpoint_name FROM icinga_programstatus; status_update_time | endpoint_name @@ -1764,14 +1774,86 @@ This is useful when the cluster connection between endpoints breaks, and prevent data duplication in split-brain-scenarios. The failover timeout can be set for the `failover_timeout` attribute, but not lower than 60 seconds. +### Disable Log Duration for Command Endpoints -### Silent Windows Setup +TODO + +### Endpoint Connection Direction + +TODO + +### Automation + +These hints should get you started with your own automation tools (Puppet, Ansible, Chef, Salt, etc.) +or custom scripts for automated setup. + +#### Silent Windows Setup If you want to install the client silently/unattended, use the `/qn` modifier. The -installation should not trigger a restart but if you want to be completly sure you can use the `/norestart` modifier. +installation should not trigger a restart, but if you want to be completly sure, you can use the `/norestart` modifier. C:> msiexec /i C:\Icinga2-v2.5.0-x86.msi /qn /norestart +#### Node Setup CLI Command + +Instead of using the `node wizard` CLI command, there is an alternative `node setup` +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). + +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. + * Optional: Master endpoint host and port information for the `--endpoint` parameter. +* The client [ticket number](6-distributed-monitoring.md#distributed-monitoring-setup-csr-auto-signing) + +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 + +In case the client connects to the master node, you'll +need to modify the `--endpoint` parameter using the format `cn,host,port`: + + --endpoint icinga2-node1.localdomain,192.168.56.101,5665 + +Restart Icinga 2 afterwards: + + # service icinga2 restart + + ### Manual Certificate Creation Choose the host which should store the certificate authority (one of the master nodes). @@ -1781,21 +1863,21 @@ as root user: icinga2 pki new-ca -Create a certificate signing request (CSR) for each node. +Create a certificate signing request (CSR) for each node: icinga2 pki new-cert --cn icinga2-master1.localdomain --key icinga2-master1.localdomain.key --csr icinga2-master1.localdomain.csr -Sign the CSR with the previously created CA. +Sign the CSR with the previously created CA: icinga2 pki sign-csr --csr icinga2-master1.localdomain.csr --cert icinga2-master1.localdomain -Copy the host's certificate files and the public CA certificate to `/etc/icinga2/pki`. +Copy the host's certificate files and the public CA certificate to `/etc/icinga2/pki`: mkdir -p /etc/icinga2/pki cp icinga2-master1.localdomain.{crt,key} /etc/icinga2/pki cp /var/lib/icinga2/ca/ca.crt /etc/icinga2/pki -Ensure that proper permissions are set (replace `icinga` with the Icinga 2 daemon user). +Ensure that proper permissions are set (replace `icinga` with the Icinga 2 daemon user): chown -R icinga:icinga /etc/icinga2/pki chmod 600 /etc/icinga2/pki/*.key @@ -1819,62 +1901,4 @@ Example for creating multiple certificates at once: information/pki: Writing certificate to file 'icinga2-master2.localdomain.crt'. information/pki: Writing certificate to file 'icinga2-satellite1.localdomain.crt'. -### Node Setup Cli Command - -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). - -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. - * Optional: Master endpoint host and port information for the `--endpoint` parameter. -* The client [ticket number](6-distributed-monitoring.md#distributed-monitoring-setup-csr-auto-signing) - -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 - -In case the client should connect to the master node, you'll -need to modify the `--endpoint` parameter using the format `cn,host,port`. - - --endpoint icinga2-node1.localdomain,192.168.56.101,5665 - -Restart Icinga 2 once complete. - - # service icinga2 restart