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 [05.05.2015 18:07. ] – [Icinga 2 - Überwachung von Clients/Hosts bzw. Services auf Hosts] django | centos:web_c7:icinga:config_1 [20.04.2018 10:36. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 7: | Zeile 7: | ||
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: | ||
- **[[centos: | - **[[centos: | ||
- | - **[[centos: | + | - **[[centos: |
- | - **SSH**: | + | - **[[centos: |
- | - **Icinga Client** \\ Die zu überwachenden Hosts haben keinerlei lokal vorgehaltene Konfigurationsbestandteile. Der Master-Node (Icinga 2 Monitoring-Host) baut zu den Clients eine Verbindung auf und übermittelt die zu testenden Befehle und nimmt die Rückgabewerte über diese Verbindung auch entgegen. Im Grunde kann man hier von einem automatisierten gescripteten Überwachungsfunktionen via **SSH**((**S**ecure **SH**ell)) sprechen. | + | - **[[centos: |
- **[[centos: | - **[[centos: | ||
- **[[centos: | - **[[centos: | ||
Zeile 294: | Zeile 294: | ||
===== Client-Konfigurationsmodi ===== | ===== 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 ==== | ==== 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 // | 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 // | ||
Zeile 328: | Zeile 572: | ||
* **[[http:// | * **[[http:// | ||
- | ~~DISCUSSION~~ | + |