Benutzer-Werkzeuge

Webseiten-Werkzeuge


tachtler:icinga2_-_grundkonfiguration

Dies ist eine alte Version des Dokuments!


Icinga2 - 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 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 $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 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.

Konfiguration: Master für Remote Clients

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

Das Master Setup benötigt nachfolgende Komponenten

  • SSL CA und signierte Zertifikate für den 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 Master zu erstellen.

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

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

:!: WICHTIG - Für ein Master Setup muss die erste Frage mit no (Nein) 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]: n
Starting the Master setup routine...
Please specifiy the common name (CN) [server11.idmz.tachtler.net]: 
Checking for existing certificates for common name 'server11.idmz.tachtler.net'...
Certificates not yet generated. Running 'api setup' now.
information/cli: Generating new CA.
information/base: Writing private key to '/var/lib/icinga2/ca/ca.key'.
information/base: Writing X509 certificate to '/var/lib/icinga2/ca/ca.crt'.
information/cli: Generating new CSR in '/etc/icinga2/pki/server11.idmz.tachtler.net.csr'.
information/base: Writing private key to '/etc/icinga2/pki/server11.idmz.tachtler.net.key'.
information/base: Writing certificate signing request to '/etc/icinga2/pki/server11.idmz.tachtler.net.csr'.
information/cli: Signing CSR with CA and writing certificate to '/etc/icinga2/pki/server11.idmz.tachtler.net.crt'.
information/cli: Copying CA certificate to '/etc/icinga2/pki/ca.crt'.
Generating master configuration for Icinga 2.
information/cli: Adding new ApiUser 'root' in '/etc/icinga2/conf.d/api-users.conf'.
information/cli: Enabling the 'api' feature.
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.
information/cli: Dumping config items to file '/etc/icinga2/zones.conf'.
warning/cli: Backup file '/etc/icinga2/zones.conf.orig' already exists. Skipping backup.
Please specify the API bind host/port (optional):
Bind Host []: 
Bind Port []: 
information/cli: Created backup file '/etc/icinga2/features-available/api.conf.orig'.
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'.
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.key - Schlüssel der CA
  • /var/lib/icinga2/ca/ca.crt - Root-Zertifikat der CA

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

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

Nachfolgende Konfigurationsdatei wurden neu erstellt oder angepasst:

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

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

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

/etc/icinga2/features-available/api.conf

Die Konfigurationsdatei

  • /etc/icinga2/features-available/api.conf

dient zur Definition, wo sich das

  • Das Zertifikate
  • Der Schlüssel zum Zertifikat
  • Das ROOT-Zertifikat

zur verschlüsselten Kommunikation befinden und welcher „TicketSalt“ verwendet werden soll.

(Komplette Konfigurationsdatei:)

/**
 * The API listener is used for distributed monitoring setups.
 */
 
object ApiListener "api" {
  cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt"
  key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key"
  ca_path = SysconfDir + "/icinga2/pki/ca.crt"
 
  ticket_salt = TicketSalt
}

/etc/icinga2/zones.conf

Die Konfigurationsdatei

  • /etc/icinga2/zones.conf

ist nun nach dem „Monitoring Remote Setup“ konfiguriert um beim Einsatz des Icinga-Clients verschiedene notwendige Definitionen zu beinhalten („Endpoint“ und „Zone“ Definitionen).

Die Konfigurationsdatei hat nun nachfolgenden Inhalt und muss grundsätzlich an dieser Stelle nicht angepasst werden!

(Komplette Konfigurationsdatei:)

/*
 * Generated by Icinga 2 node setup commands
 * on 2015-12-01 14:00:07 +0100
 */
 
object Endpoint NodeName {
}
 
object Zone ZoneName {
        endpoints = [ NodeName ];
}

/etc/icinga2/constants.conf

Die Konfigurationsdatei

  • /etc/icinga2/constants.conf

wurde nun dazu genutzt, um die globale Konstanten/Variablen zu definieren, welche den

  1. NodeName
  2. ZoneName
  3. TicketSalt

beinhalten.

Die Konfigurationsdatei hat jetzt 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 = "server11.idmz.tachtler.net"
 
/* Our local zone name. */
const ZoneName = "server11.idmz.tachtler.net"
 
/* Secret key for remote node tickets */
const TicketSalt = "b12d05ea4adae26c9d5f2d6618baa1f4"

Neustart: icinga2

Danach kann der icinga2-Server mit nachfolgendem Befehle neu gestartet werden:

# systemctl restart icinga2

Mit nachfolgendem Befehl kann der Status des Icinga-Servers abgefragt werden:

# systemctl status icinga2
icinga2.service - Icinga host/service/network monitoring system
   Loaded: loaded (/usr/lib/systemd/system/icinga2.service; enabled)
   Active: active (running) since Tue 2015-12-01 14:34:31 CET; 3s ago
  Process: 19103 ExecStart=/usr/sbin/icinga2 daemon -d -e ${ICINGA2_ERROR_LOG} (code=exited, status=0/SUCCESS)
  Process: 19008 ExecStartPre=/usr/lib/icinga2/prepare-dirs /etc/sysconfig/icinga2 (code=exited, 
status=0/SUCCESS)
 Main PID: 19143 (icinga2)
   CGroup: /system.slice/icinga2.service
           └─19143 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon -...

