Installation Icinga per Hand
Vorbereitung der DB
apt install mariadb-server -y
mysql_secure_installation
!!! danger "Wichtig" Bei der Frage, ob für root die Unix Authentifizierung aktiviert werden soll, unbedingt y für Ja eingeben.
mysql
-- Erstellen der Icinga-DB
create database icingadb ;
create user 'icingadb'@'localhost' identified by 'icingadb';
grant all privileges on icingadb.* to 'icingadb'@'localhost';
-- Erstellen der Icinga-WebDB
create database icingaweb2;
create user 'icingaweb2'@'localhost' identified by 'icingaweb2';
grant all privileges on icingaweb2.* to 'icingaweb2'@'localhost';
-- Privilegien neu laden und beenden
flush privileges;
exit;
Repo installieren
apt update
apt -y install apt-transport-https wget gnupg
wget -O - https://packages.icinga.com/icinga.key | gpg --dearmor -o /usr/share/keyrings/icinga-archive-keyring.gpg
DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \
echo "deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/debian icinga-${DIST} main" > \
/etc/apt/sources.list.d/${DIST}-icinga.list
echo "deb-src [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/debian icinga-${DIST} main" >> \
/etc/apt/sources.list.d/${DIST}-icinga.list
apt update
apt install icinga2 -y
!!! info "Validierung der Konfiguration" An dieser Stelle (und auch später) kann die Konfiguration geprüft werden.
icinga2 daemon -C
Installation der Standard Plugins
apt install monitoring-plugins -y
Aktivierung der API
icinga2 api setup
Danach Neustart von icinga
systemctl restart icinga2
Aufsetzen von ICINGA-DB
!!! info Das ist ein neueres Feature, soll die Last von der bisherigen IDO-DB nehmen.
Installation Redis-Package und Start des Dienstes
apt install icingadb-redis -y
# systemctl enable --now icingadb-redis # Offenbar hat sich der Name geändert daher ...
systemctl enable --now icingadb-redis-server
Aktivieren des ICINGA-DB-Features
icinga2 feature enable icingadb
icinga2 feature list
systemctl restart icinga2.service
Installieren des ICINGA-DB Daemons
!!! info
Der und Datenbank.ICINGA-DB-Daemon synchronisiert die Monitoring-Daten zwischen REDIS
Paket installieren
apt install icingadb -y
Einrichtung
Zuerst Datenbank und Nutzer einrichten (siehe SQL am Anfang).
Danach das Schema laden.
mysql -u root icingadb </usr/share/icingadb/schema/mysql/schema.sql
Anpassung der Konfiguration /etc/icingadb/config.yml
database:
type: mysql
host: localhost
database: icingadb
user: icingadb
password: xxxxxxxxxxx
redis:
host: localhost
port: 6380
logging:
options:
retention:
history-days: 180
sla-days: 180
options:
Zum Abschluss Start des Dienstes
systemctl enable --now icingadb
Installation DB WEB
!!! warning
Die vorherige Installation von auch
php-fpm ist wichtig, da sonst bei der Installation von icingadb-web als Abhängigkeit mit bringt.php installiert wird, welches auch apache2
apt install php-fpm nginx -y
apt install icingadb-web -y
Installation Icinga Web
Erstellen einer Nginx Konfigurationsdatei
icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public > /etc/nginx/conf.d/icinga.conf
Jetzt noch default Config von nginx löschen:
rm -rf /etc/nginx/sites-enabled/default
Die Datei ist noch zu folgendem Stand anzupassen:
server {
listen *:80 default_server;
server_name _;
# nagvis inkl. php
location /nagvis {
alias /usr/share/nagvis/share;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
### INSTALLER START
location ~ ^/icingaweb2/index\.php(.*)$ {
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/run/php/php-fpm.sock ;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/share/icingaweb2/public/index.php;
fastcgi_param ICINGAWEB_CONFIGDIR /etc/icingaweb2;
fastcgi_param REMOTE_USER $remote_user;
}
location ~ ^/icingaweb2(.+)? {
alias /usr/share/icingaweb2/public;
index index.php;
try_files $1 $uri $uri/ /icingaweb2/index.php$is_args$args;
}
###INSTALLER END
}
Neustart Nginx
systemctl restart nginx
Erstellung des Setup-Token
Den Token in einen Texteditor kopieren. Dieser wird dann später während der Einrichtung in der Weboberfläche benötigt.
icingacli setup token create
icingacli setup token show
Erstellen der DB
Siehe sql am Anfang
Webinstaller
Vorab das Log-Verzeichnis anlegen
chown www-data /var/log/icingaweb2/
apt install php-imagick -y
- Aufruf von http.../icingaweb2/setup/
- Modules Nur icingadb kein Monitoring
- Requirements Alles ok
- Authentication
- Type: Database
- Database-Ressource
- DB-Name: icingaweb2
- Authentication-Backend
- Backend Name: icingaweb2 (Automatisch)
- Administration Erstellung des Admin-Nutzers
- Application Configuration
- Logging-Type: File (/var/log/icingaweb2/icingaweb2.log)
- Icinga DB Ressource
- Database Name: icingadb
- Icinga DB Redis
- Redis Host: localhost
- Icinga 2 API
- Host: localhost
- API Username: root (siehe /etc/icinga2/conf.d/api-users.conf)
Director Installation
GIT-Client installieren
apt install git -y
Datenbank anlegen
mysql -e "CREATE DATABASE director CHARACTER SET 'utf8';
CREATE USER director@localhost IDENTIFIED BY 'director';
GRANT ALL ON director.* TO director@localhost;"
Icingaweb2 Modul installieren
cd /usr/share/icingaweb2/modules
git clone https://github.com/Icinga/icingaweb2-module-director.git director
icingacli module enable director
MySQL Schema importieren
mysql -u director -pdirector director < /usr/share/icingaweb2/modules/director/schema/mysql.sql
User anlegen
useradd -r -g icingaweb2 -d /var/lib/icingadirector -s /bin/false icingadirector
install -d -o icingadirector -g icingaweb2 -m 0750 /var/lib/icingadirector
Service installieren und aktivieren
MODULE_PATH=/usr/share/icingaweb2/modules/director
cp "${MODULE_PATH}/contrib/systemd/icinga-director.service" /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now icinga-director.service
Installation Incubator
MODULE_NAME=incubator
MODULE_VERSION=v0.22.0
REPO="https://github.com/Icinga/icingaweb2-module-${MODULE_NAME}"
MODULES_PATH="/usr/share/icingaweb2/modules"
git clone ${REPO} "${MODULES_PATH}/${MODULE_NAME}" --branch "${MODULE_VERSION}"
icingacli module enable "${MODULE_NAME}"
!!! Info Jetzt den Rechner neu starten. Zum Schluss die Konfiguration über die Webseite beenden.
Nach dem Neustart einen Browser mit der Icinga2 URL aufrufen http://HOSTNAME/icingaweb2/
Dort hinein den Token aus der Textdatei kopieren.


Sollte in den Installationsschritten alles beachtet worden sein, so müssten hier alle Checks ein deutliches Grün aufweisen. :nerd_face:









Die Zugangsdaten für den API User sind unter:
cat /etc/icinga2/conf.d/api-users.conf

So soll es aussehen, dann klappts auch mit dem Monitoring.

Nach der ersten Anmeldung muss noch der Import für die IcingaDB ausgeführt werden.

Im nächsten Step aus dem Dropdown Menü die Icingadb und das Datenbankschema erstellen auswählen.


Graphite Installation
Installation Docker
# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Docker pull Graphite
docker pull graphiteapp/graphite-statsd
Start Docker Container
docker run -d --name graphite --restart=always -p 8090:80 -p 2003-2004:2003-2004 -p 2023-2024:2023-2024 -p 8125:8125/udp -p 8126:8126 graphiteapp/graphite-statsd
Automatischer Start Docker Container
Hier muss noch das Start Script für den automatischen Start des Containers rein /etc/systemd/system/...
Installation Icingaweb2 Modul
cd /usr/share/icingaweb2/modules
git clone https://github.com/Icinga/icingaweb2-module-graphite.git graphite
Installation der icinga-php-library V.0.13.0
apt install icinga-php-library
Modul Graphite Backend konfigurieren

/etc/icinga2/features-enabled
object GraphiteWriter "graphite" {
host = "192.0.2.42"
port = 2003
enable_send_thresholds = true
}
Zertifikatsmonitoring
Datenbank vorbereiten
create database x509;
GRANT CREATE, SELECT, INSERT, UPDATE, DELETE, DROP, ALTER, CREATE VIEW, INDEX, EXECUTE ON x509.* TO x509@localhost IDENTIFIED BY 'x509';
Icingaweb2 herunterladen
cd /usr/share/icingaweb2/modules
git clone https://github.com/Icinga/icingaweb2-module-x509.git x509
- Admin Menü -> Application

- Create new Ressource

- Datenbank Konfiguration

- Modul x509 aktivieren

- Backend Menü -> Auswahl x509

Nagvis Installation
Nagvis download (tar.gz Archiv) von Nagvis Downloadseite
tar -xvf nagvis-x.x.xx.tar.gz
Nagvis Ordner umbenennen
mv nagvis-x.x.xx/ nagvis/
Icinga Livestatus aktivieren
icinga2 feature enable livestatus
systemctl restart icinga2
Nagvis Konfiguration anpassen
nano /usr/share/nagvis/etc/nagvis.ini.php
# Folgendes unter [global] einfügen
[paths]
base="/usr/share/nagvis/"
htmlbase="/nagvis"
htmlcgi="/icingaweb2"
[defaults]
backend="icinga"
Nagvis Backend in derselben Konfiguration weiter unten definieren
[backend_icinga]
backendtype="mklivestatus"
socket="unix:/run/icinga2/cmd/livestatus"
Nagvis Icinga Modul installieren und aktivieren
cd /usr/share/icingaweb2/modules
git clone https://github.com/Icinga/icingaweb2-module-nagvis.git nagvis
icingacli module enable nagvis
Incubator Installation
Installation über Git und Aktivierung über die icingacli
MODULE_NAME=incubator
MODULE_VERSION=master
REPO="https://github.com/Icinga/icingaweb2-module-${MODULE_NAME}"
MODULES_PATH="/usr/share/icingaweb2/modules"
git clone ${REPO} "${MODULES_PATH}/${MODULE_NAME}" --branch "${MODULE_VERSION}"
icingacli module enable "${MODULE_NAME}"
Cube Installation
Installation über Git und Aktivierung über die icingacli
MODULE_NAME="cube"
MODULE_VERSION="main"
REPO="https://github.com/Icinga/icingaweb2-module-${MODULE_NAME}"
MODULES_PATH="/usr/share/icingaweb2/modules"
git clone ${REPO} "${MODULES_PATH}/${MODULE_NAME}" --branch "${MODULE_VERSION}"
icingacli module enable "${MODULE_NAME}"
vSphereDB Installation
Installation über Git und Aktivierung über die icingacli
MODULE_NAME="vspheredb"
MODULE_VERSION="master"
REPO="https://github.com/Icinga/icingaweb2-module-${MODULE_NAME}"
MODULES_PATH="/usr/share/icingaweb2/modules"
git clone ${REPO} "${MODULES_PATH}/${MODULE_NAME}" --branch "${MODULE_VERSION}"
icingacli module enable "${MODULE_NAME}"
vSphereDB erstellen
mysql -e "CREATE DATABASE vspheredb CHARACTER SET 'utf8mb4' COLLATE utf8mb4_bin;
CREATE USER vspheredb@localhost IDENTIFIED BY 'vspheredb';
GRANT ALL ON vspheredb.* TO vspheredb@localhost;
FLUSH PRIVILEGES;"
DB in Icinga hinzufügen
- Unter "/icingaweb2/config/resource" eine neue DB hinzufügen und unter Character Set "utf8mb4" setzten.
- Jetzt unter "/icingaweb2/vspheredb/configuration/database" die Datenbank auswählen und initialisieren lassen.