一、zabbix简介
zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。zabbix由zabbix server与可选组件zabbix agent两部门组成。zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视。zabbix agent需要安装在被监视的目标服务器上,它主要完成对硬件信息或与操作系统有关的内存,CPU等信息的收集。
二、环境说明
通过YUM安装,centos7环境只可以安装zabbix-server5.0版本,如果需要安装zabbix-server5.0以上的版本需要准备centos8环境。本博文安装示例环境版本为:
操作系统版本: CentOS Linux release 8.3.2011
zabbix-server版本:5.2.5
php版本:PHP 7.2.24
apache版本:Apache/2.4.37
三、安装步骤
1、安装zabbix YUM源仓库
[root@centos8 opt]# rpm -Uvh https://repo.zabbix.com/zabbix/5.2/rhel/8/x86_64/zabbix-release-5.2-1.el8.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/5.2/rhel/8/x86_64/zabbix-release-5.2-1.el8.noarch.rpm
warning: /var/tmp/rpm-tmp.pOmhcC: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Verifying… ################################# [100%]
Preparing… ################################# [100%]
Updating / installing…
1:zabbix-release-5.2-1.el8 ################################# [100%]
2、清除缓存
[root@centos8 opt]# dnf clean all
21 files removed
3、安装Zabbix server,Web前端,agent
[root@centos8 opt]# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent
4、安装mysql数据库
5、创建zabbix数据库
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected, 2 warnings (0.02 sec)
mysql> create user zabbix@localhost identified by ‘Test!123’;
Query OK, 0 rows affected (0.04 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.01 sec)
6、导入初始架构和数据
[root@centos8 opt]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:
[root@centos8 opt]#
7、检查初始化后的zabbix库
mysql> use zabbix;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
±---------------------------+
| Tables_in_zabbix |
±---------------------------+
| acknowledges |
| actions |
| alerts |
…
| widget_field |
±---------------------------+
170 rows in set (0.01 sec)
8、配置zabbix_server.conf
[root@centos8 opt]# vim /etc/zabbix/zabbix_server.conf
根据创建的zabbix账户信息配置zabbix_server.conf
[root@centos8 opt]# cat /etc/zabbix/zabbix_server.conf |grep -Ev “^#|^$”
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBUser=zabbix
DBPassword=Test!123
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1
9、启动Zabbix server
[root@centos8 opt]# systemctl start zabbix-server zabbix-web-mysql zabbix-apache-conf zabbix-agent
10、配置zabbix前端
打开URL地址 http://192.168.0.127/zabbix
配置zabbix前端,安装提示逐步配置zabbix前端。
配置步骤可以参照博文Zabbix之ZABBIX WEB界面安装
11、登录zabbix-web
使用默认口令Admin/zabbix登录
四、FAQ
1、配置WEB前端数据库连接时报错
报错信息:
The server requested authentication method unknown to the client
原因
mysql8的默认验证方式为caching_sha2_password
mysql> show variables like ‘%default_authentication_plugin%’;
±------------------------------±----------------------+
| Variable_name | Value |
±------------------------------±----------------------+
| default_authentication_plugin | caching_sha2_password |
±------------------------------±----------------------+
1 row in set (0.01 sec)
解决方案:
重新创建zabbix数据库账户
mysql> drop user zabbix@‘localhost’;
Query OK, 0 rows affected (0.01 sec)
mysql> create user zabbix@localhost identified WITH mysql_native_password by ‘Test!123’;
mysql> grant all privileges on zabbix.* to zabbix@‘localhost’;
Query OK, 0 rows affected (0.01 sec)
2、安装环境如果有区别参照官网
如果安装的操作系统环境、msyql版本、zabbix版本有所区别,请参照官网文档步骤安装。
https://www.zabbix.com/documentation/current/manual/installation/install_from_packages/rhel_centos
标签:opt,zabbix,server,Zabbix,YUM,mysql,安装,centos8
来源: https://blog.csdn.net/carefree2005/article/details/114393699