zabbix + MySQL + nginx
1.安装zabbix源
# rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
# dnf clean all
2.安装Zabbix server,Web前端,agent
# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
3.安装数据库
yum install mysql*
4.配置数据库
mysql -u root //登录
ALTER USER "root"@"localhost" IDENTIFIED BY "123456"; //设置密码
use mysql; //切换
update user set host = '%' where user = 'root'; //设置所有主机可登录
flush privileges; //刷新
4.1配置zabbix数据库
# mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; //创建数据库
mysql> create user zabbix@localhost identified by 'password'; //创建zabbix用户
mysql> grant all privileges on zabbix.* to zabbix@localhost; //授权
mysql> quit;
4.2导入初始架构和数据
# zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix
5.编辑配置文件 /etc/zabbix/zabbix_server.conf 配置密码
DBPassword=password
6.编辑Nginx配置文件 /etc/nginx/conf.d/zabbix.conf, 取消下注释
# listen 80;
# server_name example.com;
6.1.由于ngixn配置文件include了zabbix.conf 在zabbix.conf中有server模块 所以删除nginx中server模块
如果nginx报错 杀掉进程重启再试
7.启动Zabbix server和agent进程 启动Zabbix server和agent进程,并为它们设置开机自启:
# systemctl restart zabbix-server zabbix-agent nginx php-fpm
# systemctl enable zabbix-server zabbix-agent nginx php-fpm
8.web输入: http://server_ip_or_name 进入配置