インストール条件
パスワードは以下を使用します。※パスワードは任意で設定してください。
- ルートパスワード:P@ssw0rd
- DBのZabbixパスワード:Password
参考サイト
https://www.zabbix.com/download?zabbix=5.0&os_distribution=centos&os_version=8&db=mysql&ws=apache
https://www.zabbix.com/documentation/current/manual/installation/install#installing_frontend
https://www.zabbix.com/documentation/current/manual/quickstart/login
Zabbixインストール
SQLサーバの導入
# dnf -y install mariadb mariadb-server
Zabbix用リポジトリ追加
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
# dnf clean all
Zabbixインストール
# dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent
※HTTPD(Apache),PHPはzabbixをパッケージの依存関係でインストールされるので実施は不要
サービス起動設定
# systemctl start mariadb
# systemctl enable mariadb
# systemctl enable httpd
# systemctl start httpd
SQLサーバ(MariaDB)設定
初期設定
# mysql_secure_installation
--
##rootパスワードを設定
Enter current password for root (enter for none): ←「Enter」キーを押します
Set root password? [Y/n] y ←「y」キーを押します
New password: ←「P@ssw0rd」root用のパスワードを入力します
Re-enter new password: ←「P@ssw0rd」root用のパスワードを入力します
##匿名ユーザーを削除
Remove anonymous users? [Y/n] y ←「y」キーを押します
##リモートでrootログインを禁止
Disallow root login remotely? [Y/n] y ←「y」キーを押します
##テストデータベースを削除
Remove test database and access to it? [Y/n] y ←「y」キーを押します
##特権テーブルをリロー
Reload privilege tables now? [Y/n] y ←「y」キーを押します
--
Zabbix用DB作成
# mysql -u root -p
Enter password: ←上記で設定したRootのパスワードを入力します
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.17-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)]>
MariaDB [(none)]> CREATE DATABASE zabbix CHARACTER SET utf8 collate utf8_bin;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> create user zabbix@localhost identified by 'Password';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]>
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> quit
Bye
[root@zabbix ~]#
DB インポート
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: ←上記で設定したDBパスワード「Password」を入力します
DBインポートが失敗する場合
インポートが失敗する / 後述のGUIからSQLサーバ接続時にエラーが出る場合などに実施すると改善する可能性がある
インポート前:OFFにする , インポート後:ONにする
■無効化
# mysql -u root -p
MariaDB [(none)]> set global innodb_strict_mode='OFF';
■有効化
# mysql -u root -p
MariaDB [(none)]> set global innodb_strict_mode='ON';
各構成ファイルの修正
Zabbix用ファイルの修正
# vi /etc/zabbix/zabbix_server.conf
-----
### Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=
DBPassword=Password ←「DBPassword=Password」を追加します
-----
PHP用ファイルの修正
# vi /etc/php-fpm.d/zabbix.conf
-----
[zabbix]
user = apache
group = apache
listen = /run/php-fpm/zabbix.sock
listen.acl_users = apache,nginx
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
php_value[max_execution_time] = 600
php_value[memory_limit] = 256M
php_value[post_max_size] = 32M
php_value[upload_max_filesize] = 16M
php_value[max_input_time] = 600
php_value[max_input_vars] = 10000
php_value[date.timezone] = Asia/Toyo
-----
サービス起動設定
# systemctl restart zabbix-server zabbix-agent httpd php-fpm
# systemctl enable zabbix-server zabbix-agent httpd php-fpm
Web設定
URL:http://server_ip_or_name/zabbixを使用して、新しくインストールしたZabbixフロントエンドに接続し設定します。
基本的には、Zabbix DBユーザーのパスワードを入力するだけでよく、それ以外の場合は「Next Step」をクリックするだけです。
Zabbixデータベースのパスワード:Password
初回アクセス設定
接続時画面
「Next Step」をクリック
PHP設定確認
「Next Step」をクリック
DB接続設定画面
Password欄にZabbixDB用パスワードを入力し、「Next Step」をクリック
接続先指定
「Next Step」をクリック
設定値確認画面
「Next Step」をクリック
設定完了画面
「Finish」をクリック
Web設定/ログイン
ユーザー名:Admin パスワード:zabbix
ダッシュボード
日本語化
Dashboardの左下の「User settings」をクリックすると画面が変移するので
Languageで 「Japanese(ja_JP)」を選択し、「Update」をクリックする。
ダッシュボードが日本語表示となることが確認できる
設定から日本語にしただけでは、下記のような感じで□□□となる部分が出るので、
日本語フォントを追加する。
日本語化用フォント追加
現状の確認
# ls /usr/share/fonts/
dejavu
フォント追加
# rpm -Uvh https://pkgs.dyn.su/el8/base/x86_64/ipa-gothic-fonts-003.03-15.el8.noarch.rpm
# rpm -Uvh https://pkgs.dyn.su/el8/base/x86_64/ipa-pgothic-fonts-003.03-14.el8.noarch.rpm
追加後の確認
# ls /usr/share/fonts/
dejavu ipa-gothic ipa-pgothic
シンボリックリンク変更
# ls -l /etc/alternatives/zabbix-*
lrwxrwxrwx. 1 root root 29 7月 26 02:30 /etc/alternatives/zabbix-server -> /usr/sbin/zabbix_server_mysql
lrwxrwxrwx. 1 root root 38 7月 26 02:30 /etc/alternatives/zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf
ファイル削除
# rm /etc/alternatives/zabbix-web-font
シンボリックリンク作成/確認
# ln -s /usr/share/fonts/ipa-gothic/ipag.ttf /etc/alternatives/zabbix-web-font
# ls -l /etc/alternatives/zabbix-*
lrwxrwxrwx. 1 root root 29 7月 26 02:30 /etc/alternatives/zabbix-server -> /usr/sbin/zabbix_server_mysql
lrwxrwxrwx. 1 root root 36 7月 26 11:05 /etc/alternatives/zabbix-web-font -> /usr/share/fonts/ipa-gothic/ipag.ttf
#
プロセス再起動
# systemctl restart zabbix-server
※各プロセス起動/再起動コマンド
Zabbix Server
# systemctl <status/restart/start/stop> zabbix-server
MySQL/MariaDB Server
# systemctl <status/restart/start/stop> mysql
Apache Server
# systemctl <status/restart/start/stop> httpd
PHP FastCGI Process Manager
# systemctl <status/restart/start/stop> php-fpm
Zabbix Agent
# systemctl <status/restart/start/stop> zabbix-agent
![[改訂3版]Zabbix統合監視実践入門 ―障害通知,傾向分析,可視化による省力運用 Software Design plus [改訂3版]Zabbix統合監視実践入門 ―障害通知,傾向分析,可視化による省力運用 Software Design plus](https://m.media-amazon.com/images/I/51r7TpQZ6mL._SL160_.jpg)
[改訂3版]Zabbix統合監視実践入門 ―障害通知,傾向分析,可視化による省力運用 Software Design plus
- 作者:寺島 広大
- 発売日: 2019/07/10
- メディア: Kindle版
![[改訂2版]Zabbix統合監視徹底活用──複雑化・大規模化するインフラの一元管理 (Software Design plusシリーズ) [改訂2版]Zabbix統合監視徹底活用──複雑化・大規模化するインフラの一元管理 (Software Design plusシリーズ)](https://m.media-amazon.com/images/I/41frODBfuiL._SL160_.jpg)
[改訂2版]Zabbix統合監視徹底活用──複雑化・大規模化するインフラの一元管理 (Software Design plusシリーズ)
- 作者:池田 大輔
- 発売日: 2019/02/27
- メディア: 単行本(ソフトカバー)