其他分享
首页 > 其他分享> > Zabbix搭建教程

Zabbix搭建教程

作者:互联网

a. 导入 Zabbix 仓库

rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all

b. 安装 Zabbix server and agent

yum -y install zabbix-server-pgsql zabbix-agent

c. 安装 Zabbix frontend(前端)

 安装CentOS额外存储库
yum -y install centos-release-scl

编辑配置文件 /etc/yum.repos.d/zabbix.repo 启用 zabbix-frontend 仓库

[zabbix-frontend]
...
enabled=1
...

安装 Zabbix frontend.

yum -y install zabbix-web-pgsql-scl zabbix-nginx-conf-scl

d. 安装数据库(根据自己的想法自行选择,这里以PostgresSQL为例)|导入数据

yum -y install postgresql10-server

初始化数据库

rm -rf /var/lib/pgsql/10/data/ && /usr/pgsql-10/bin/postgresql-10-setup initdb

启动服务

systemctl restart postgresql-10
systemctl enable postgresql-10

创建用户和数据库

sudo -u postgres createuser --pwprompt zabbix
sudo -u postgres createdb -O zabbix zabbix

导入初始架构和数据,系统将提示您输入新创建的密码。

zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbix

e. 为Zabbix server配置数据库

编辑配置文件 /etc/zabbix/zabbix_server.conf

DBPassword=password

f. 为Zabbix前端配置PHP

编辑配置文件 /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf,取消注释(#)并设置端口和服务名

listen 80;
server_name example.com; #example.com修改为实际IP地址或域名

编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf(可使用默认值)

listen.acl_users = apache,nginx

#设置时区

php_value[date.timezone] = Asia/Shanghai

g. 启动Zabbix server和agent进程

启动Zabbix server和agent进程,并为它们设置开机自启:

systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm

h. 配置Zabbix前端

连接到新安装的Zabbix前端

http://server_ip_or_name

 

标签:教程,zabbix,agent,server,nginx,Zabbix,rh,搭建
来源: https://www.cnblogs.com/lxxz/p/16157848.html