LoginSignup
1
1

More than 1 year has passed since last update.

AWS EC2へZabbix Managerをインストール

Last updated at Posted at 2022-09-20

はじめに

EC2(RHEL8)へZabbix Managerを導入するための、備忘録です。

0. 事前作業

下記作業については、事前に済ませておくこと。

パッケージの更新
# yum update
タイムゾーンの変更
# timedatectl set-timezone Asia/Tokyo
ホスト名の変更
# hostname set-hostname Zabbix-Server
ループバックアドレスへホスト名の追加
# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 Zabbix-Server
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

1. Apacheのインストール

# yum install httpd

2. MySQLのインストール・初期セットアップ

# yum install mysql-server mysql-devel
# systemctl start mysqld
# systemctl enable mysqld

# mysql -u root -p
password
mysql> set password for root@localhost = 'P@ssw0rd';
mysql> quit;

3. WEB ブラウザからのプラットフォーム確認

サイトから自身のプラットフォームを確認する
https://www.zabbix.com/download

4. Zabbix Managerのインストール

Zabbix リポジトリをインストール
# rpm -Uvh https://repo.zabbix.com/zabbix/6.2/rhel/8/x86_64/zabbix-release-6.2-3.el8.noarch.rpm
# dnf clean all
PHP の DNF モジュールのバージョンを切り替える
# dnf module switch-to php:7.4
Zabbix サーバー、フロントエンド、エージェントのインストール
# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
初期データベースの作成
# mysql -u root -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user 'zabbix-user'@'localhost' identified by 'P@ssw0rd';
mysql> grant all privileges on zabbix.* to 'zabbix-user'@'localhost';
mysql> SET GLOBAL log_bin_trust_function_creators = 1;
mysql> quit;
Zabbix サーバー ホストで、初期スキーマとデータをインポート
# zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql zabbix -u zabbix-user -p
データベース スキーマをインポートした後、log_bin_trust_function_creators オプションを無効にする
# mysql -u root -p
password
mysql> SET GLOBAL log_bin_trust_function_creators = 0;
mysql> quit;
Zabbix サーバーのデータベースを構成する
# vi /etc/zabbix/zabbix_server.conf 
DBUser=zabbix-user
DBPassword=P@ssw0rd
Zabbix サーバーとエージェントのプロセスを開始する
# systemctl restart zabbix-server zabbix-agent httpd php-fpm
# systemctl enable zabbix-server zabbix-agent httpd php-fpm
WEB UIへの接続
http://<IPアドレス>/zabbix/setup.php

5. その他(エラー確認)

・ホストの監視がいいえの場合

アクセスログの確認
less /var/log/zabbix/zabbix_server.log
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1