[검증] zabbix-server4.0에서 zabbix2.2 계열의 zabbix-agent를 그대로 사용할 수 있습니까?
개요
zabbix2계의 agent를 그대로 사용해 zabbix-server4.0으로 값 취득할 수 있는지의 검증입니다.
이번에는 zabbix4.0의 디폴트인 템플릿 「Template OS Linux」를 사용하고 있습니다.
환경
OS: amazonlinux2
미들웨어
- nginx 1.16.1
- php 7.3
- mysql 8.0
결론
결론부터 말하면 문제없이 값을 얻을 수있었습니다!
- CPU
- RAM
- DISK(LLD)
- 네트워크(LLD)
아직 검증 도중이므로, 다른 검증했을 때에 갱신합니다.
이하 환경 구축에 쓰고 있습니다만, php7계라면 「zabbix-web-mysql」을 할 때 yum으로부터 인스톨을 할 수 없기 때문에 주의가 필요합니다.
■ 검증 결과
■agentバージョン
# zabbix_agent -V
Zabbix agent v2.2.23 (revision 83227) (30 July 2018)
Compilation time: Jul 30 2018 10:34:32
■zabbix4.0의 GUI
환경 구축
아빠 씨 항상 빚을지고 있습니다 mm!
참고 : htps : // bg. 아빠 r. jp/자비 x/10640/
■nignx+php-fpm
参考: https://qiita.com/kyo662211/items/0a23f634a26472ad12ab
■nginx インストール[stable最新版]
amazon-linux-extras install nginx1
systemctl start nginx
systemctl enable nginx
■php7.3インストール
amazon-linux-extras install php7.3
----
=====================================================================================================
Package Arch Version Repository Size
=====================================================================================================
Installing:
php-cli x86_64 7.3.11-1.amzn2.0.1 amzn2extra-php7.3 4.8 M
php-fpm x86_64 7.3.11-1.amzn2.0.1 amzn2extra-php7.3 1.7 M
php-json x86_64 7.3.11-1.amzn2.0.1 amzn2extra-php7.3 70 k
php-mysqlnd x86_64 7.3.11-1.amzn2.0.1 amzn2extra-php7.3 236 k
php-pdo x86_64 7.3.11-1.amzn2.0.1 amzn2extra-php7.3 130 k
Installing for dependencies:
php-common x86_64 7.3.11-1.amzn2.0.1 amzn2extra-php7.3 1.1 M
----
systemctl start php-fpm
systemctl enable php-fpm
yum install php-opcache
yum install php-apcu
sed -i "s|;date.timezone =|date.timezone = Asia/Tokyo|" /etc/php.ini
cp -a /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf_org
sed -i "s|user = apache|user = nginx|" /etc/php-fpm.d/www.conf
sed -i "s|group = apache|group = nginx|" /etc/php-fpm.d/www.conf
systemctl restart php-fpm
■mysql 8.0
参考: https://qiita.com/RayDoe/items/fb3e0ef69b9b4132e7f7
yum install https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
yum install --enablerepo=mysql80-community mysql-community-server
vim /etc/my.cnf
----
default-authentication-plugin=mysql_native_password
----
systemctl start mysqld
systemctl enable mysqld
■一時パスワードの確認&初期設定
cat /var/log/mysqld.log | grep "temporary password"
mysql_secure_installation --use-default
■zabbix4.0インストール
rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese
----
Error: php-mysql conflicts with php-mysqlnd-7.3.11-1.amzn2.0.1.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
----
参考: https://qiita.com/longunder/items/26ae871558e78b64c2f0
zabbix-web-mysqlをyumでインストールすると依存関係でphp-mysqlをインストールしようとするがphp7.3系では「php-mysql」は「php-mysqlnd」になったためconflictsしてしまう。
解決策「zabbix-web-mysql」パッケージは別でインストールする。「php-mysqlnd」が入っていれば問題なし。
■zabbix-web-mysqlを別にインストールする。
yum install zabbix-server-mysql zabbix-web-japanese
wget https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-web-mysql-4.0.5-1.el7.noarch.rpm
rpm -ivh --nodeps zabbix-web-mysql-4.0.5-1.el7.noarch.rpm
■phpモジュール確認
rpm -qa | grep php
----
php-gd-7.3.11-1.amzn2.0.1.x86_64
php-mbstring-7.3.11-1.amzn2.0.1.x86_64
php-pecl-apcu-5.1.12-3.amzn2.0.2.x86_64
php-mysqlnd-7.3.11-1.amzn2.0.1.x86_64
php-bcmath-7.3.11-1.amzn2.0.1.x86_64
php-xml-7.3.11-1.amzn2.0.1.x86_64
php-ldap-7.3.11-1.amzn2.0.1.x86_64
php-pgsql-7.3.11-1.amzn2.0.1.x86_64
php-json-7.3.11-1.amzn2.0.1.x86_64
php-pdo-7.3.11-1.amzn2.0.1.x86_64
php-fpm-7.3.11-1.amzn2.0.1.x86_64
php-opcache-7.3.11-1.amzn2.0.1.x86_64
php-7.3.11-1.amzn2.0.1.x86_64
php-common-7.3.11-1.amzn2.0.1.x86_64
php-cli-7.3.11-1.amzn2.0.1.x86_64
----
rpm -qa | grep zabbix
----
zabbix-web-4.0.14-1.el7.noarch
zabbix-web-mysql-4.0.5-1.el7.noarch
zabbix-web-pgsql-4.0.14-1.el7.noarch
zabbix-web-japanese-4.0.14-1.el7.noarch
zabbix-release-4.0-1.el7.noarch
zabbix-server-mysql-4.0.14-1.el7.x86_64
----
yum -y install zabbix-agent
yum -y install zabbix-get
■mysql zabbix user作成
mysql -u root -p
CREATE DATABASE zabbix character set utf8 collate utf8_bin;
CREATE USER zabbix@localhost IDENTIFIED BY '<zabbixpassword>';
GRANT ALL ON zabbix.* TO zabbix@localhost;
quit;
cd /usr/share/doc/zabbix-server-mysql-4.0.14/
zcat create.sql.gz | mysql -u zabbix -p zabbix
vim /etc/zabbix/zabbix_server.conf
----
DBPassword=<zabbixpassword>
----
systemctl start zabbix-server
systemctl enable zabbix-server
systemctl start zabbix-agent
systemctl enable zabbix-agent
■動作確認
zabbix_get -s 127.0.0.1 -k agent.version
----
4.0.14
----
■ドキュメントルート設定
ln -s /usr/share/zabbix /var/www/html/
vim /etc/nginx/conf.d/zabbix.conf
----
server {
listen 80;
server_name zbx40-test.com;
root /var/www/html;
index index.html index.php;
access_log /var/log/nginx/access_zabbix.log main;
error_log /var/log/nginx/error_zabbix.log error;
location /zabbix {
try_files $uri $uri/ /index.html index.php;
index index.php;
}
location ~ \.php {
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
-----
chown -R nginx: /etc/zabbix/web/
■表示確認するとエラーが出たので調査
----
==> /var/log/nginx/error_zabbix.log <==
2019/11/15 20:51:54 [error] 10133#0: *6 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Exception: Cannot start session. in /usr/share/zabbix/include/classes/core/CSession.php:46
Stack trace:
#0 /usr/share/zabbix/setup.php(60): CSession::start()
#1 {main}
thrown in /usr/share/zabbix/include/classes/core/CSession.php on line 46" while reading response header from upstream, client: 111.111.111.111, server: zbx40-test.com, request: "GET /setup.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "zbx40-test.com"
==> /var/log/nginx/access_zabbix.log <==
111.111.111.111 - - [15/Nov/2019:20:51:54 +0900] "GET /setup.php HTTP/1.1" 500 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:70.0) Gecko/20100101 Firefox/70.0" "-"
----
■権限の問題
[root@zbx40-test ~]# ll /var/lib/php/
total 0
drwxrwx--- 2 root apache 6 Nov 1 04:34 opcache
drwxr-xr-x 2 root root 31 Nov 14 08:35 peclxml
drwxrwx--- 2 root apache 6 Nov 1 04:34 session
drwxrwx--- 2 root apache 6 Nov 1 04:34 wsdlcache
----
■Apacheユーザーになっているのでnginxへ変更
chown -R root:nginx /var/lib/php/*
■zabbixをインストールする際に以下の編集が必要
vi /etc/php.ini
----
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
----
systemctl restart php-fpm
http://zbx40-test.com
■ログイン後管理ユーザのパスワード変更
Username:Admin
Password:zabbix
나머지는 아빠의 기사대로입니다!
참고:
htps : // bg. 아빠 r. jp/자비 x/10640/
htps : // m / 662211 / / ms / 0 a 23f634 a 26472 a d12 a b
htps : // 이 m / ぉ ぐん r / 있어 ms / 26 꺾어 871558 에 78b64c2f0
Reference
이 문제에 관하여([검증] zabbix-server4.0에서 zabbix2.2 계열의 zabbix-agent를 그대로 사용할 수 있습니까?), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/kaba-chan/items/08fd5f30b21b518ae627텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)