Benutzer-Werkzeuge

Webseiten-Werkzeuge


tachtler:icinga2_-_grundkonfiguration

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
tachtler:icinga2_-_grundkonfiguration [2015/12/03 11:37] – [templates.conf] klaustachtler:icinga2_-_grundkonfiguration [2021/08/04 20:13] (aktuell) – [/etc/icinga2/features-available/api.conf] klaus
Zeile 20: Zeile 20:
 eine **Kopie der originalen Konfigurationsdatei, welche alle mit ''.conf'' enden,** angefertigt werden: eine **Kopie der originalen Konfigurationsdatei, welche alle mit ''.conf'' enden,** angefertigt werden:
 <code> <code>
-# for i in `ls /etc/icinga2/conf.d/*.conf`; do cp -a /etc/icinga2/conf.d/$i /etc/icinga2/conf.d/$i.orig; done+# for i in `ls /etc/icinga2/conf.d/*.conf`; do cp -a $i $i.orig; done
 </code> </code>
  
Zeile 343: Zeile 343:
   * Das **ROOT-Zertifikat**   * Das **ROOT-Zertifikat**
 zur verschlüsselten Kommunikation befinden und welcher "TicketSalt" verwendet werden soll. zur verschlüsselten Kommunikation befinden und welcher "TicketSalt" verwendet werden soll.
 +
 +:!: **WICHTIG** - **Falls __KEIN__ IPv6 zum Einsatz kommt, ist nachfolgender Konfiguratrionsparameter**
 +<code>
 +  bind_host = "0.0.0.0"
 +</code>
 +**zwingend erforderlich!**
  
 (**Komplette Konfigurationsdatei:**) (**Komplette Konfigurationsdatei:**)
Zeile 355: Zeile 361:
   key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key"   key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key"
   ca_path = SysconfDir + "/icinga2/pki/ca.crt"   ca_path = SysconfDir + "/icinga2/pki/ca.crt"
 +
 +  bind_host = "0.0.0.0"
  
   ticket_salt = TicketSalt   ticket_salt = TicketSalt
Zeile 546: Zeile 554:
  
 Please specify the request ticket generated on your Icinga 2 master. Please specify the request ticket generated on your Icinga 2 master.
