Benutzer-Werkzeuge

Webseiten-Werkzeuge


tachtler:icinga2_-_client_-_grundkonfiguration

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.

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 nachfolgenden Befehlen, von jeder Konfigurationsdatei in den Verzeichnissen

  • /etc/icinga2
  • /etc/icinga2/conf.d

eine Kopie der originalen Konfigurationsdateien, welche alle mit .conf enden, angefertigt werden:

# for i in `ls /etc/icinga2/*.conf`; do cp -a $i $i.orig; done

und

# for i in `ls /etc/icinga2/conf.d/*.conf`; do cp -a $i $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 command compatlog debuglog gelf graphite icingastatus livestatus opentsdb perfdata 
statusdata syslog
Enabled features: checker 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.

Konfiguration: Client für Remote Monitoring

Nachfolgend soll Icinga mit der Benutzung des Icinga-Clients zum Monitoring eingesetzt werden.

Das Client Setup benötigt nachfolgende Komponenten

  • Ein lauffähigen Master
  • Ein signiertes Zertifikate zur Kommunikation mit dem Master
  • Aktiviertes API Feature (Möglichkeit), und einen lokalen „Endpoint“ und eine „Zone“-Objekt-Konfiguration

und zusätzliche nachfolgende

  • Firewall-Freischaltung für den Kommunikations-Port (standardmäßig ist dies der Port: 5665)

Um die vorhergehende Komponenten zu erstellen, kann nachfolgen der CLI command wizard (CLI Kommando Assistent) genutzt werden, um einen neuen Node (Knoten) auf dem Client zu erstellen.

:!: HINWEIS - Alle relevanten Icinga-Konfigurationsdateien werden automatisch angepasst!

Dazu muss als erster Schritt, ein Client Setup durchgeführt werden, was mit nachfolgendem Befehl realisiert werden kann:

:!: WICHTIG - Für ein Client Setup muss die erste Frage mit yes (Ja) beantwortet werden!

:!: WICHTIG - Ein Bind Host und Bind Port ist nur erforderlich, wenn Icinga sich nur an eine bestimmtes Netzwerk-Interface binden soll!

# icinga2 node wizard
Welcome to the Icinga 2 Setup Wizard!

We'll guide you through all required configuration details.



Please specify if this is a satellite setup ('n' installs a master setup) [Y/n]: Y
Starting the Node setup routine...
Please specifiy the common name (CN) [server10.idmz.tachtler.net]: 
Please specifiy the local zone name [server10.idmz.tachtler.net]: 
Please specify the master endpoint(s) this node should connect to:
Master Common Name (CN from your master setup): server11.idmz.tachtler.net
Do you want to establish a connection to the master from this node? [Y/n]: Y
Please fill out the master connection information:
Master endpoint host (Your master's IP address or FQDN): 192.168.0.110
Master endpoint port [5665]: 5665
Add more master endpoints? [y/N]: N
Please specify the master connection for CSR auto-signing (defaults to master endpoint host):
Host [192.168.0.110]: 
Port [5665]: 
information/base: Writing private key to '/etc/icinga2/pki/server10.idmz.tachtler.net.key'.
information/base: Writing X509 certificate to '/etc/icinga2/pki/server10.idmz.tachtler.net.crt'.
information/cli: Fetching public certificate from master (192.168.0.110, 5665):

Certificate information:

 Subject:     CN = server11.idmz.tachtler.net
 Issuer:      CN = Icinga CA
 Valid From:  Dec  1 13:00:07 2015 GMT
 Valid Until: Nov 27 13:00:07 2030 GMT
 Fingerprint: 0B 45 BC FA 21 65 46 1C 33 14 41 39 BC 28 7D A6 49 CB C8 AB 

Is this information correct? [y/N]: y
information/cli: Received trusted master certificate.

Please specify the request ticket generated on your Icinga 2 master.
 (Hint: # icinga2 pki ticket --cn 'server10.idmz.tachtler.net'): 2da7564a4b2314baf57452fc283abdc43dca012a
information/cli: Requesting certificate with ticket '2da7564a4b2314baf57452fc283abdc43dca012a'.

information/cli: Created backup file '/etc/icinga2/pki/server10.idmz.tachtler.net.crt.orig'.
information/cli: Writing signed certificate to file '/etc/icinga2/pki/server10.idmz.tachtler.net.crt'.
information/cli: Writing CA certificate to file '/etc/icinga2/pki/ca.crt'.
Please specify the API bind host/port (optional):
Bind Host []: 192.168.0.10
Bind Port []: 5665
Accept config from master? [y/N]: N
Accept commands from master? [y/N]: y
information/cli: Disabling the Notification feature.
Disabling feature notification. Make sure to restart Icinga 2 for these changes to take effect.
information/cli: Enabling the Apilistener feature.
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.
information/cli: Created backup file '/etc/icinga2/features-available/api.conf.orig'.
information/cli: Generating local zones.conf.
information/cli: Dumping config items to file '/etc/icinga2/zones.conf'.
warning/cli: Backup file '/etc/icinga2/zones.conf.orig' already exists. Skipping backup.
information/cli: Updating constants.conf.
warning/cli: Backup file '/etc/icinga2/constants.conf.orig' already exists. Skipping backup.
information/cli: Updating constants file '/etc/icinga2/constants.conf'.
information/cli: Updating constants file '/etc/icinga2/constants.conf'.
Done.

Now restart your Icinga 2 daemon to finish the installation!

Nachfolgende Dateien wurden für die CA (Certificate Authority) neu erstellt:

  • /var/lib/icinga2/ca/ca.crt - Root-Zertifikat der CA

Nachfolgende Dateien wurden für das Master-Zertifikat neu erstellt:

  • /etc/icinga2/pki/server10.idmz.tachtler.net.key - Schlüssel des Zertifikats
  • /etc/icinga2/pki/server10.idmz.tachtler.net.csr - Zertifikat

Nachfolgende Konfigurationsdatei wurden neu erstellt oder angepasst:

  • /etc/icinga2/zones.conf
  • /etc/icinga2/features-available/api.conf
  • /etc/icinga2/features-enabled/api.conf
  • /etc/icinga2/constants.conf

Nachfolgender Befehl zeigt an, das das Feature (Möglichkeit) - api - aktuell in Icinga-Client zusätzlich aktiviert ist:

# icinga2 feature list
Disabled features: command compatlog debuglog gelf graphite icingastatus livestatus notification opentsdb 
perfdata statusdata syslog
Enabled features: api checker mainlog

:!: HINWEIS - Da in der icinga2 feature list kein command beim Icinga-Client auftaucht, können alle Konfigurationen im Verzeichnis /etc/icinga2/conf.d/ auskommentiert werden!

:!: WICHTIG - Ausnahme hiervon ist nur die Konfigurationsdatei

  • /etc/icinga2/conf.d/commands.conf

da hier „Checks“ definiert werden können, welche nicht im Standard von Icinga enthalten sind und deshalb zusätzliche Module unter

  • /usr/lib64/nagios/plugins

hinzugefügt werden können!

Siehe hierzu auch nachfolgenden internen Link:

Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information
tachtler/icinga2_-_client_-_grundkonfiguration.txt · Zuletzt geändert: 2016/01/15 07:49 von klaus