Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
centos:web_c7:icinga:start [20.02.2017 17:10. ] – Icinga2 [Programm- und Verzeichnisse] #CentOS7 #Icinga2 djangocentos:web_c7:icinga:start [30.05.2020 17:30. ] (aktuell) django
Zeile 1: Zeile 1:
 ====== IT Infrastruktur und System Monitoring mit Icinga 2 unter CentOS 7.x ====== ====== IT Infrastruktur und System Monitoring mit Icinga 2 unter CentOS 7.x ======
-{{:centos:web_c7:icinga:icinga_logo.png?nolink&200 |Bild: ICINGA Logo}} +{{page>centos:web_c7:icinga:uebersicht&nofooter&noheader}}
- Mit [[https://www.icinga.org/|Icinga]] kann man sehr leicht und einfach umfangreiche und komplexe IT-Infrastrukturen und Dienste überwachen. Icinga bietet umfassende Überwachungs- und Alarmfunktionen für Server, Switches, Anwendungen und Dienste, so dass also Störungen im Betrieb frühestmöglich erkannt und Abhilfe geschaffen werden kann. Icinga wurde im Mai 2009 von einer Gruppe von Nagios-Entwicklern als ein Fork von [[centos:web_c7:nagios1|Nagios]] ins Leben gerufen und seit dem rasant weiterentwickelt.+
  
-Tiefergehende Informationen zu Icinga selbst findet man auf der [[https://www.icinga.org/icinga/icinga-2/features/|Icinga 2 - Features Seite]] im WWW. Eine detaillierte [[http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc +{{page>centos:web_c7:icinga:inhalt&nofooter&noheader}}
-|Installations- und Konfigurationsbeschreibung]], die bei der Erstellung dieser Installationsdokumentation wertvolle Hilfe geleistet hat, ist dort ebenfalls zu finden! +
- +
-===== Installation ===== +
-Die Installation von **ICINGA** selbst gestaltet sich relativ einfach, da die Entwickler unter anderem für **CentOS 7** ein eigenes Repository vorgehalten wird.  +
- +
-==== ICINGA-Repository ==== +
-Als Vorbereitung vor der Installation von icinga2 müssen wir erst einmal das benötigte Repository einbinden. Hierzu holen wir uns die Konfigurationsdatei erst einmal auf unseren Server. +
-   # wget http://packages.icinga.org/epel/ICINGA-release.repo -O /etc/yum.repos.d/ICINGA-release.repo +
- +
-Anschließend tragen wir noch die **Priorität** in der Konfigurationsdatei nach; in unserer Installationsumgebung wählen wir dazu einen nachrangigen wert, z.B. **15** +
-   # vim /etc/yum.repos.d/ICINGA-release.repo +
- +
-<file bash /etc/yum.repos.d/ICINGA-release.repo>[icinga-stable-release] +
-name=ICINGA (stable release for epel) +
-baseurl=http://packages.icinga.org/epel/$releasever/release/ +
-enabled=1 +
-# Django : 2015-03-07 Priorität 15 nachgetragen +
-# default: unset +
-priority=15 +
-gpgcheck=1 +
-gpgkey=http://packages.icinga.org/icinga.key +
-</file> +
- +
-Anschließend weisen wir **yum** an, alle Metadaten des neuen Repositorys zu laden. +
-   # yum makecache +
- +
-Zu guter Letzt holen wir uns noch den PGP-Schlüssel des ICINGA-Repositorys, damit später bei der Installation der einzelnen Pakete diese überprüft werden können. +
-   # rpm --import http://packages.icinga.org/icinga.key +
- +
-==== ICINGA2 ==== +
-Nachdem die Vorbereitungen abgeschlossen sind, können wir nun mit der Installation von **ICINGA2** starten, indem wir den Befehl **yum** bemühen. +
-   # yum install icinga2 -y +
- +
-Neben dem Paket **icinga2**, werden auch noch die Pakete **icinga2-common**, **icinga2-bin** und icinga2-libs installiert. +
- +
-==== Monitoring Plugins ==== +
-Am Monitoring-Server installieren wir uns auch noch die Nagios Plugins, damit wir für spätere Tests- und Monitoring-Aktionen darauf zurück greifen können. +
-   # yum install nagios-plugins-all -y +
- +
- +
- +
-===== Paketinhalte ===== +
-==== icinga2 ==== +
-Welche Verzeichnisse und Dateien das Paket installierte, erfahren wir mit dem nachfolgendem Aufruf. +
-   # rpm -qil icinga2 +
- +
-<code>Name        : icinga2 +
-Version     : 2.6.2 +
-Release     : 1.el7.centos +
-Architecture: x86_64 +
-Install Date: Mon 20 Feb 2017 05:56:16 PM CET +
-Group       : Applications/System +
-Size        : 17986 +
-License     : GPL-2.0+ +
-Signature   : DSA/SHA1, Mon 13 Feb 2017 01:42:27 PM CET, Key ID c6e319c334410682 +
-Source RPM  : icinga2-2.6.2-1.el7.centos.src.rpm +
-Build Date  : Mon 13 Feb 2017 01:42:07 PM CET +
-Build Host  : 90c74ef910b1 +
-Relocations : (not relocatable) +
-URL         : https://www.icinga.com/ +
-Summary     : Network monitoring application +
-Description : +
-Meta package for Icinga 2 Core, DB IDO and Web. +
-/usr/share/doc/icinga2-2.6.2 +
-/usr/share/doc/icinga2-2.6.2/COPYING +
-</code> +
- +
-==== icinga2-common ==== +
-Wie schon zuvor prüfen wir, welchen Inhalt das RPM mitbrachte. +
-   # rpm -qil icinga2-common +
-<code>Name        : icinga2-common +
-Version     : 2.6.2 +
-Release     : 1.el7.centos +
-Architecture: x86_64 +
-Install Date: Mon 20 Feb 2017 05:56:15 PM CET +
-Group       : Applications/System +
-Size        : 400604 +
-License     : GPL-2.0+ +
-Signature   : DSA/SHA1, Mon 13 Feb 2017 01:42:27 PM CET, Key ID c6e319c334410682 +
-Source RPM  : icinga2-2.6.2-1.el7.centos.src.rpm +
-Build Date  : Mon 13 Feb 2017 01:42:07 PM CET +
-Build Host  : 90c74ef910b1 +
-Relocations : (not relocatable) +
-URL         : https://www.icinga.com/ +
-Summary     : Common Icinga 2 configuration +
-Description : +
-Provides common directories, uid and gid among Icinga 2 related +
-packages. +
-/etc/bash_completion.d/icinga2 +
-/etc/icinga2 +
-/etc/icinga2/conf.d +
-/etc/icinga2/conf.d/app.conf +
-/etc/icinga2/conf.d/commands.conf +
-/etc/icinga2/conf.d/downtimes.conf +
-/etc/icinga2/conf.d/groups.conf +
-/etc/icinga2/conf.d/hosts.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 +
-/etc/icinga2/constants.conf +
-/etc/icinga2/features-available +
-/etc/icinga2/features-available/api.conf +
-/etc/icinga2/features-available/checker.conf +
-/etc/icinga2/features-available/command.conf +
-/etc/icinga2/features-available/compatlog.conf +
-/etc/icinga2/features-available/debuglog.conf +
-/etc/icinga2/features-available/gelf.conf +
-/etc/icinga2/features-available/graphite.conf +
-/etc/icinga2/features-available/influxdb.conf +
-/etc/icinga2/features-available/livestatus.conf +
-/etc/icinga2/features-available/mainlog.conf +
-/etc/icinga2/features-available/notification.conf +
-/etc/icinga2/features-available/opentsdb.conf +
-/etc/icinga2/features-available/perfdata.conf +
-/etc/icinga2/features-available/statusdata.conf +
-/etc/icinga2/features-available/syslog.conf +
-/etc/icinga2/features-enabled +
-/etc/icinga2/icinga2.conf +
-/etc/icinga2/init.conf +
-/etc/icinga2/repository.d +
-/etc/icinga2/repository.d/README +
-/etc/icinga2/scripts +
-/etc/icinga2/scripts/mail-host-notification.sh +
-/etc/icinga2/scripts/mail-service-notification.sh +
-/etc/icinga2/zones.conf +
-/etc/icinga2/zones.d +
-/etc/icinga2/zones.d/README +
-/etc/logrotate.d/icinga2 +
-/etc/sysconfig/icinga2 +
-/usr/lib/icinga2 +
-/usr/lib/icinga2/prepare-dirs +
-/usr/lib/icinga2/safe-reload +
-/usr/lib/systemd/system/icinga2.service +
-/usr/share/doc/icinga2-common-2.6.2 +
-/usr/share/doc/icinga2-common-2.6.2/AUTHORS +
-/usr/share/doc/icinga2-common-2.6.2/COPYING +
-/usr/share/doc/icinga2-common-2.6.2/COPYING.Exceptions +
-/usr/share/doc/icinga2-common-2.6.2/ChangeLog +
-/usr/share/doc/icinga2-common-2.6.2/NEWS +
-/usr/share/doc/icinga2-common-2.6.2/README.md +
-/usr/share/doc/icinga2-common-2.6.2/syntax +
-/usr/share/doc/icinga2-common-2.6.2/syntax/nano +
-/usr/share/doc/icinga2-common-2.6.2/syntax/nano/icinga2.nanorc +
-/usr/share/doc/icinga2-common-2.6.2/syntax/vim +
-/usr/share/doc/icinga2-common-2.6.2/syntax/vim/ftdetect +
-/usr/share/doc/icinga2-common-2.6.2/syntax/vim/ftdetect/icinga2.vim +
-/usr/share/doc/icinga2-common-2.6.2/syntax/vim/syntax +
-/usr/share/doc/icinga2-common-2.6.2/syntax/vim/syntax/icinga2.vim +
-/usr/share/icinga2/include +
-/usr/share/icinga2/include/command-icinga.conf +
-/usr/share/icinga2/include/command-nscp-local.conf +
-/usr/share/icinga2/include/command-plugins-manubulon.conf +
-/usr/share/icinga2/include/command-plugins-windows.conf +
-/usr/share/icinga2/include/command-plugins.conf +
-/usr/share/icinga2/include/hangman +
-/usr/share/icinga2/include/itl +
-/usr/share/icinga2/include/manubulon +
-/usr/share/icinga2/include/nscp +
-/usr/share/icinga2/include/plugins +
-/usr/share/icinga2/include/plugins-contrib +
-/usr/share/icinga2/include/plugins-contrib.d +
-/usr/share/icinga2/include/plugins-contrib.d/databases.conf +
-/usr/share/icinga2/include/plugins-contrib.d/hardware.conf +
-/usr/share/icinga2/include/plugins-contrib.d/icingacli.conf +
-/usr/share/icinga2/include/plugins-contrib.d/ipmi.conf +
-/usr/share/icinga2/include/plugins-contrib.d/logmanagement.conf +
-/usr/share/icinga2/include/plugins-contrib.d/metrics.conf +
-/usr/share/icinga2/include/plugins-contrib.d/network-components.conf +
-/usr/share/icinga2/include/plugins-contrib.d/network-services.conf +
-/usr/share/icinga2/include/plugins-contrib.d/operating-system.conf +
-/usr/share/icinga2/include/plugins-contrib.d/storage.conf +
-/usr/share/icinga2/include/plugins-contrib.d/virtualization.conf +
-/usr/share/icinga2/include/plugins-contrib.d/vmware.conf +
-/usr/share/icinga2/include/plugins-contrib.d/web.conf +
-/usr/share/icinga2/include/windows-plugins +
-/var/log/icinga2 +
-/var/spool/icinga2 +
-/var/spool/icinga2/perfdata +
-/var/spool/icinga2/tmp</code> +
- +
-==== icinga2-libs ==== +
-Als Paketabhängigkeit wurden die icinga2-Bibliotheken **icinga2-libs** installiert. +
-   # rpm -qil icinga2-libs +
- +
-<code>Name        : icinga2-libs +
-Version     : 2.6.2 +
-Release     : 1.el7.centos +
-Architecture: x86_64 +
-Install Date: Mon 20 Feb 2017 05:56:16 PM CET +
-Group       : Applications/System +
-Size        : 11042903 +
-License     : GPL-2.0+ +
-Signature   : DSA/SHA1, Mon 13 Feb 2017 01:42:28 PM CET, Key ID c6e319c334410682 +
-Source RPM  : icinga2-2.6.2-1.el7.centos.src.rpm +
-Build Date  : Mon 13 Feb 2017 01:42:07 PM CET +
-Build Host  : 90c74ef910b1 +
-Relocations : (not relocatable) +
-URL         : https://www.icinga.com/ +
-Summary     : Libraries for Icinga 2 +
-Description : +
-Provides internal libraries for the daemon or studio. +
-/usr/lib64/icinga2 +
-/usr/lib64/icinga2/libbase.so +
-/usr/lib64/icinga2/libbase.so.2.6.2 +
-/usr/lib64/icinga2/libchecker.so +
-/usr/lib64/icinga2/libchecker.so.2.6.2 +
-/usr/lib64/icinga2/libcli.so +
-/usr/lib64/icinga2/libcli.so.2.6.2 +
-/usr/lib64/icinga2/libcompat.so +
-/usr/lib64/icinga2/libcompat.so.2.6.2 +
-/usr/lib64/icinga2/libconfig.so +
-/usr/lib64/icinga2/libconfig.so.2.6.2 +
-/usr/lib64/icinga2/libdb_ido.so +
-/usr/lib64/icinga2/libdb_ido.so.2.6.2 +
-/usr/lib64/icinga2/libexecvpe.so +
-/usr/lib64/icinga2/libexecvpe.so.2.6.2 +
-/usr/lib64/icinga2/libicinga.so +
-/usr/lib64/icinga2/libicinga.so.2.6.2 +
-/usr/lib64/icinga2/liblivestatus.so +
-/usr/lib64/icinga2/liblivestatus.so.2.6.2 +
-/usr/lib64/icinga2/libmethods.so +
-/usr/lib64/icinga2/libmethods.so.2.6.2 +
-/usr/lib64/icinga2/libmmatch.so +
-/usr/lib64/icinga2/libmmatch.so.2.6.2 +
-/usr/lib64/icinga2/libnotification.so +
-/usr/lib64/icinga2/libnotification.so.2.6.2 +
-/usr/lib64/icinga2/libperfdata.so +
-/usr/lib64/icinga2/libperfdata.so.2.6.2 +
-/usr/lib64/icinga2/libremote.so +
-/usr/lib64/icinga2/libremote.so.2.6.2 +
-/usr/lib64/icinga2/libsocketpair.so +
-/usr/lib64/icinga2/libsocketpair.so.2.6.2 +
-/usr/share/doc/icinga2-libs-2.6.2 +
-/usr/share/doc/icinga2-libs-2.6.2/AUTHORS +
-/usr/share/doc/icinga2-libs-2.6.2/COPYING +
-/usr/share/doc/icinga2-libs-2.6.2/COPYING.Exceptions +
-/usr/share/doc/icinga2-libs-2.6.2/ChangeLog +
-/usr/share/doc/icinga2-libs-2.6.2/NEWS +
-/usr/share/doc/icinga2-libs-2.6.2/README.md</code> +
- +
-==== icinga2-bin ==== +
-Zum Schluß werfen wir dann noch einen Blick in das Paket **icinga2-bin**. +
-   # rpm -qil icinga2-bin +
- +
-<code>Version     : 2.6.2 +
-Release     : 1.el7.centos +
-Architecture: x86_64 +
-Install Date: Mon 20 Feb 2017 05:56:16 PM CET +
-Group       : Applications/System +
-Size        : 284451 +
-License     : GPL-2.0+ +
-Signature   : DSA/SHA1, Mon 13 Feb 2017 01:42:27 PM CET, Key ID c6e319c334410682 +
-Source RPM  : icinga2-2.6.2-1.el7.centos.src.rpm +
-Build Date  : Mon 13 Feb 2017 01:42:07 PM CET +
-Build Host  : 90c74ef910b1 +
-Relocations : (not relocatable) +
-URL         : https://www.icinga.com/ +
-Summary     : Icinga 2 binaries and libraries +
-Description : +
-Icinga 2 is a general-purpose network monitoring application. +
-Provides binaries for Icinga 2 Core. +
-/run/icinga2 +
-/run/icinga2/cmd +
-/usr/lib64/icinga2/sbin +
-/usr/lib64/icinga2/sbin/icinga2 +
-/usr/sbin/icinga2 +
-/usr/share/doc/icinga2-bin-2.6.2 +
-/usr/share/doc/icinga2-bin-2.6.2/AUTHORS +
-/usr/share/doc/icinga2-bin-2.6.2/COPYING +
-/usr/share/doc/icinga2-bin-2.6.2/COPYING.Exceptions +
-/usr/share/doc/icinga2-bin-2.6.2/ChangeLog +
-/usr/share/doc/icinga2-bin-2.6.2/NEWS +
-/usr/share/doc/icinga2-bin-2.6.2/README.md +
-/usr/share/icinga2 +
-/usr/share/man/man8/icinga2.8.gz +
-/var/cache/icinga2 +
-/var/lib/icinga2 +
-/var/lib/icinga2/api +
-/var/lib/icinga2/api/log +
-/var/lib/icinga2/api/repository +
-/var/lib/icinga2/api/zones +
-/var/log/icinga2 +
-/var/log/icinga2/compat +
-/var/log/icinga2/compat/archives +
-/var/log/icinga2/crash</code> +
- +
-===== Systemstart ===== +
-==== erster manueller Start ==== +
-Nun können wir den Icinga2-Daemon das erste mal starten. +
-   # systemctl start icinga2.service +
- +
-Im Syslog wird der Start entsprechend dokumentiert. +
-   # less /var/log/messages +
-<file /var/log/messages>Feb 20 18:04:27 vml000117 systemd: Starting Icinga host/service/network monitoring system... +
-Feb 20 18:04:27 vml000117 systemd: Started Icinga host/service/network monitoring system.</file> +
- +
-==== automatischer Start beim Systemstart ==== +
-Wollen wir den Daemon beim Hochfahren des Systems automatisch starten, greifen wir auf den Befehl **systemctl** zurück.  +
-   # systemctl enable icinga2.service +
- +
-   # ln -s '/usr/lib/systemd/system/icinga2.service' '/etc/systemd/system/multi-user.target.wants/icinga2.service' +
-    +
- Möchten wir uns vergewissern, ob der Daemon beim Systemstart gestartet wird oder nicht, erfahren wir ebenfalls mit dem Befehl **systemctl**. +
-   # systemctl is-enabled icinga2.service +
- +
-   enabled +
- +
-Startet der Server nicht automatisch, wird uns ein "**disabled**" zurückgemeldet. +
- +
-===== Systemtest ===== +
-Wollen wir den Status eines gerade laufenden Icinga2-Daemon abfragen, verwenden wir folgenden Aufruf. +
-   # systemctl status icinga2.service +
- +
-<html><pre class="code"> +
-<font style="color: rgb(0, 255, 0)"><b>● </b></font><font style="color: rgb(0, 0, 0)">icinga2.service - Icinga host/service/network monitoring system +
-   Loaded: loaded (/usr/lib/systemd/system/icinga2.service; enabled; vendor preset: disabled) +
-   Active: <font style="color: rgb(0, 255, 0)"><b>active (running) </b></font><font style="color: rgb(0, 0, 0)">since Mon 2017-02-20 18:04:27 CET; 2min 0s ago +
- Main PID: 2179 (icinga2) +
-   CGroup: /system.slice/icinga2.service +
-           ├─2176 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon -d -e /var/log/icinga2/error.log +
-           └─2179 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon -d -e /var/log/icinga2/error.log +
- +
-Feb 20 18:04:27 vml000117.dmz.nausch.org systemd[1]: Starting Icinga host/service/network monitoring system... +
-Feb 20 18:04:27 vml000117.dmz.nausch.org systemd[1]: Started Icinga host/service/network monitoring system.</font> +
-</pre></html> +
- +
- +
-===== Konfiguration ===== +
-==== Programm- und Verzeichnisse ==== +
-Bevor wir uns nun mit der Konfiguration von Icinga beschäftigen werfen wir noch kurz einen Blick in unser Dateisystem auf unserem Monitoring-Host. +
- +
-<code> +
-Pfad/Datei                          Beschreibung +
-/etc/icinga2                          Icinga 2 Konfigurationsverzeichnisse und -Dateien +
-/usr/sbin/icinga2                   Icinga 2 binary. +
-/usr/lib/systemd/system/icinga2.service  Systemd Startdatei von Icinga 2 +
-/usr/share/doc/icinga2                  ausführliche Programm und Installations- und  +
-                                         Konfigurationsdokumentation von Icinga 2.  +
-                                         (aus dem Paket icinga2-doc) +
-/usr/share/icinga2/include               Icinga Vorlagen sowie plugin command Konfigurationsmuster. +
-/var/run/icinga2                  PID Datei des laufenden Icinga 2 Daemon +
-/var/run/icinga2/cmd                  Command Pipe und Livestatus Socket. +
-/var/cache/icinga2                  Verzeichnis für status.dat, objects.cache und Icinga2.debug  +
-                                         Dateien. +
-/var/spool/icinga2                  Spooling-Verzeichnis für die Performance Daten. +
-/var/lib/icinga2                  Icinga 2 Stausdatei, Cluster Log und Dateien der Lokalen CA. +
-/var/log/icinga2                  Logverzeichnis für Icinga 12 und dem CompatLogger. +
-</code> +
- +
-Im Verzeichnis //**/etc/icinga2/**// finden wir auch schon die Basiskonfigurationsdatein, mit denen wir zuvor den Icinga2-Daemon angestartet haben. +
-<code>/etc/icinga2/ +
-├── conf.d +
-│   ├── app.conf +
-│   ├── commands.conf +
-│   ├── downtimes.conf +
-│   ├── groups.conf +
-│   ├── hosts.conf +
-│   ├── notifications.conf +
-│   ├── satellite.conf +
-│   ├── services.conf +
-│   ├── templates.conf +
-│   ├── timeperiods.conf +
-│   └── users.conf +
-├── constants.conf +
-├── features-available +
-│   ├── api.conf +
-│   ├── checker.conf +
-│   ├── command.conf +
-│   ├── compatlog.conf +
-│   ├── debuglog.conf +
-│   ├── gelf.conf +
-│   ├── graphite.conf +
-│   ├── influxdb.conf +
-│   ├── livestatus.conf +
-│   ├── mainlog.conf +
-│   ├── notification.conf +
-│   ├── opentsdb.conf +
-│   ├── perfdata.conf +
-│   ├── statusdata.conf +
-│   └── syslog.conf +
-├── features-enabled +
-│   ├── checker.conf -> ../features-available/checker.conf +
-│   ├── mainlog.conf -> ../features-available/mainlog.conf +
-│   └── notification.conf -> ../features-available/notification.conf +
-├── icinga2.conf +
-├── init.conf +
-├── repository.d +
-│   └── README +
-├── scripts +
-│   ├── mail-host-notification.sh +
-│   └── mail-service-notification.sh +
-├── zones.conf +
-└── zones.d +
-    └── README</code> +
- +
-===== Icinga 2 Featurelist ===== +
-Mit welchen Funktionen unser laufender Icinga-Daemon ausgestattet ist und welche bereits aktiviert wurden, zeigt nachfolgender Aufruf. +
-   # icinga2 feature list +
- +
-<html><pre class="code"> +
-<font style="color: rgb(255, 0, 0)"><b>Disabled features:</b></font><font style="color: rgb(0, 0, 0)"> api command compatlog debuglog gelf graphite icingastatus ido-mysql ido-pgsql livestatus perfdata statusdata syslog</font> +
-<font style="color: rgb(0, 255, 0)"><b>Enabled features:</b></font><font style="color: rgb(0, 0, 0)"> checker mainlog notification</font> +
-</pre></html> +
- +
-===== Hilfsmittel bei der Konfiguration ===== +
-Bei der Bearbeitung der Icinga2 Konfigurationsdateien, ist es ungemein hilfreich, wenn schon bei der Bearbeitung Fehler erkannt und berichtigt werden können. +
- +
-==== syntax-highlighting ==== +
-Eine dieser hilfreichen Optionen ist das Syntax-Highlighting. Im Paket **icinga2-common** wurden dazu die benötigten Dateien mitgeliefert. Diese werden wir nun dem Nutzer zur Verfügung stellen, der mit der Bearbeitung der Dateien betraut sein wird. +
- +
-Als erstes legen wir uns im Homeverzeichnis unseres Users die benötigten Verzeichnisse an. +
-   # PREFIX=~/.vim +
-   # mkdir -p $PREFIX/{syntax,ftdetect} +
- +
-Anschliessend kopieren wir die beiden Vorlagen aus dem RPM-Paket an Ort und Stelle. +
-   # cp /usr/share/doc/icinga2-common*/syntax/vim/syntax/icinga2.vim $PREFIX/syntax/ +
-   # cp /usr/share/doc/icinga2-common*/syntax/vim/ftdetect/icinga2.vim $PREFIX/ftdetect/ +
- +
-Rufen wir nun mit unserem Editor der Wahl - eben **vim** - eine ICINGA-Konfigurationsdatei auf, so wird der SYNTAX in der Datei farbig dargestellt, was die Lesbarkeit doch erheblich steigert und somit sollten Fehler nicht mehr so häufig passieren, als bei einem durchgehenden Fließtext. +
- +
-   # vim /etc/icinga2/conf.d/templates.conf +
- +
-{{ :centos:web_c7:icinga:icinga_001.png?direct&400 |Bild: ICINGA Konfigurationstext mit syntax-highlighting}} +
- +
-==== CLI Bash Autocompletion ==== +
-Bei der Installation des RPM_Paketes **icinga2-common** wurde für die //**CLI Bash Autocompletion**// bereits die passende Konfigurationsdatei an Ort und Stelle kopiert. Damit die Funktion auch genutzt werden kann, muss das Paket **bash-completion** installiert sein. Sollte das Paket nicht bei der Installation des ICINGA-Hosts bereits installiert worden sein, können wir dies nun nachholen. +
-   # yum install bash-completion +
- +
-==== Konfiguration überprüfen ==== +
-Haben wir einen lauffähigen Icinga2-Host im Produktionsbetrieb und müssen an der Konfiguration des Daemon Hand anlegen, wäre es äusserst hinderlich, wenn bedingt durch syntaktische Fehler der Daemon bei einem reload bzw. Start seinen Dienst quittieren würde. +
- +
-An Hand zweier Ergebnisse testen wir nun, wie die Überprüfung der Icinga 2 Dateien erfolgen kann. Zuerst betrachten wir einen Test mit positivem Ergebnis und anschliessend einen mit negativem Ergebnis. +
- +
-=== positives Ergebnis === +
-   # /usr/sbin/icinga2 daemon -c /etc/icinga2/icinga2.conf -C +
- +
-<html><pre class="code"> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/cli: Icinga application loader (version: v2.2.4)</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/cli: Loading application type: icinga/IcingaApplication</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/Utility: Loading library 'libicinga.so'</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/icinga2.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/constants.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/zones.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/itl</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/command.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/Utility: Loading library 'libmethods.so'</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/command-icinga.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/timeperiod.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/plugins</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/command-plugins.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/checker.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/Utility: Loading library 'libchecker.so'</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/mainlog.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/notification.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/Utility: Loading library 'libnotification.so'</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/commands.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/downtimes.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/groups.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/hosts.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/notifications.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/satellite.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/services.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/templates.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/timeperiods.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/users.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Committing config items</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Evaluating 'object' rules (step 1)...</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Evaluating 'apply' rules...</font> +
-<font style="color: rgb(255, 255, 0)"><b>warning</b></font><font style="color: rgb(0, 0, 0)">/Dependency: Apply rule 'satellite-host' for host does not match anywhere!</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Evaluating 'object' rules (step 2)...</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 1 Endpoint(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 1 Zone(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 40 CheckCommand(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 2 NotificationCommand(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 3 TimePeriod(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 1 CheckerComponent(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 1 FileLogger(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 1 NotificationComponent(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 2 HostGroup(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 3 ServiceGroup(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 1 Host(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 11 Service(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 1 User(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 12 Notification(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 1 UserGroup(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 1 IcingaApplication(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigItem: Checked 1 ScheduledDowntime(s).</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ScriptVariable: Dumping variables to file '/var/cache/icinga2/icinga2.vars'</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/cli: Finished validating the configuration file(s).</font> +
-</pre></html> +
- +
-=== negatives Ergebnis === +
-Im folgendem Beispiel haben wir einmal bewußt einen Fehler in der Konfigurationsdatei //**/etc/icinga2/conf.d/downtimes.conf**// eingetragen, indem wir die Zeile mit dem **assign** Kommando auskommentiert haben. +
-   # vim  /etc/icinga2/conf.d/downtimes.conf +
- +
-<file c++  /etc/icinga2/conf.d/downtimes.conf>/** +
- * 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 != "" +
-+
-</file> +
- +
-Führen wir nun erneut eine Überprüfung der Konfiguration durch, wird uns gezeigt, wo genau "der Hase im Pfeffer begraben ist"+
-   # /usr/sbin/icinga2 daemon -c /etc/icinga2/icinga2.conf -C +
- +
-<WRAP center round info 80%> +
-Die Pfadangabe **/etc/icinga2/** können wir auch weglassen, so dass sich der Aufruf zur Übrprüfung der Konfiguration lediglich auf ''icinga2 daemon -C'' beschränkt! +
- +
-</WRAP> +
- +
-   # icinga2 daemon -C +
- +
-<html><pre class="code"> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/cli: Icinga application loader (version: v2.2.4)</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/cli: Loading application type: icinga/IcingaApplication</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/Utility: Loading library 'libicinga.so'</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/icinga2.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/constants.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/zones.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/itl</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/command.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/Utility: Loading library 'libmethods.so'</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/command-icinga.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/timeperiod.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/plugins</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/command-plugins.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/checker.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/Utility: Loading library 'libchecker.so'</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/mainlog.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/notification.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/Utility: Loading library 'libnotification.so'</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/commands.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/downtimes.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/groups.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/hosts.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/notifications.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/satellite.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/services.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/templates.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/timeperiods.conf</font> +
-<font style="color: rgb(0, 255, 0)">information</font><font style="color: rgb(0, 0, 0)">/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/users.conf</font> +
-<font style="color: rgb(255, 0, 0)"><b>critical</b></font><font style="color: rgb(0, 0, 0)">/config: Location: +
-/etc/icinga2/conf.d/downtimes.conf(3):  */ +
-/etc/icinga2/conf.d/downtimes.conf(4):  +
-/etc/icinga2/conf.d/downtimes.conf(5): apply ScheduledDowntime "backup-downtime" to Service { +
-                                       ^^^^^^^^^^^^^^^^^^^^^^^ +
-/etc/icinga2/conf.d/downtimes.conf(6):   author = "icingaadmin" +
-/etc/icinga2/conf.d/downtimes.conf(7):   comment = "Scheduled downtime for backup" +
- +
-Config error: 'apply' is missing 'assign'</font> +
-<font style="color: rgb(255, 0, 0)"><b>critical</b></font><font style="color: rgb(0, 0, 0)">/config: 1 errors, 0 warnings.</font> +
-</pre></html>+
  
 ====== Links ====== ====== Links ======
-  * **⇒ [[centos:web_c7:icinga:web2|Weiter zum Kapitel "Icinga Web 2 - Installation und Konfiguration unter CentOS 7.x"]]**+  * **⇒ [[centos:web_c7:icinga:info|Weiter zum Kapitel "Icinga 2 unter CentOS 7.x"]]** 
 +  * **[[centos:web_c7:icinga:web2|Zurück zum Kapitel "Icinga Web 2 - Installation und Konfiguration unter CentOS 7.x"]]**
   * **[[centos:web_c7:start|Zurück zum Kapitel >>Webserverinstallation unter CentOS 7.x<<]]**   * **[[centos:web_c7:start|Zurück zum Kapitel >>Webserverinstallation unter CentOS 7.x<<]]**
   * **[[wiki:start|Zurück zu >>Projekte und Themenkapitel<<]]**   * **[[wiki:start|Zurück zu >>Projekte und Themenkapitel<<]]**
   * **[[http://dokuwiki.nausch.org/doku.php/|Zurück zur Startseite]]**   * **[[http://dokuwiki.nausch.org/doku.php/|Zurück zur Startseite]]**
  
-~~DISCUSSION~~ 
-~~AUTOTWEET:~~ 
  
  • centos/web_c7/icinga/start.1487610636.txt.gz
  • Zuletzt geändert: 20.02.2017 17:10.
  • von django