CentOS Stream 8
Sponsored Link

Zabbix 6.0 : インストール2022/03/08

 
統合監視システム Zabbix 6.0 LTS をインストールして設定します。
[1]
[2]
[3]
[4] その他必要なパッケージ、および Zabbix のリポジトリを追加しておきます。
[root@dlp ~]#
dnf -y install php-mysqlnd php-gd php-xml php-bcmath php-ldap

[root@dlp ~]#
dnf -y install https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
[5] Zabbix サーバーをインストールします。
[root@dlp ~]#
dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent

[6] データベースの設定をしておきます。
[root@dlp ~]#
mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.5.9-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix; 
Query OK, 1 row affected (0.00 sec)

# [password] は任意のパスワードに置き換え
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'password'; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit 
Bye

[root@dlp ~]#
zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix

Enter password:  
# 上で設定した MariaDB zabbix ユーザーのパスワード
[7] Zabbix サーバーを設定して起動します。
[root@dlp ~]#
vi /etc/zabbix/zabbix_server.conf
# 94行目 : 追記

DBHost=localhost
# 130行目 : Zabbix DB のパスワード追記

DBPassword=password
[root@dlp ~]#
systemctl enable --now zabbix-server

[8] SELinux を有効にしている場合は、ポリシーの変更が必要です。
[root@dlp ~]#
setsebool -P zabbix_can_network on

[root@dlp ~]#
setsebool -P httpd_can_connect_zabbix on

[root@dlp ~]#
setsebool -P domain_can_mmap_files on

[root@dlp ~]#
setsebool -P daemons_enable_cluster_mode on

[root@dlp ~]#
vi zabbix_server.te
# 以下の内容で新規作成

module zabbix_server 1.0;

require {
        type initctl_t;
        type devlog_t;
        type proc_kcore_t;
        type zabbix_t;
        type zabbix_agent_t;
        type rpm_exec_t;
        type rpm_var_lib_t;
        class fifo_file getattr;
        class sock_file getattr;
        class file { execute execute_no_trans map open getattr };
        class capability dac_override;
}

#============= zabbix_t ==============
allow zabbix_t self:capability dac_override;

#============= zabbix_agent_t ==============
allow zabbix_agent_t devlog_t:sock_file getattr;
allow zabbix_agent_t initctl_t:fifo_file getattr;
allow zabbix_agent_t proc_kcore_t:file getattr;
allow zabbix_agent_t rpm_var_lib_t:file open;
allow zabbix_agent_t rpm_exec_t:file { execute execute_no_trans map };

[root@dlp ~]#
checkmodule -m -M -o zabbix_server.mod zabbix_server.te

[root@dlp ~]#
semodule_package --outfile zabbix_server.pp --module zabbix_server.mod

[root@dlp ~]#
semodule -i zabbix_server.pp

[9] Firewalld を有効にしている場合は、Zabbix 関連ポートの許可が必要です。
[root@dlp ~]#
firewall-cmd --add-service={http,https}

success
[root@dlp ~]#
firewall-cmd --add-port={10051/tcp,10050/tcp}

success
[root@dlp ~]#
firewall-cmd --runtime-to-permanent

success
[10] Zabbix サーバー自身も監視できるよう Zabbix Agent を設定して起動します。
[root@dlp ~]#
vi /etc/zabbix/zabbix_agentd.conf
# 117行目 : Zabbix サーバーを指定

Server=
127.0.0.1
# 164行目 : Zabbix サーバーを指定

ServerActive=
127.0.0.1
# 175行目 : 自身のホスト名に変更

Hostname=
dlp.srv.world
[root@dlp ~]#
systemctl enable --now zabbix-agent

[11] httpd の設定を変更しておきます。以上で Zabbix サーバーの基本設定は完了です。
[root@dlp ~]#
vi /etc/httpd/conf.d/zabbix.conf
# 12行目 : Web フロントエンドにアクセス許可する範囲
# デフォルトは All 許可のため 必要に応じて変更

#
Require all granted
Require ip 127.0.0.1 10.0.0.0/24
[root@dlp ~]#
systemctl restart httpd php-fpm

関連コンテンツ