- (Hint: # icinga2 pki ticket --cn 'vml70110.idmz.tachtler.net'): a8c22c52d3c05ca581643acfe187051e6abe4301+ (Hint: # icinga2 pki ticket --cn 'server11.idmz.tachtler.net'): a8c22c52d3c05ca581643acfe187051e6abe4301
 information/cli: Requesting certificate with ticket 'a8c22c52d3c05ca581643acfe187051e6abe4301'. information/cli: Requesting certificate with ticket 'a8c22c52d3c05ca581643acfe187051e6abe4301'.
  
Zeile 601: Zeile 609:
  
 Nachfolgende Konfigurationsdatei wurden **neu** erstellt oder angepasst: Nachfolgende Konfigurationsdatei wurden **neu** erstellt oder angepasst:
-  * ''/etc/icinga2/conf.d/api-users.conf'' 
   * ''/etc/icinga2/zones.conf''   * ''/etc/icinga2/zones.conf''
   * ''/etc/icinga2/features-available/api.conf''   * ''/etc/icinga2/features-available/api.conf''
   * ''/etc/icinga2/features-enabled/api.conf''   * ''/etc/icinga2/features-enabled/api.conf''
   * ''/etc/icinga2/constants.conf''   * ''/etc/icinga2/constants.conf''
 +
 +:!: **HINWEIS** - **Möglicherweise ist das __Feature__ ''notification'' (disabled) deaktiviert. Dies kann durch nachfolgenden Befehl wieder (enabled) aktiviert werden**:
 +<code>
 +# icinga2 feature enable notification
 +Enabling feature notification. Make sure to restart Icinga 2 for these changes to take effect.
 +</code>
  
 Nachfolgender Befehl zeigt an, das das **Feature** (Möglichkeit) - **''api''** - aktuell in [[https://www.icinga.org/|Icinga]] **zusätzlich** aktiviert ist: Nachfolgender Befehl zeigt an, das das **Feature** (Möglichkeit) - **''api''** - aktuell in [[https://www.icinga.org/|Icinga]] **zusätzlich** aktiviert ist:
Zeile 623: Zeile 636:
   * Das **ROOT-Zertifikat**   * Das **ROOT-Zertifikat**
 zur verschlüsselten Kommunikation befinden und welcher "TicketSalt" verwendet werden soll. zur verschlüsselten Kommunikation befinden und welcher "TicketSalt" verwendet werden soll.
 +
 +:!: **WICHTIG** - **Falls __KEIN__ IPv6 zum Einsatz kommt, ist nachfolgender Konfiguratrionsparameter**
 +<code>
 +  bind_host = "0.0.0.0"
 +</code>
 +**zwingend erforderlich!**
  
 (**Komplette Konfigurationsdatei:**) (**Komplette Konfigurationsdatei:**)
Zeile 634: Zeile 653:
   key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key"   key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key"
   ca_path = SysconfDir + "/icinga2/pki/ca.crt"   ca_path = SysconfDir + "/icinga2/pki/ca.crt"
 +
 +  bind_host = "0.0.0.0"
  
   accept_config = false   accept_config = false
Zeile 798: Zeile 819:
   * ''/etc/icinga2/conf.d/commands.conf''   * ''/etc/icinga2/conf.d/commands.conf''
   * * ''/etc/icinga2/conf.d/timeperiods.conf''   * * ''/etc/icinga2/conf.d/timeperiods.conf''
-  * FIXME+
 Zu den **lokalen** Konfigurationsdateien gehören nachfolgende: Zu den **lokalen** Konfigurationsdateien gehören nachfolgende:
   * ''/etc/icinga2/conf.d/downtimes.conf''   * ''/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/notifications.conf''
-  * FIXME 
   * ''/etc/icinga2/conf.d/satellite.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/timeperiods.conf''
   * ''/etc/icinga2/conf.d/users.conf''   * ''/etc/icinga2/conf.d/users.conf''
Zeile 968: Zeile 992:
  
 ==== groups.conf ==== ==== 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 [[https://www.icinga.org/|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!**:
 +<code c>
 +/**
 + * 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)
 +}
 +
 +</code>
 +
 +:!: **HINWEIS** - **Es empfiehlt sich die Gruppenkonfiguration für Hosts und Services jeweils in separaten Konfigurationsdateien auszulagern!**
 +
 +Nachfolgende Parameter können für [[https://www.icinga.org/|Icinga]] **''Groups __assign__''** verwendet werden:
 +
 +^ Parameter        ^ Variable              ^
 +| ''HostGroup''    | ''host''              |
 +| ''ServiceGroup'' | ''host'', ''service'' |
 +| ''UserGroup''    | ''user''              |
  
 ==== hosts.conf ==== ==== 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 [[https://www.icinga.org/|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!**:
 +<code c>
 +/*
 + * 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" ]
 +  }
 +}
 +
 +</code>
  
 ==== notifications.conf ==== ==== notifications.conf ====
Zeile 1088: Zeile 1229:
  
 ==== services.conf ==== ==== 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 [[https://www.icinga.org/|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!**:
 +<code c>
 +/*
 + * 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
 +}
 +
 +</code>
 +
 +Bei der Überprüfung von **Services** auf einem **Client**, welche **__durch__ den [[https://www.icinga.org/|Icinga]]-Client __lokal__ durchgeführt** werden sollen, ist die **Angabe eines __command_endpoint__** erforderlich. 
 +
 +Nachfolgendes Beispiel, soll dies für die Überprüfung der Laufwerke mittels **''check_disk''** darstellen:
 +
 +(**Nur relevanter Ausschnitt**):
 +
 +<code c>
 +apply Service for (disk => config in host.vars.disks) {
 +  import "tachtler.net-generic-service"
 +
 +  check_command = "disk"
 +
 +  command_endpoint = host.name
 +
 +  vars += config
 +}
 +</code>
 +
 +**__Erklärung__**:
 +
 +  * <code c>command_endpoint = host.name</code>
 +
 +Die Definition des **''command_endpoint''** wird in diesem Beispiel mit der Variable ''host.name'' gefüllt, welche **__hier__** gleichzeitig der **__NodeName__** ist!
  
 ==== templates.conf ==== ==== templates.conf ====
Zeile 1288: Zeile 1582:
 </code> </code>
 gekennzeichnet. gekennzeichnet.
 +
 +===== Konfiguration: icinga2-Clients =====
 +
 +Nachdem die Konfiguration der [[https://www.icinga.org/|Icinga]]-Clients durchgeführt wurden, wie unter nachfolgenden internen Links beschrieben:
 +  * [[tachtler:icinga2_-_client|Icinga2 - Client]]
 +  * [[tachtler:icinga2_-_client_-_grundkonfiguration|Icinga2 - Client - Grundkonfiguration]]
 +ist nachfolgende Konfiguration des [[https://www.icinga.org/|Icinga]]-**Master** erforderlich, damit diese zum [[https://www.icinga.org/|Icinga]]-Client eine Verbindung herstellen kann **und** alle Abfragen vom [[https://www.icinga.org/|Icinga]]-**Master** zum [[https://www.icinga.org/|Icinga]]-Client weiterleitet und dieser diese dann beantwortet, **__ohne__ jedoch eine eigene Konfiguration selbst zu halten**.
 +
 +:!: **WICHTIG** - **Die Konfiguration der Checks für den [[https://www.icinga.org/|Icinga]]-Client soll auf dem [[https://www.icinga.org/|Icinga]]-Master erfolgen!**
 +
 +==== /etc/icinga2/zones.conf ====
 +
 +Die Konfigurationsdatei
 +  * ''/etc/icinga2/zones.conf''
 +ist nun nach dem **"Monitoring Remote Setup"** konfiguriert um beim Einsatz des [[https://www.icinga.org/|Icinga]]-Clients verschiedene **notwendige** Definitionen zu beinhalten ("Endpoint" und "Zone" Definitionen).
 +
 +Die Konfigurationsdatei hat **nun** nachfolgenden Inhalt und **muss __zwingend__ angepasst werden**!
 +
 +(**Komplette Konfigurationsdatei:**)
 +
 +<code c>
 +/*
 + * 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
 + * server10.idmz.tachtler.net
 + */
 +
 +object Endpoint "server10.idmz.tachtler.net" {
 + host = "192.168.0.10";
 + port = "5665";
 +}
 +
 +object Zone "server10.idmz.tachtler.net" {
 +        endpoints = [ "server10.idmz.tachtler.net" ];
 +        parent = "master";
 +}
 +
 +</code>
 +
 +===== Nützliche Befehle =====
 +
 +Nachfolgend einige nützliche Befehle:
 +
 +^ Befehl                                             ^ Erklärung ^
 +| <code>icinga daemon -C</code>                      | Überprüfen der Konfiguration auf Fehler           |
 +| <code>icinga2 object list --type Host</code>       | Listet alle Host und alle Parameter dazu auf      |
 +| <code>icinga2 object list --type Service</code>    | Listet alle Services und alle Parameter dazu auf  |
 +| <code>icinga2 object list --name "Namen..."</code> | Listet alle Objekte mit dem angegebenen Namen auf |
  
tachtler/icinga2_-_grundkonfiguration.1449139039.txt.gz · Zuletzt geändert: 2015/12/03 11:37 von klaus