Dec 01 14:34:31 server11.idmz.tachtler.net icinga2[19103]: [2015-12-01 14:34:...
Dec 01 14:34:31 server11.idmz.tachtler.net icinga2[19103]: [2015-12-01 14:34:...
Dec 01 14:34:31 server11.idmz.tachtler.net icinga2[19103]: [2015-12-01 14:34:...
Dec 01 14:34:31 server11.idmz.tachtler.net icinga2[19103]: [2015-12-01 14:34:...
Dec 01 14:34:31 server11.idmz.tachtler.net icinga2[19103]: [2015-12-01 14:34:...
Dec 01 14:34:31 server11.idmz.tachtler.net icinga2[19103]: [2015-12-01 14:34:...
Dec 01 14:34:31 server11.idmz.tachtler.net icinga2[19103]: [2015-12-01 14:34:...
Dec 01 14:34:31 server11.idmz.tachtler.net icinga2[19103]: [2015-12-01 14:34:...
Dec 01 14:34:31 server11.idmz.tachtler.net icinga2[19103]: [2015-12-01 14:34:...
Dec 01 14:34:31 server11.idmz.tachtler.net systemd[1]: Started Icinga host/se...
Hint: Some lines were ellipsized, use -l to show in full.

Nachfolgende LOG-Dateien sollten Auskunft darüber geben, wie der Neustart und der Status des Icinga-Servers ist.

  • /var/log/icinga2/icinga2.log
  • /var/log/icinga2/error.log

Der Inhalt der LOG-Datei /var/log/icinga2/icinga2.log könnte demnach wie folgt aussehen:

[2015-12-01 14:34:31 +0100] information/Application: Received request to shut down.
[2015-12-01 14:34:31 +0100] information/Application: Shutting down...
[2015-12-01 14:34:31 +0100] information/CheckerComponent: Checker stopped.
[2015-12-01 14:34:31 +0100] information/DbConnection: Pausing IDO connection: ido-mysql
[2015-12-01 14:34:31 +0100] information/DbConnection: Resuming IDO connection: ido-mysql
[2015-12-01 14:34:31 +0100] information/ConfigItem: Activated all objects.
[2015-12-01 14:34:31 +0100] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/modified-
attributes.conf
[2015-12-01 14:34:31 +0100] information/IdoMysqlConnection: MySQL IDO instance id: 1 (schema version: '1.14.0')

Die LOG-Datei /var/log/icinga2/error.log sollte hingegen leer 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) [server11.idmz.tachtler.net]: 
Please specifiy the local zone name [server11.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/cli: Created backup file '/etc/icinga2/pki/server11.idmz.tachtler.net.key.orig'.
information/cli: Created backup file '/etc/icinga2/pki/server11.idmz.tachtler.net.crt.orig'.
information/base: Writing private key to '/etc/icinga2/pki/server11.idmz.tachtler.net.key'.
information/base: Writing X509 certificate to '/etc/icinga2/pki/server11.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 'vml70110.idmz.tachtler.net'): a8c22c52d3c05ca581643acfe187051e6abe4301
information/cli: Requesting certificate with ticket 'a8c22c52d3c05ca581643acfe187051e6abe4301'.

warning/cli: Backup file '/etc/icinga2/pki/ca.crt.orig' already exists. Skipping backup.
warning/cli: Backup file '/etc/icinga2/pki/server11.idmz.tachtler.net.crt.orig' already exists. Skipping 
backup.
information/cli: Writing signed certificate to file '/etc/icinga2/pki/server11.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 []: 
Bind Port []: 
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.
warning/cli: Feature 'api' already enabled.
warning/cli: Backup file '/etc/icinga2/features-available/api.conf.orig' already exists. Skipping backup.
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!

:!: HINWIES - Hier wurde ein Client Setup auf dem Master durchgeführt!

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

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

:!: WICHTIG - Die neu erstellte Datei kann mit der vorhergehenden wieder überschrieben werden!

# mv /var/lib/icinga2/ca/ca.crt.orig /var/lib/icinga2/ca/ca.crt

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

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

:!: WICHTIG - Die neu erstellten Dateien müssen mit der vorhergehenden wieder überschrieben werden!

# mv /etc/icinga2/pki/server11.idmz.tachtler.net.key.orig /etc/icinga2/pki/server11.idmz.tachtler.net.key
# mv /etc/icinga2/pki/server11.idmz.tachtler.net.crt.orig /etc/icinga2/pki/server11.idmz.tachtler.crt.key

Nachfolgende Konfigurationsdatei wurden neu erstellt oder angepasst:

  • /etc/icinga2/conf.d/api-users.conf
  • /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 zusätzlich aktiviert ist:

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

/etc/icinga2/features-available/api.conf

Die Konfigurationsdatei

  • /etc/icinga2/features-available/api.conf

dient zur Definition, wo sich das

  • Das Zertifikate
  • Der Schlüssel zum Zertifikat
  • Das ROOT-Zertifikat

zur verschlüsselten Kommunikation befinden und welcher „TicketSalt“ verwendet werden soll.

(Komplette Konfigurationsdatei:)

/**
 * The API listener is used for distributed monitoring setups.
 */
object ApiListener "api" {
  cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt"
  key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key"
  ca_path = SysconfDir + "/icinga2/pki/ca.crt"
 
  accept_config = false
  accept_commands = true
 
  ticket_salt = TicketSalt
}

/etc/icinga2/zones.conf

Die Konfigurationsdatei

  • /etc/icinga2/zones.conf

ist nun nach dem „Monitoring Remote Setup“ konfiguriert um beim Einsatz des Icinga-Clients verschiedene notwendige Definitionen zu beinhalten („Endpoint“ und „Zone“ Definitionen).

Die Konfigurationsdatei hat nun nachfolgenden Inhalt und muss zwingend angepasst werden!

(Komplette Konfigurationsdatei:)

/*
 * Generated by Icinga 2 node setup commands
 * on 2015-12-01 15:19:13 +0100
 */
 
object Endpoint "server11.idmz.tachtler.net" {
	host = "192.168.0.110";
	port = "5665";
}
 
object Zone "master" {
	endpoints = [ "server11.idmz.tachtler.net" ];
}
 
/*
 * Tachtler - disabled -
 * Double confiuration as Master and Client ist NOT possible.
 */
 
/*
object Endpoint NodeName {
}
 
object Zone ZoneName {
        endpoints = [ NodeName ];
        parent = "master";
}
*/

/etc/icinga2/constants.conf

Die Konfigurationsdatei

  • /etc/icinga2/constants.conf

wurde nun dazu genutzt, um die globale Konstanten/Variablen zu definieren, welche den

  1. NodeName
  2. ZoneName
  3. TicketSalt

beinhalten.

Die Konfigurationsdatei hat jetzt 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 = "server11.idmz.tachtler.net"
 
/* Our local zone name. */
const ZoneName = "server11.idmz.tachtler.net"
 
/* Secret key for remote node tickets */
const TicketSalt = "b12d05ea4adae26c9d5f2d6618baa1f4"

Neustart: icinga2

Danach kann der icinga2-Server mit nachfolgendem Befehle neu gestartet werden:

# systemctl restart icinga2

Mit nachfolgendem Befehl kann der Status des Icinga-Servers abgefragt werden:

# systemctl status icinga2
icinga2.service - Icinga host/service/network monitoring system
   Loaded: loaded (/usr/lib/systemd/system/icinga2.service; enabled)
   Active: active (running) since Tue 2015-12-01 16:32:01 CET; 1min 28s ago
  Process: 24493 ExecStart=/usr/sbin/icinga2 daemon -d -e ${ICINGA2_ERROR_LOG} (code=exited, status=0/SUCCESS)
  Process: 24398 ExecStartPre=/usr/lib/icinga2/prepare-dirs /etc/sysconfig/icinga2 (code=exited, 
status=0/SUCCESS)
 Main PID: 24536 (icinga2)
   CGroup: /system.slice/icinga2.service
           └─24536 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon -...

Dec 01 16:32:01 server11.idmz.tachtler.net icinga2[24493]: [2015-12-01 16:32:...
Dec 01 16:32:01 server11.idmz.tachtler.net icinga2[24493]: [2015-12-01 16:32:...
Dec 01 16:32:01 server11.idmz.tachtler.net icinga2[24493]: [2015-12-01 16:32:...
Dec 01 16:32:01 server11.idmz.tachtler.net icinga2[24493]: [2015-12-01 16:32:...
Dec 01 16:32:01 server11.idmz.tachtler.net icinga2[24493]: [2015-12-01 16:32:...
Dec 01 16:32:01 server11.idmz.tachtler.net icinga2[24493]: [2015-12-01 16:32:...
Dec 01 16:32:01 server11.idmz.tachtler.net icinga2[24493]: [2015-12-01 16:32:...
Dec 01 16:32:01 server11.idmz.tachtler.net icinga2[24493]: [2015-12-01 16:32:...
Dec 01 16:32:01 server11.idmz.tachtler.net icinga2[24493]: [2015-12
Dec 01 16:32:01 server11.idmz.tachtler.net systemd[1]: Started Icinga host/se...
Hint: Some lines were ellipsized, use -l to show in full.

Nachfolgende LOG-Dateien sollten Auskunft darüber geben, wie der Neustart und der Status des Icinga-Servers ist.

  • /var/log/icinga2/icinga2.log
  • /var/log/icinga2/error.log

Der Inhalt der LOG-Datei /var/log/icinga2/icinga2.log könnte demnach wie folgt aussehen:

[2015-12-01 16:32:01 +0100] information/Application: Received request to shut down.
[2015-12-01 16:32:01 +0100] information/Application: Shutting down...
[2015-12-01 16:32:01 +0100] information/CheckerComponent: Checker stopped.
[2015-12-01 16:32:01 +0100] information/DbConnection: Pausing IDO connection: ido-mysql
[2015-12-01 16:32:01 +0100] information/DbConnection: Resuming IDO connection: ido-mysql
[2015-12-01 16:32:01 +0100] information/ConfigItem: Activated all objects.
[2015-12-01 16:32:01 +0100] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/modified-
attributes.conf
[2015-12-01 16:32:01 +0100] information/IdoMysqlConnection: MySQL IDO instance id: 1 (schema version: '1.14.0')

Die LOG-Datei /var/log/icinga2/error.log sollte hingegen leer sein!

Konfiguration: Monitoring: /etc/icinga2/conf.d/

Nachfolgende Konfigurationsdateien stellen das Herzstück von Icinga dar und dienen der Konfiguration des Monitorings durch Icinga.

Bevor Veränderungen in den Dateien und deren Position im Dateisystem durchgeführt werden sollen, sollte eine Sicherung der ursprünglichen Konfigurationsdateien durchgeführt werden, wie unter nachfolgendem internen Link dargestellt:

Nachfolgende Konfigurationsdateien sind entweder

  • global, es reicht das einmalige Vorkommen
  • lokal, spezielle Konfigurationen Objekt spezifisch z.B. für unterschiedliche Domänen in Unterdateien definiert

Zu den globalen Konfigurationsdateien gehören nachfolgende:

  • /etc/icinga2/conf.d/app.conf
  • /etc/icinga2/conf.d/commands.conf
  • * /etc/icinga2/conf.d/timeperiods.conf

Zu den lokalen Konfigurationsdateien gehören nachfolgende:

  • /etc/icinga2/conf.d/downtimes.conf
  • /etc/icinga2/conf.d/hosts.conf
  • /etc/icinga2/conf.d/groups.conf
  • /etc/icinga2/conf.d/notifications.conf
  • /etc/icinga2/conf.d/satellite.conf
  • /etc/icinga2/conf.d/services.conf
  • /etc/icinga2/conf.d/templates.conf
  • * /etc/icinga2/conf.d/timeperiods.conf
  • /etc/icinga2/conf.d/users.conf

* Aufteilung in eine globalen und lokalen Teil

app.conf

Die Konfigurationsdatei

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

konfiguriert global das Icinga-Application Objekt app, welches benötigt wird, damit Icinga startet. Das Objekt muss app lauten.

Falls das Objekt app nicht vorhanden ist, wird dies von Icinga automatisch erstellt.

Nachfolgende Parameter können dem Icinga-Application Objekt app hinzugefügt werden:

Parameter Beschreibung
enable_notifications Optional. Aktiviert notifications global. Standard: true (wahr).
enable_event_handlers Optional. Aktiviert event_handlers global. Standard: true (wahr).
enable_flapping Optional. Aktiviert flapping global. Standard: true (wahr).
enable_host_checks Optional. Aktiviert host_checks global. Standard: true (wahr).
enable_service_checks Optional. Aktiviert service_checks global. Standard: true (wahr).
enable_perfdata Optional. Aktiviert perfdata global. Standard: true (wahr).
vars Optional. Benutzerdefinierte globale Variablen.

Nachfolgend der Inhalt der Konfigurationsdatei. Es sind keine Anpassungen erforderlich!:

object IcingaApplication "app" { }

commands.conf

Die Konfigurationsdatei

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

konfiguriert global Icinga-Comamnd (Kommandos), welche ebenfalls global an verschiedenen Stellen durch Icinga genutzt werden. Standardmäßig sind nachfolgende Commands (Kommandos) definiert:

  1. mail-host-notification - Aufruf des Skripts: /etc/icinga2/scripts/mail-host-notification.sh und bereitstellen von Umgebungsvariablen für dieses Skript.
  2. mail-service-notification - Aufruf des Skripts: /etc/icinga2/scripts/mail-service-notification.sh und bereitstellen von Umgebungsvariablen für dieses Skript.

Eigene Comamnd (Kommandos) können und sollen hier definiert werden und die ggf. dazu benötigten Skripte sollten im Verzeichnis /etc/icinga2/scripts/ hinterlegt werden.

Nachfolgend der Inhalt der Konfigurationsdatei. Es sind keine Anpassungen erforderlich!:

/* Command objects */
 
object NotificationCommand "mail-host-notification" {
  import "plugin-notification-command"
 
  command = [ SysconfDir + "/icinga2/scripts/mail-host-notification.sh" ]
 
  env = {
    NOTIFICATIONTYPE = "$notification.type$"
    HOSTALIAS = "$host.display_name$"
    HOSTADDRESS = "$address$"
    HOSTSTATE = "$host.state$"
    LONGDATETIME = "$icinga.long_date_time$"
    HOSTOUTPUT = "$host.output$"
    NOTIFICATIONAUTHORNAME = "$notification.author$"
    NOTIFICATIONCOMMENT = "$notification.comment$"
    HOSTDISPLAYNAME = "$host.display_name$"
    USEREMAIL = "$user.email$"
  }
}
 
object NotificationCommand "mail-service-notification" {
  import "plugin-notification-command"
 
  command = [ SysconfDir + "/icinga2/scripts/mail-service-notification.sh" ]
 
  env = {
    NOTIFICATIONTYPE = "$notification.type$"
    SERVICEDESC = "$service.name$"
    HOSTALIAS = "$host.display_name$"
    HOSTADDRESS = "$address$"
    SERVICESTATE = "$service.state$"
    LONGDATETIME = "$icinga.long_date_time$"
    SERVICEOUTPUT = "$service.output$"
    NOTIFICATIONAUTHORNAME = "$notification.author$"
    NOTIFICATIONCOMMENT = "$notification.comment$"
    HOSTDISPLAYNAME = "$host.display_name$"
    SERVICEDISPLAYNAME = "$service.display_name$"
    USEREMAIL = "$user.email$"
  }
}

downtimes.conf

:!: HINWEIS - Der Einsatz in einem Unterverzeichnis z.B. /etc/icinga2/conf.d/<DOMAIN.TLD>/<ZONE>/downtimes.conf ist sinnvoll!

Die Konfigurationsdatei

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

konfiguriert global die von Icinga zu berücksichtigenden „Downtimes“ (Wartungszeiten), welche ein Objekt wie z.B. ein service haben kann.

Die Definition, ob „Downtimes“ (Wartungszeiten) von Icinga zu berücksichtigen sind, erfolgt beim Objekt, z.B. in einer service-Definition mit der Definition: load

Der Parameter ScheduledDowntime (geplantes Wartungsfenster), nutzt das Attribut dazu, um ein geplantes Standard Wartungsfenster für ein Objekt, z.B. einen Service zu definieren.

Nachfolgend der Inhalt der Konfigurationsdatei. Es sind keine Anpassungen erforderlich!:

/**
 * The example downtime apply rule.
 */
 
apply ScheduledDowntime "backup-downtime" to Service {
  author = "icingaadmin"
  comment = "Scheduled downtime for backup"
 
  ranges = {
    monday = service.vars.backup_downtime
    tuesday = service.vars.backup_downtime
    wednesday = service.vars.backup_downtime
    thursday = service.vars.backup_downtime
    friday = service.vars.backup_downtime
    saturday = service.vars.backup_downtime
    sunday = service.vars.backup_downtime
  }
 
  assign where service.vars.backup_downtime != ""
}

Falls bei einem Service nun die benutzerdefinierte Variable: vars.backup_downtime definiert ist, kommt das geplante Wartungsfenster zum tragen.

Anstelle für einen bestimmtes Objekt ein ScheduledDowntime zu definieren, ist es sinnvoller ein Template (Vorlage) zu definieren, welches dann an verschiedenen Stelle genutzt werden kann. Dieses Template (Vorlage) kann dann durch z.B. setzen der Variable: vars.backup_downtime beim Objekt aktiviert werden:

Beispiel:

object ScheduledDowntime "some-downtime" {
  host_name = "localhost"
  service_name = "ping4"
 
  author = "icingaadmin"
  comment = "Some comment"
 
  fixed = false
  duration = 30m
 
  ranges = {
    "sunday" = "02:00-03:00"
  }
}

Nachfolgende Parameter können für Icinga ScheduledDowntime hinzugefügt werden:

Parameter Beschreibung
host_name Erforderlich. Der Name des Host, auf den die ScheduledDowntime angewandt werden soll.
service_name Optional. Der Kurzname des Service, auf den die ScheduledDowntime angewandt werden soll. Falls hier eine Definition erfolgt, wird dieser Service wie ein Objekt vom Typ Host behandelt.
author Erforderlich. Der Autor der ScheduledDowntime.
comment Erforderlich. Ein Kommentar zur ScheduledDowntime.
fixed Optional. Bezeichnet die ScheduledDowntime als feststehend. Standard: true (wahr).
duration Optional. Dauer für die ScheduledDowntime. Kommt nur zum tragen, wenn fixed false (unwahr) ist.
ranges Erforderlich. Angabe für welchen Zeitraum die ScheduledDowntime gelten soll.

:!: HINWEIS - Falls dies so nicht benötigt wird, kann die Konfigurationsdatei auch geleert werden, wie nachfolgend dargestellt!

/**
 * The downtime apply rules.
 */

groups.conf

:!: HINWEIS - Nur der Einsatz in einem Unterverzeichnis z.B. /etc/icinga2/conf.d/<DOMAIN.TLD>/<ZONE>/downtimes.conf ist sinnvoll!

Die Konfigurationsdatei

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

beinhaltet „Groups“ (Gruppendefinitionen) für Icinga.

Nachfolgend der Inhalt der Konfigurationsdatei. Es werden nachfolgende Anpassungen durchgeführt!:

:!: HINWEIS - Diese Konfigurationsdatei sollte sehr individuell angepasst werden!

Nachfolgend der Inhalt der Konfigurationsdatei. Es sind sehr individuelle Anpassungen erforderlich, deshalb wird hier nur die Standardkonfigurationsdatei als Beispiel dargestellt!:

/**
 * Host group examples.
 */
 
object HostGroup "linux-servers" {
  display_name = "Linux Servers"
 
  assign where host.vars.os == "Linux"
}
 
object HostGroup "windows-servers" {
  display_name = "Windows Servers"
 
  assign where host.vars.os == "Windows"
}
 
/**
 * Service group examples.
 */
 
object ServiceGroup "ping" {
  display_name = "Ping Checks"
 
  assign where match("ping*", service.name)
}

:!: HINWEIS - Es empfiehlt sich die Gruppenkonfiguration für Hosts und Services jeweils in separaten Konfigurationsdateien auszulagern!

Nachfolgende Parameter können für Icinga Groups assign verwendet werden:

Parameter Variable
HostGroup host
ServiceGroup host, service
UserGroup user

hosts.conf

:!: HINWEIS - Nur der Einsatz in einem Unterverzeichnis z.B. /etc/icinga2/conf.d/<DOMAIN.TLD>/<ZONE>/downtimes.conf ist sinnvoll!

Die Konfigurationsdatei

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

beinhaltet „Host“ für Icinga welche eine der beiden wichtigsten Konfigurationsdateien darstellt.

Nachfolgend der Inhalt der Konfigurationsdatei. Es werden nachfolgende Anpassungen durchgeführt!:

:!: HINWEIS - Diese Konfigurationsdatei sollte sehr individuell angepasst werden!

Nachfolgend der Inhalt der Konfigurationsdatei. Es sind sehr individuelle Anpassungen erforderlich, deshalb wird hier nur die Standardkonfigurationsdatei als Beispiel dargestellt!:

/*
 * Host definitions with object attributes
 * used for apply rules for Service, Notification,
 * Dependency and ScheduledDowntime objects.
 *
 * Tip: Use `icinga2 object list --type Host` to
 * list all host objects after running
 * configuration validation (`icinga2 daemon -C`).
 */
 
/*
 * This is an example host based on your
 * local host's FQDN. Specify the NodeName
 * constant in `constants.conf` or use your
 * own description, e.g. "db-host-1".
 */
 
object Host NodeName {
  /* Import the default host template defined in `templates.conf`. */
  import "generic-host"
 
  /* Specify the address attributes for checks e.g. `ssh` or `http`. */
  address = "10.7.0.110"
  address6 = "::1"
 
  /* Set custom attribute `os` for hostgroup assignment in `groups.conf`. */
  vars.os = "Linux"
 
  /* Define http vhost attributes for service apply rules in `services.conf`. */
  /*vars.http_vhosts["http"] = {
    http_uri = "/"
  }*/
  /* Uncomment if you've sucessfully installed Icinga Web 2. */
  //vars.http_vhosts["Icinga Web 2"] = {
  //  http_uri = "/icingaweb2"
  //}
 
  /* Define disks and attributes for service apply rules in `services.conf`. */
  /*vars.disks["disk"] = {
    /* No parameters. */
  /*}*/
  /*vars.disks["disk /"] = {
    disk_partitions = "/"
  }*/
 
  /* Define notification mail attributes for notification apply rules in `notifications.conf`. */
  vars.notification["mail"] = {
    /* The UserGroup `icingaadmins` is defined in `users.conf`. */
    /* Tachtler */
    /* default: groups = [ "icingaadmins" ] */
    groups = [ "tachtler.net-icingaadmins" ]
  }
}

notifications.conf

:!: HINWEIS - Der Einsatz in einem Unterverzeichnis z.B. /etc/icinga2/conf.d/<DOMAIN.TLD>/<ZONE>/downtimes.conf ist sinnvoll!

Die Konfigurationsdatei

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

versendet Notifications (Benachrichtigungen) z.B. per e-Mail, im definierten Falle an einen Benutzer oder eine BenutzerGruppe.

In der Konfigurationsdatei sind standardmäßig zwei Benachrichtigungs-Regeln definiert

  1. mail-icingaadmin für Host-Benachrichtigungen
  2. mail-icingaadmin für Service-Benachrichtigungen

Nachfolgend der Inhalt der Konfigurationsdatei. Es sind keine Anpassungen erforderlich!:

/**
 * The example notification apply rules.
 *
 * Only applied if host/service objects have
 * the custom attribute `notification` defined
 * and containing `mail` as key.
 *
 * Check `hosts.conf` for an example.
 */
 
apply Notification "mail-icingaadmin" to Host {
  import "mail-host-notification"
 
  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users
 
  assign where host.vars.notification.mail
}
 
apply Notification "mail-icingaadmin" to Service {
  import "mail-service-notification"
 
  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users
 
  assign where host.vars.notification.mail
}

Diese Konfiguration und die sich in der Konfigurationsdatei /etc/icinga2/donf.d/templates.conf Template (Vorlage) kann dann durch z.B. setzen der Variable: vars.notification[„mail“] beim Objekt aktiviert werden:

Beispiel:

object Notification "localhost-ping-notification" {
  host_name = "localhost"
  service_name = "ping4"
 
  command = "mail-notification"
 
  users = [ "user1", "user2" ]
 
  types = [ Problem, Recovery ]
}

Beispiel:

(Nur relevanter Ausschnitt:)

object Host NodeName {
...
...
...
  vars.notification["mail"] = {
    /* The UserGroup `icingaadmins` is defined in `users.conf`. */
    /* Tachtler */
    /* default: groups = [ "icingaadmins" ] */
    groups = [ "icingaadmins_tachtler.net" ]
  }
...
...
...
}

Nachfolgende Parameter können für Icinga Notification hinzugefügt werden:

Parameter Beschreibung
host_name Erforderlich. Der Name des Host, auf den die Notification angewandt werden soll.
service_name Optional. Der Kurzname des Service, auf den die Notification angewandt werden soll. Falls hier eine Definition erfolgt, wird dieser Service wie ein Objekt vom Typ Host behandelt.
vars Optional. Benutzerdefinierte Variablen.
users Optional. Liste mit Benutzernamen, welche die Notification erhalten sollen.
user_groups Optional. Liste mit Benutzergruppen, welche die Notification erhalten sollen.
times Optional. Angabe einer „Start“- und „Ende“-Zeit Definition für einen Zustellungszeitraum der Notification.
command Erforderlich. Der Name des Kommandos, welches zur Ausführung der Notification angewandt werden soll.
interval Optional. Zeitintervall in Sekunden, in dem die Notification wiederholt gesendet werden soll. Standard sind hier 30 Minuten. Ein Angabe von 0 deaktiviert das erneute senden.
period Optional. Angabe eines definierten Zeitfensters in dem die Notification überhaupt versendet werden soll.
zone Optional. Angabe einer „Zone“, zu dieser dieses Objekt gehören soll.
types Optional. Angabe eines Typ-Filters, bei dem die Notification überhaupt versendet werden soll. Standardmäßig ist kein Filter gesetzt.
states Optional. Angabe eines Status-Filters, bei dem die Notification überhaupt versendet werden soll. Standardmäßig ist kein Filter gesetzt.

satellite.conf

:!: HINWEIS - Wenn benötigt ist der Einsatz in einem Unterverzeichnis z.B. /etc/icinga2/conf.d/<DOMAIN.TLD>/<ZONE>/downtimes.conf sinnvoll!

Die Konfigurationsdatei

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

beinhaltet Standard Templetes (Vorlagen) und Dependencies (Abhängigkeiten) für die Überwachung von Remote Icinga-Clients, welche die Verwaltung der Konfiguration der Remote-Clients auf dem Master nutzen und die Konfiguration für den Remote-Client an dessen übermitteln.

:!: WICHTIG - Dieses Feature (Möglichkeit) soll hier nicht zum Einsatz kommen!

Nachfolgend der Inhalt der Konfigurationsdatei. Es werden nachfolgende Anpassungen durchgeführt!:

:!: HINWEIS - Diese Konfigurationsdatei wird nicht benötigt und wird daher geleert, wie nachfolgend dargestellt!

/*
 * Host and Service templates for the Agent Setup.
 */

services.conf

:!: HINWEIS - Nur der Einsatz in einem Unterverzeichnis z.B. /etc/icinga2/conf.d/<DOMAIN.TLD>/<ZONE>/downtimes.conf ist sinnvoll!

Die Konfigurationsdatei

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

beinhaltet „Services“ für Icinga welche eine der beiden wichtigsten Konfigurationsdateien darstellt.

Nachfolgend der Inhalt der Konfigurationsdatei. Es werden nachfolgende Anpassungen durchgeführt!:

:!: HINWEIS - Diese Konfigurationsdatei sollte sehr individuell angepasst werden!

Nachfolgend der Inhalt der Konfigurationsdatei. Es sind sehr individuelle Anpassungen erforderlich, deshalb wird hier nur die Standardkonfigurationsdatei als Beispiel dargestellt!:

/*
 * Service apply rules.
 *
 * The CheckCommand objects `ping4`, `ping6`, etc
 * are provided by the plugin check command templates.
 * Check the documentation for details.
 *
 * Tip: Use `icinga2 object list --type Service` to
 * list all service objects after running
 * configuration validation (`icinga2 daemon -C`).
 */
 
/*
 * This is an example host based on your
 * local host's FQDN. Specify the NodeName
 * constant in `constants.conf` or use your
 * own description, e.g. "db-host-1".
 */
 
/*
 * These are generic `ping4` and `ping6`
 * checks applied to all hosts having the
 * `address` resp. `address6` attribute
 * defined.
 */
apply Service "ping4" {
  import "generic-service"
 
  check_command = "ping4"
 
  assign where host.address
}
 
/*apply Service "ping6" {
  import "generic-service"
 
  check_command = "ping6"
 
  assign where host.address6
}*/
 
/*
 * Apply the `ssh` service to all hosts
 * with the `address` attribute defined and
 * the custom attribute `os` set to `Linux`.
 */
apply Service "ssh" {
  import "generic-service"
 
  check_command = "ssh"
 
  assign where (host.address || host.address6) && host.vars.os == "Linux"
}
 
 
 
/*apply Service for (http_vhost => config in host.vars.http_vhosts) {
  import "generic-service"
 
  check_command = "http"
 
  vars += config
}
 
apply Service for (disk => config in host.vars.disks) {
  import "generic-service"
 
  check_command = "disk"
 
  vars += config
}*/
 
apply Service "icinga" {
  import "generic-service"
 
  check_command = "icinga"
 
  assign where host.name == NodeName
}
 
apply Service "load" {
  import "generic-service"
 
  check_command = "load"
 
  /* Used by the ScheduledDowntime apply rule in `downtimes.conf`. */
  vars.backup_downtime = "02:00-03:00"
 
  assign where host.name == NodeName
}
 
apply Service "procs" {
  import "generic-service"
 
  check_command = "procs"
 
  assign where host.name == NodeName
}
 
apply Service "swap" {
  import "generic-service"
 
  check_command = "swap"
 
  assign where host.name == NodeName
}
 
apply Service "users" {
  import "generic-service"
 
  check_command = "users"
 
  assign where host.name == NodeName
}

templates.conf

:!: HINWEIS - Der Einsatz in einem Unterverzeichnis z.B. /etc/icinga2/conf.d/<DOMAIN.TLD>/<ZONE>/downtimes.conf ist sinnvoll!

Die Konfigurationsdatei

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

konfiguriert die von Icinga zu berücksichtigenden „Templates“ (Vorlagen), welche ein Objekt wie z.B. ein service haben kann.

Die Definition, ob „Templates“ (Vorlagen) von Icinga zu berücksichtigen sind, erfolgt beim Objekt, z.B. in einer service-Definition.

Nachfolgend der Inhalt der Konfigurationsdatei. Es sind individuelle Anpassungen möglich, aber nicht erforderlich!:

/*
 * Generic template examples.
 */
 
 
/**
 * Provides default settings for hosts. By convention
 * all hosts should import this template.
 *
 * The CheckCommand object `hostalive` is provided by
 * the plugin check command templates.
 * Check the documentation for details.
 */
template Host "generic-host" {
  max_check_attempts = 3
  check_interval = 1m
  retry_interval = 30s
 
  check_command = "hostalive"
}
 
/**
 * Provides default settings for services. By convention
 * all services should import this template.
 */
template Service "generic-service" {
  max_check_attempts = 5
  check_interval = 1m
  retry_interval = 30s
}
 
/**
 * Provides default settings for users. By convention
 * all users should inherit from this template.
 */
 
template User "generic-user" {
 
}
 
/**
 * Provides default settings for host notifications.
 * By convention all host notifications should import
 * this template.
 */
template Notification "mail-host-notification" {
  command = "mail-host-notification"
 
  states = [ Up, Down ]
  types = [ Problem, Acknowledgement, Recovery, Custom,
            FlappingStart, FlappingEnd,
            DowntimeStart, DowntimeEnd, DowntimeRemoved ]
 
  period = "24x7"
}
 
/**
 * Provides default settings for service notifications.
 * By convention all service notifications should import
 * this template.
 */
template Notification "mail-service-notification" {
  command = "mail-service-notification"
 
  states = [ OK, Warning, Critical, Unknown ]
  types = [ Problem, Acknowledgement, Recovery, Custom,
            FlappingStart, FlappingEnd,
            DowntimeStart, DowntimeEnd, DowntimeRemoved ]
 
  period = "24x7"
}

timeperiods.conf

:!: HINWEIS - Der Einsatz in einem Unterverzeichnis z.B. /etc/icinga2/conf.d/<DOMAIN.TLD>/<ZONE>/downtimes.conf ist sinnvoll!

Die Konfigurationsdatei

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

konfiguriert global die von Icinga zu berücksichtigenden „Timeperiods“ (Benachrichtigungszeiten), welche ein Objekt wie z.B. ein service haben kann.

Die Definition, ob „Timeperiods“ (Benachrichtigungszeiten) von Icinga zu berücksichtigen sind, erfolgt beim Objekt, z.B. in einer service-Definition.

Nachfolgend der Inhalt der Konfigurationsdatei. Es sind keine Anpassungen erforderlich!:

/**
 * Timeperiods for Icinga 2 requiring
 * 'legacy-timeperiod' template from the Icinga
 * Template Library (ITL).
 * Check the documentation for details.
 */
 
object TimePeriod "24x7" {
  import "legacy-timeperiod"
 
  display_name = "Icinga 2 24x7 TimePeriod"
  ranges = {
    "monday" 	= "00:00-24:00"
    "tuesday" 	= "00:00-24:00"
    "wednesday" = "00:00-24:00"
    "thursday" 	= "00:00-24:00"
    "friday" 	= "00:00-24:00"
    "saturday" 	= "00:00-24:00"
    "sunday" 	= "00:00-24:00"
  }
}
 
object TimePeriod "9to5" {
  import "legacy-timeperiod"
 
  display_name = "Icinga 2 9to5 TimePeriod"
  ranges = {
    "monday" 	= "09:00-17:00"
    "tuesday" 	= "09:00-17:00"
    "wednesday" = "09:00-17:00"
    "thursday" 	= "09:00-17:00"
    "friday" 	= "09:00-17:00"
  }
}
 
object TimePeriod "never" {
  import "legacy-timeperiod"
 
  display_name = "Icinga 2 never TimePeriod"
  ranges = {
  }
}

users.conf

:!: HINWEIS - Der Einsatz in einem Unterverzeichnis z.B. /etc/icinga2/conf.d/<DOMAIN.TLD>/<ZONE>/downtimes.conf ist sinnvoll!

Die Konfigurationsdatei

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

definiert standardmäßig den Benutzer icingaadmin und die Benutzergruppe icingaadmins.

Die Benutzergruppe wird standardmäßig später in der Konfigurationsdatei: /etc/icinga2/conf.d/hosts.conf verwendet, welche selbst später dann wiederum auf die Konfigurationsdatei: /etc/icinga2/conf.d/notifications.conf verweist, die für den Versandt von Benachrichtigungen z.B. per e-Mail herangezogen wird.

:!: HINWEIS - Beim Monitoring von z.B. mehreren Domains, kann es sinnvoll sein, hier den Benutzername und die Benutzergruppe zu individualisieren!

Nachfolgend der Inhalt der Konfigurationsdatei. Es werden nachfolgende Anpassungen durchgeführt!:

:!: WICHTIG - Bei Anpassungen, müssen die gleichen Anpassungen ggf. auch in der Konfigurationsdatei(en) zu Hosts z.B.

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

durchgeführt werden!

/**
 * The user 'icingaadmin' and the 
 * group 'icingaadmins'.
 */
 
/* Tachtler */
/* default: object User "icingaadmin" { */
object User "icingaadmin_tachtler.net" {
  import "generic-user"
 
/* Tachtler */
/* default:  display_name = "Icinga 2 Admin" */
  display_name = "Icinga 2 Administrator tachtler.net"
/* Tachtler */
/* default:  groups = [ "icingaadmins" ] */
  groups = [ "icingaadmins_tachtler.net" ]
 
/* Tachtler */
/* default:  email = "icinga@localhost" */
  email = "icingaadmin@tachtler.net"
}
 
/* Tachtler */
/* default: object UserGroup "icingaadmins" { */
object UserGroup "icingaadmins_tachtler.net" {
/* Tachtler */
/* default:  display_name = "Icinga 2 Admin Group" */
  display_name = "Icinga 2 Adminstratoren Gruppe tachtler.net"
}

:!: HINWEIS - Alle Anpassungen und alle Standardwerte, falls vorhanden, sind mit einem Vorangestellten Kommentar

/* Tachtler */
/* default: */

gekennzeichnet.

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_-_grundkonfiguration.1449206031.txt.gz · Zuletzt geändert: 2015/12/04 06:13 von klaus