Zabbix

Siehe auch

Open Source Monitoring System, welches Geräte passiv via SNMP oder SSH oder aktiv via Agent überwachen kann.

Installation Version 6.0 auf RedHat-basierten Systemen

https://www.zabbix.com/download?zabbix=6.0&os_distribution=red_hat_enterprise_linux&os_version=8&db=mysql

Voraussetungen:

  • Apache Webserver 2.4

  • MariaDB 10.6

Zabbix Repository hinzufügen

rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-2.el8.noarch.rpm
dnf clean all

Installation Zabbix Server und Tools

dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent

SELinux Booleans für Zabbix setzen

setsebool -P httpd_can_connect_zabbix on
If the database is accessible over network (including 'localhost' in case of PostgreSQL), you need to allow Zabbix frontend to connect to the database too:
setsebool -P httpd_can_network_connect_db on

Anlegen eines vHosts für Zabbix

Das RPM zabbix-apache-conf legt folgende Config in Verzeichnis /etc/httpd/conf.d.

#
# Zabbix monitoring system php web frontend
#

Alias /zabbix /usr/share/zabbix

ProxyTimeout 300

<Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    Require all granted

    <IfModule dir_module>
        DirectoryIndex index.php
    </IfModule>

    <FilesMatch \.(php|phar)$>
        SetHandler "proxy:unix:/run/php-fpm/zabbix.sock|fcgi://localhost"
    </FilesMatch>
</Directory>

<Directory "/usr/share/zabbix/conf">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/app">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/include">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/local">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/vendor">
    Require all denied
</Directory>

Diese kann bei Bedarf wie folgt angepasst werden:

<VirtualHost *:80>
    ServerName monitoring.example.com
    ServerAdmin webmaster@example.com

    ErrorLog "logs/monitoring.example.com-error.log"
    LogLevel warn
    # log_config_module
    CustomLog logs/monitoring.example.com-access.log combined

    KeepAliveTimeout 5
    Timeout 10

    DocumentRoot /usr/share/zabbix
    <Directory /usr/share/zabbix>
        AllowOverride None
        Options FollowSymLinks
        Require all granted

        <IfModule dir_module>
            DirectoryIndex index.php
        </IfModule>

        <FilesMatch \.(php|phar)$>
            SetHandler "proxy:unix:/run/php-fpm/zabbix.sock|fcgi://localhost"
        </FilesMatch>
    </Directory>

    <Directory "/usr/share/zabbix/conf">
        Require all denied
    </Directory>

    <Directory "/usr/share/zabbix/app">
        Require all denied
    </Directory>

    <Directory "/usr/share/zabbix/include">
        Require all denied
    </Directory>

    <Directory "/usr/share/zabbix/local">
        Require all denied
    </Directory>

    <Directory "/usr/share/zabbix/vendor">
        Require all denied
    </Directory>
</VirtualHost>

Anlegen der Datenbank für Zabbix

mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;

Datenbank Schema importieren:

zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 --database=zabbix -uzabbix -p

Zabbix Server konfigurieren

/etc/zabbix/zabbix_server.conf

DBPassword=password

Zabbix Server starten

systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-agent httpd php-fpm