Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| centos:web_c7:icinga:config_1 [09.04.2015 19:20. ] – [Master Node] django | centos:web_c7:icinga:config_1 [20.04.2018 10:36. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
|---|---|---|---|
| Zeile 6: | Zeile 6: | ||
| Bei der Anbindung und Überwachung von Remote-Clients stehen uns folgende Varianten zur Verfügung: | Bei der Anbindung und Überwachung von Remote-Clients stehen uns folgende Varianten zur Verfügung: | ||
| - | - **Bridging**: | + | - **[[centos: |
| - | - **Slave zu Master**: \\ Hier sind alle Services und Checks lokal auf den jeweiligen Hosts konfiguriert. Die Clients senden bei dieser Ankoppelungsvariante die Daten zum Master-Node, | + | - **[[centos: |
| - | - **Master zu Slaves**: \\ Hier werden alle Konfigurationen auf dem Monitoring-Host (Icinga 2 Master) definiert und zu den betreffenden Clients übertragen. Man nennt diese Variante auch //**Cluster Configuration Synchroinistion**// | + | - **[[centos: |
| + | - **[[centos: | ||
| + | - **[[centos: | ||
| + | - **[[centos: | ||
| - | ===== Konfiguration ===== | + | ===== Konfiguration |
| ==== Paketfilter/ | ==== Paketfilter/ | ||
| Bei den beiden Varianten **Slave zu Master** sowie **Master zu Slaves** erfolgt die Kommunikation über TCP/Port **5665**. Die Kommunikation kann dabei sowohl vom Client/ | Bei den beiden Varianten **Slave zu Master** sowie **Master zu Slaves** erfolgt die Kommunikation über TCP/Port **5665**. Die Kommunikation kann dabei sowohl vom Client/ | ||
| Zeile 62: | Zeile 65: | ||
| * Definition und Sichern des **NodeName**s und des **TicketSalt**s in der Konfigurationsdatei **/ | * Definition und Sichern des **NodeName**s und des **TicketSalt**s in der Konfigurationsdatei **/ | ||
| - | Da wir swn Master-Node einrichten wollen, beantworten wir die erste Frage mit einem **n**! | + | Da wir den Master-Node einrichten wollen, beantworten wir die erste Frage mit einem **n**! |
| # icinga2 node wizard | # icinga2 node wizard | ||
| Zeile 175: | Zeile 178: | ||
| | | ||
| + | |||
| + | ==== Client Node ==== | ||
| + | Nach der Konfiguration unseres Icinga 2 Master Nodes werden wir in diesem Abschnitt mit der Konfiguration der **Icinga 2 Client-Nodes** befassen. | ||
| + | |||
| + | Die Konfiguration des Clients selbst mit seinen Checks nehmen wir wie gewohnt vor. Was wir auf den Clients nicht installieren und konfigurieren brauchen, sind Funktionen wie z.B. **DB IDO** oder **Livestatus**. | ||
| + | # yum install icinga2 icinga2-bin icinga2-common -y | ||
| + | |||
| + | Sofern die zu überwachenden Clients den Icinga-Master-Node direkt erreichen, können wir das **CSR auto-signing** Feature nutzen und den Icinga2-CLI-Befehl **node wizard** benutzen. Damit werden folgende relevanten Konfigurationsoptionen im Bezug auf die **Client**-Konfiguration und der **X.509**-Zertifikate abgehandelt: | ||
| + | * Generierung eines self-signed Zertifikats und Speichern des Zertifikats im Verzeichnis // | ||
| + | * Herunterladen des Zertifikats vom Icinga2-Master-Node und speichern als [[centos: | ||
| + | * Beziehen eines von der CA des Icinga2-Master-Node signierten Zertifikats und Speichern des Zertifikats im Verzeichnis // | ||
| + | * Erstellen der Konfiguration für die lokale Zone und Endpunkt für den lokalen Client, | ||
| + | * Erstellen der Icinga2-Master Daten basierend auf dem FQDN des Clients, | ||
| + | * Deaktivieren des Benachrichtigujngsfunktionalitäten des lokalen Clients, | ||
| + | * Aktivieren der Icinga2 CLI API Funktion des lokalen Clients, | ||
| + | * optionales Festlegen der Host-IP und des Ports an dem der Client gebunden werden soll und | ||
| + | * Setzen des **NodeName**s in der Konfigurationsdatei // | ||
| + | |||
| + | Da wir einen Client-Node einrichten wollen, beantworten wir die erste Frage mit einem **Y**, bzw. Bestätigen wir die erste Frage mit einem Druck auf die **Return-Taste**! | ||
| + | # icinga2 node wizard | ||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | |||
| + | We'll guide you through all required configuration details. | ||
| + | |||
| + | |||
| + | |||
| + | </ | ||
| + | Starting the Master setup routine... | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | Master Common Name </ | ||
| + | < | ||
| + | Master endpoint host </ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | |||
| + | <font style=" | ||
| + | <font style=" | ||
| + | |||
| + | < | ||
| + | | ||
| + | <font style=" | ||
| + | |||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <font style=" | ||
| + | Disabling feature <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | |||
| + | Now restart your Icinga 2 daemon to finish the installation! | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Ob der **NodeName** des Client richtig gesetzt wurde können wir mit Hilfe des folgenden Befehls überprüfen. | ||
| + | |||
| + | # egrep ' | ||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | </ | ||
| + | |||
| + | Die definierten Parameter in der Zonen-Datei können wir mit einem Blick in die Konfigurationsdatei werfen. | ||
| + | # cat / | ||
| + | |||
| + | <file c++ / | ||
| + | * Generated by Icinga 2 node setup commands | ||
| + | * on 2015-03-25 13:04:58 +0100 | ||
| + | */ | ||
| + | |||
| + | object Endpoint " | ||
| + | host = " | ||
| + | } | ||
| + | |||
| + | object Zone " | ||
| + | endpoints = [ " | ||
| + | } | ||
| + | |||
| + | object Endpoint " | ||
| + | } | ||
| + | |||
| + | object Zone " | ||
| + | //this is the local node = " | ||
| + | endpoints = [ " | ||
| + | parent = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Sind wir mit der Konfiguration zufrieden, führen wir zur Aktivierung der Client-Konfiguration einen Reload des Icinga2-Daemon durch. | ||
| + | # systemctl reload icinga2 | ||
| + | |||
| + | ===== Client-Konfigurationsmodi ===== | ||
| + | ==== NRPE ==== | ||
| + | |||
| + | ==== SSH ==== | ||
| + | |||
| + | |||
| + | === Server-Konfiguration === | ||
| + | # grep nagios /etc/passwd | ||
| + | |||
| + | | ||
| + | |||
| + | |||
| + | |||
| + | # mkdir -m 700 / | ||
| + | |||
| + | # chown nagios.nagios / | ||
| + | |||
| + | # ssh-keygen -b 4096 -t rsa -f / | ||
| + | < | ||
| + | Enter passphrase (empty for no passphrase): | ||
| + | Enter same passphrase again: | ||
| + | Your identification has been saved in / | ||
| + | Your public key has been saved in / | ||
| + | The key fingerprint is: | ||
| + | ff: | ||
| + | The key's randomart image is: | ||
| + | +--[ RSA 4096]----+ | ||
| + | | O=++ | | ||
| + | | .Eo o .| | ||
| + | | | ||
| + | | . . . .| | ||
| + | | So . . . | | ||
| + | | ... . . | | ||
| + | | .. ....| | ||
| + | | . ...+| | ||
| + | | . ..| | ||
| + | +-----------------+ | ||
| + | </ | ||
| + | |||
| + | # chown nagios.nagios / | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | # yum install nagios-plugins-by_ssh | ||
| + | |||
| + | === Remotehost-Konfiguration === | ||
| + | |||
| + | # grep nagios /etc/passwd | ||
| + | |||
| + | | ||
| + | |||
| + | |||
| + | # mkdir -m 700 / | ||
| + | |||
| + | # chown nagios.nagios / | ||
| + | |||
| + | |||
| + | # ssh -i / | ||
| + | |||
| + | < | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | ############################################################################## | ||
| + | Last login: Tue May 5 20:53:23 2015 from vml000117.dmz.nausch.org | ||
| + | ############################################################################## | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | ############################################################################## | ||
| + | -bash-4.1$ | ||
| + | </ | ||
| + | |||
| + | # / | ||
| + | < | ||
| + | Copyright (c) 1999 Karl DeBisschop < | ||
| + | Copyright (c) 2000-2014 Nagios Plugin Development Team | ||
| + | < | ||
| + | |||
| + | This plugin uses SSH to execute commands on a remote host | ||
| + | |||
| + | Usage: | ||
| + | | ||
| + | [-S [lines]] [-E [lines]] [-t timeout] [-i identity] | ||
| + | [-l user] [-n name] [-s servicelist] [-O outputfile] | ||
| + | [-p port] [-o ssh-option] [-F configfile] | ||
| + | |||
| + | Options: | ||
| + | -h, --help | ||
| + | Print detailed help screen | ||
| + | -V, --version | ||
| + | Print version information | ||
| + | | ||
| + | Read options from an ini file. See | ||
| + | https:// | ||
| + | for usage and examples. | ||
| + | -H, --hostname=ADDRESS | ||
| + | Host name, IP Address, or unix socket (must be an absolute path) | ||
| + | -p, --port=INTEGER | ||
| + | Port number (default: none) | ||
| + | -4, --use-ipv4 | ||
| + | Use IPv4 connection | ||
| + | -6, --use-ipv6 | ||
| + | Use IPv6 connection | ||
| + | -1, --proto1 | ||
| + | tell ssh to use Protocol 1 [optional] | ||
| + | -2, --proto2 | ||
| + | tell ssh to use Protocol 2 [optional] | ||
| + | -S, --skip-stdout[=n] | ||
| + | Ignore all or (if specified) first n lines on STDOUT [optional] | ||
| + | -E, --skip-stderr[=n] | ||
| + | Ignore all or (if specified) first n lines on STDERR [optional] | ||
| + | -f | ||
| + | tells ssh to fork rather than create a tty [optional]. This will always return OK if ssh is executed | ||
| + | -C, --command=' | ||
| + | command to execute on the remote machine | ||
| + | -l, --logname=USERNAME | ||
| + | SSH user name on remote host [optional] | ||
| + | -i, --identity=KEYFILE | ||
| + | identity of an authorized key [optional] | ||
| + | -O, --output=FILE | ||
| + | external command file for nagios [optional] | ||
| + | -s, --services=LIST | ||
| + | list of nagios service names, separated by ':' | ||
| + | -n, --name=NAME | ||
| + | short name of host in nagios configuration [optional] | ||
| + | -o, --ssh-option=OPTION | ||
| + | Call ssh with '-o OPTION' | ||
| + | -F, --configfile | ||
| + | Tell ssh to use this configfile [optional] | ||
| + | -q, --quiet | ||
| + | Tell ssh to suppress warning and diagnostic messages [optional] | ||
| + | -w, --warning=DOUBLE | ||
| + | Response time to result in warning status (seconds) | ||
| + | -c, --critical=DOUBLE | ||
| + | Response time to result in critical status (seconds) | ||
| + | -t, --timeout=INTEGER | ||
| + | Seconds before connection times out (default: 10) | ||
| + | -v, --verbose | ||
| + | Show details for command-line debugging (Nagios may truncate output) | ||
| + | |||
| + | The most common mode of use is to refer to a local identity file with | ||
| + | the ' | ||
| + | | ||
| + | file of the remote host. Usually the key will be restricted to running | ||
| + | only one command on the remote server. If the remote SSH server tracks | ||
| + | | ||
| + | | ||
| + | |||
| + | To use passive mode, provide multiple ' | ||
| + | all of -O, -s, and -n options (servicelist order must match ' | ||
| + | |||
| + | Examples: | ||
| + | $ check_by_ssh -H localhost -n lh -s c1:c2:c3 -C uptime -C uptime -C uptime -O /tmp/foo | ||
| + | $ cat /tmp/foo | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | Send email to help@nagios-plugins.org if you have questions regarding use | ||
| + | of this software. To submit patches or suggest improvements, | ||
| + | devel@nagios-plugins.org | ||
| + | </ | ||
| + | |||
| + | Auf dem Remote-Host: | ||
| + | # / | ||
| + | |||
| + | OK - load average: 0.13, 0.13, 0.09|load1=0.130; | ||
| + | |||
| + | # vim / | ||
| + | < | ||
| + | object CheckCommand " | ||
| + | import " | ||
| + | |||
| + | command = [ PluginDir + "/ | ||
| + | |||
| + | arguments = { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | | ||
| + | } | ||
| + | " | ||
| + | | ||
| + | } | ||
| + | " | ||
| + | | ||
| + | } | ||
| + | " | ||
| + | | ||
| + | } | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | | ||
| + | } | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | | ||
| + | } | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | |||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | # vim / | ||
| + | <file cc+ / | ||
| + | // Django: 2015-05-05 | ||
| + | |||
| + | apply Service for (by_ssh => config in host.vars.by_ssh) { | ||
| + | import " | ||
| + | |||
| + | check_command = " | ||
| + | command_endpoint = host.vars.remote_client | ||
| + | |||
| + | vars += config | ||
| + | |||
| + | assign where host.vars.remote_client | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Bridging ==== | ||
| + | Bei diesem Betriebsmodus werden bis auf die **check command** Definitionen keine Konfigurationsinformationen auf dem Client selbst benötigt und vorgehalten. Der Remote-Client führt lediglich die Befehle aus, die die **Master Node**-Instanz an den **Client Node** überträgt. Damit der Client diese Befehle auch akzeptieren kann, __müssen__ wir dies auch in der Konfigurationsdatei // | ||
| + | # vim / | ||
| + | |||
| + | <file c++ / | ||
| + | * The API listener is used for distributed monitoring setups. | ||
| + | */ | ||
| + | object ApiListener " | ||
| + | cert_path = SysconfDir + "/ | ||
| + | key_path = SysconfDir + "/ | ||
| + | ca_path = SysconfDir + "/ | ||
| + | |||
| + | // | ||
| + | // Django : 205-04-08 | ||
| + | // Befehle des Icinga 2 Master Nodes akzeptieren und ausführen | ||
| + | accept_commands = true | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Da auf dem Client Node keine Kommandos abgespeichert werden, kann dieser auch keine Checks von sich aus ausführen, es besteht auch keine Backup/ | ||
| + | |||
| + | ==== Slave zu Master ==== | ||
| + | |||
| + | ==== Master zu Slaves ==== | ||
| + | |||
| + | |||
| + | |||
| + | ====== Links ====== | ||
| + | * **⇐ [[centos: | ||
| + | * **⇒ [[centos: | ||
| + | * **[[centos: | ||
| + | * **[[wiki: | ||
| + | * **[[http:// | ||