Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
Icinga2 - Client - Grundkonfiguration
Icinga ist eine vollständig auf Open-Source-Basis basierende, skalierbare und erweiterbare Monitoring-Lösung welche die Verfügbarkeit von definierten Ressource überprüft und über eine Benachrichtigungssystem verfügt.
Beschreibung | Externer Link |
---|---|
Homepage | https://www.icinga.org/ |
Dokumentation | http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc |
Download | http://packages.icinga.org/ |
Ab hier werden zur Ausführung nachfolgender Befehle root
-Rechte benötigt. Um der Benutzer root
zu werden, melden Sie sich bitte als root
-Benutzer am System an, oder wechseln mit nachfolgendem Befehl zum Benutzer root
:
$ su - Password:
Vorbereitungen
Bevor mit der eigentliche Konfiguration von Icinga-Client begonnen werden soll, sollte mit nachfolgendem Befehl, von jeder Konfigurationsdatei im Verzeichnis
/etc/icinga2/conf.d
eine Kopie der originalen Konfigurationsdatei, welche alle mit .conf
enden, angefertigt werden:
# for i in `ls /etc/icinga2/conf.d/*.conf`; do cp -a /etc/icinga2/conf.d/$i /etc/icinga2/conf.d/$i.orig; done
Anschließend können die Konfigurationsdateien dann (ggf. bis auf die Kommentare am Anfang der jeweiligen Konfigurationsdatei) komplett geleert werden, so dass eine neue Konfiguration, ohne irgendeinen Host, Service oder anderer Einstellung, durchgeführt werden kann.
/etc/icinga2/icinga2.conf
Die Konfigurationsdatei
/etc/icinga2/icinga2.conf
ist die Hauptkonfigurationsdatei von Icinga.
Die Konfigurationsdatei hat standardmäßig nachfolgenden Inhalt und muss grundsätzlich nicht angepasst werden!
(Komplette Konfigurationsdatei:)
/** * Icinga 2 configuration file * - this is where you define settings for the Icinga application including * which hosts/services to check. * * For an overview of all available configuration options please refer * to the documentation that is distributed as part of Icinga 2. */ /** * The constants.conf defines global constants. */ include "constants.conf" /** * The zones.conf defines zones for a cluster setup. * Not required for single instance setups. */ include "zones.conf" /** * The Icinga Template Library (ITL) provides a number of useful templates * and command definitions. * Common monitoring plugin command definitions are included separately. */ include <itl> include <plugins> // include <plugins-contrib> /** * The features-available directory contains a number of configuration * files for features which can be enabled and disabled using the * icinga2 feature enable / icinga2 feature disable CLI commands. * These commands work by creating and removing symbolic links in * the features-enabled directory. */ include "features-enabled/*.conf" /** * The repository.d directory contains all configuration objects * managed by the 'icinga2 repository' CLI commands. */ include_recursive "repository.d" /** * Although in theory you could define all your objects in this file * the preferred way is to create separate directories and files in the conf.d * directory. Each of these files must have the file extension ".conf". */ include_recursive "conf.d"
Nachfolgende Inhalt verweisen auf weitere Konfigurationsdateien:
/etc/icinga2/constants.conf
/etc/icinga2/zones.conf
/etc/icinga2/features-enabled/*.conf
Nachfolgende Inhalte verweisen auf weitere rekursiv (auch in Unterverzeichnissen vorhandenen) Konfigurationsdateien:
/etc/icinga2/repository.d/*
/etc/icinga2/conf.d/*.conf
/etc/icinga2/constants.conf
Die Konfigurationsdatei
/etc/icinga2/constants.conf
kann dazu genutzt werden, um globale Konstanten/Variablen zu definieren, welche dann global gelten.
Die Konfigurationsdatei hat standardmäßig nachfolgenden Inhalt und muss grundsätzlich an dieser Stelle nicht angepasst werden!
(Komplette Konfigurationsdatei:)
/** * This file defines global constants which can be used in * the other configuration files. */ /* The directory which contains the plugins from the Monitoring Plugins project. */ const PluginDir = "/usr/lib64/nagios/plugins" /* The directory which contains the Manubulon plugins. * Check the documentation, chapter "SNMP Manubulon Plugin Check Commands", for details. */ const ManubulonPluginDir = "/usr/lib64/nagios/plugins" /* The directory which you use to store additional plugins which ITL provides user contributed command * definitions for. * Check the documentation, chapter "Plugins Contribution", for details. */ const PluginContribDir = "/usr/lib64/nagios/plugins" /* Our local instance name. By default this is the server's hostname as returned by `hostname --fqdn`. * This should be the common name from the API certificate. */ //const NodeName = "localhost" /* Our local zone name. */ const ZoneName = NodeName /* Secret key for remote node tickets */ const TicketSalt = ""
/etc/icinga2/zones.conf
Die Konfigurationsdatei
/etc/icinga2/zones.conf
wird in einem „Monitoring Remote Setup“ eingesetzt um z.B. beim Einsatz eines Icinga-Clients verschiedene notwendige Definitionen zu beinhalten („Endpoint“ und „Zone“ Definitionen).
Die Konfigurationsdatei hat standardmäßig nachfolgenden Inhalt und muss grundsätzlich an dieser Stelle nicht angepasst werden!
(Komplette Konfigurationsdatei:)
/* * Endpoint and Zone configuration for a cluster setup * This local example requires `NodeName` defined in * constants.conf. */ object Endpoint NodeName { host = NodeName } object Zone ZoneName { endpoints = [ NodeName ] } /* * Defines a global zone containing templates, * etc. synced to all nodes, if they accept * configuration. All remote nodes need * this zone configured too. */ /* object Zone "global-templates" { global = true } */ /* * Read the documentation on how to configure * a cluster setup with multiple zones. */ /* object Endpoint "master.example.org" { host = "master.example.org" } object Endpoint "satellite.example.org" { host = "satellite.example.org" } object Zone "master" { endpoints = [ "master.example.org" ] } object Zone "satellite" { parent = "master" endpoints = [ "satellite.example.org" ] } */
/etc/icinga2/features-enabled/*.conf
Die Konfigurationsdatei(en)
/etc/icinga2/features-enabled/*.conf
geben an, welche Features (Möglichkeiten) aktuell in Icinga aktiviert sind.
Die Konfigurationsdatei sind links auf Features (Möglichkeiten) in Icinga, die sich im Verzeichnis
/etc/icinga2/features-available/*.conf
befinden.
(Komplette Liste an Konfigurationsdatei(en):)
# ll features-enabled/ total 0 lrwxrwxrwx 1 root root 34 Nov 17 11:04 checker.conf -> ../features-available/checker.conf lrwxrwxrwx 1 root root 34 Nov 17 17:47 command.conf -> ../features-available/command.conf lrwxrwxrwx 1 root root 36 Nov 17 13:38 ido-mysql.conf -> ../features-available/ido-mysql.conf lrwxrwxrwx 1 root root 34 Nov 17 11:04 mainlog.conf -> ../features-available/mainlog.conf lrwxrwxrwx 1 root root 39 Nov 17 11:04 notification.conf -> ../features-available/notification.conf
Nachfolgender Befehl zeigt ebenfalls, welche Features (Möglichkeiten) aktuell in Icinga aktiviert sind:
# icinga2 feature list Disabled features: api compatlog debuglog gelf graphite icingastatus livestatus opentsdb perfdata statusdata syslog Enabled features: checker command ido-mysql mainlog notification
/etc/icinga2/repository.d/*
Die Konfigurationsdatei(en)
/etc/icinga2/repository.d/*
wird in einem „Monitoring Remote Setup“ eingesetzt um Konfigurationen zu generieren, welche auf dem „Master“ hinterlegte „Services“ für den Icinga-Client zu verwalten.
Standardmäßig sind hier keine Konfigurationen definiert, was ggf., je nach Setup, zu einem späteren Zeitpunkt durchgeführt wird.
/etc/icinga2/conf.d/*.conf
Nachfolgende Konfigurationsdateien sind sozusagen das Herz von Icinga.
Um auf einer „grünen Wiese“, ohne jeglicher Konfiguration beginnen zu können, sollte nachfolgende Konfiguration, wie unter nachfolgendem internen Link beschrieben
bereits durchgeführt worden sein.