Installation & Konfiguration Icinga2 unter RockyLinux 8.x

Systemvoraussetzungen

RockyLinux 8.5
Icinga 2.13.2
  1. OS relevante Konfigurationen

Abschalten SELinux /etc/sysconfig/selinux

SELINUX=disabled

Nach erfolgter Installation sollte ein Systemupdate gestartet werden

[root@localhost ~]#dnf -y update

Deaktivieren der Firewall


[root@icinga ~]#systemctl disable firewalld

Modifizieren der Hostdatei -> Eintrag des Icinga2 FQDN + IP-Adresse in der /etc/hosts

192.17.10.10    icinga.work.intra icinga

Installation Zusatzpakete - Aktivierung Repository RockyPowerTools /etc/yum.repos.d/Rocky-PowerTools.repo

[PowerTools]
...
enabled=1

Installation Epel Repository

[root@icinga ~]dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Installation zusätzlicher Pakete

dnf -y install php php-common php-fpm php-cli php-devel php-xml php-json php-pear php-intl php-dba php-pdo php-soap php-mysqlnd php-gd php-snmp php-mbstring php-pecl-zip php-pear-Date php-pear-Mail php-pear-Net-URL compat-openssl10 libnsl php-gmp ntfs-3g

dnf -y install  ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/28/Everything/x86_64/os/Packages/p/perl-Filesys-SmbClient-3.2-15.fc28.x86_64.rpm
dnf -y install  perl-Time-Duration
dnf -y install nagios-plugins-*
dnf -y install rsync git wget expect ruby-devel ant texlive
dnf -y groupinstall "Development Tools"
dnf -y install ImageMagick ImageMagick-perl ImageMagick-libs ImageMagick-devel
dnf -y install https://packages.icinga.com/epel/icinga-rpm-release-8-latest.noarch.rpm
dnf -y install icinga2 icinga2-ido-mysql cpan libzip
dnf -y install python3.8

Update PHP auf Version 7.3

[root@icinga~ ]dnf module list php
[root@icinga~ ]dnf module -y reset php
[root@icinga~ ]dnf module -y enable php:7.3
[root@icinga~ ]dnf module -y install php:7.3/common  
[root@icinga~ ]php -v

Install Imagick

[root@icinga~ ]pecl install imagick
[root@icinga~ ]perl -MCPAN -e shell;
install LWP
install JSON
install Time::Piece
install LWP::Protocol::https
install List::Compare
pip3.8 install pysnmp

Webserver für den automatischen Start konfigurieren

systemctl enable httpd
systemctl start httpd
systemctl status httpd
usermod -a -G icingacmd apache

2. MySQL Datenbank MariaDB

dnf -y install mariadb mariadb-server mariadb-common
systemctl enable mariadb
systemctl start mariadb
systemctl status mariadb

Setzen eines sicheren Passwortes für die MySQL DB

mysqladmin -u root password "SECURE_PASSWORD"

Performance Tuning MariaDB /etc/my.cnf.d/mariadb-server.cnf

[mysqld]
query_cache_limit  = 16M
query_cache_size  = 128M
query_cache_type = 1
tmp_table_size= 960M
max_heap_table_size= 830M
performance_schema = ON
innodb_log_file_size = 16M
innodb_buffer_pool_instances = 1
max_allowed_packet=500M

Performance Tuning Limits erhöhen /root/.bashrc

ulimit -n 90000

Performance Tuning Filesystem /etc/fstab

/dev/mapper/cl-var      /var                    ext4    defaults,noatime        1 2

Enable Icinga2 Features

icinga2 feature enable statusdata
icinga2 feature enable livestatus
icinga2 feature enable syslog
icinga2 feature enable ido-mysql
icinga2 feature enable command
systemctl enable icinga2
systemctl start icinga2
systemctl status icinga2

Konfiguration Icingadb Datenbank

mysql -u root -pPASSWORD -e "create database icingadb;"
mysql -u root -pPASSWORD -e "GRANT ALL ON icingadb.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';"
mysql -u root -pPASSWORD icingadb < /usr/share/icinga2-ido-mysql/schema/mysql.sql

IDO-MySQL Konfiguration

cat > /etc/icinga2/features-available/ido-mysql.conf <<EOF
/**
 * The db_ido_mysql library implements IDO functionality
 * for MySQL.
 */

library "db_ido_mysql"

object IdoMysqlConnection "ido-mysql" {
  user = "icinga"
  password = "icinga"
  host = "localhost"
  database = "icingadb"
  cleanup = {
   acknowledgements_age = 90d
   commenthistory_age = 90d
   contactnotifications_age = 90d
   contactnotificationmethods_age = 90d
   downtimehistory_age = 90d
   eventhandlers_age = 90d
   externalcommands_age = 90d
   flappinghistory_age = 90d
   hostchecks_age = 90d
   logentries_age = 90d
   notifications_age = 90d
   processevents_age = 90d
   statehistory_age = 90d
   servicechecks_age = 90d
   systemcommands_age = 90d
  }
}
EOF
systemctl restart icinga2
systemctl status icinga2