zabbix官网: https://www.zabbix.com/download?zabbix=5.0&os_distribution=centos&os_version=7&components=server_frontend_agent&db=mysql&ws=apache
1.A服务器安装zabbix_server和agent
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
yum clean all
yum install zabbix-server-mysql zabbix-agent -y
yum-config-manager --enable rhel-server-rhscl-7-rpms
vim /etc/yum.repos.d/zabbix.repo
...
enabled=1
...
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
vim /etc/zabbix/zabbix_server.conf
...
LogFileSize=16
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=xxxxx
...
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
···
php_value[date.timezone] = Asia/Shanghai
···
vim /etc/httpd/conf/httpd.conf
···
Listen 12000
···
yum install -y wqy-microhei-fonts.noarch
update-alternatives --install /usr/share/zabbix/assets/fonts/graphfont.ttf zabbix-web-font /usr/share/fonts/wqy-microhei/wqy-microhei.ttc 10
update-alternatives --config zabbix-web-font
此时会弹出选择字体,输入 2 (即选择 wqy-microhei.ttc)
setenforce 0
vim /etc/selinux/config 将SELINUX=enforcing修改为SELINUX=disabled
导入zabbix.sql到数据库中
sudo firewall-cmd --add-port=10051/tcp --add-port=12000/tcp --permanent
sudo firewall-cmd --reload
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl status zabbix-server zabbix-agent httpd rh-php72-php-fpm
- 到此可以访问zabbix控制台了 【http://127.0.0.1:12000/zabbix】
2.B服务器安装agent
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
yum clean all
yum install zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.1.128
ServerActive=192.168.1.128
Hostname=yourhostname
sudo firewall-cmd --add-port=10050/tcp --permanent
sudo firewall-cmd --reload
systemctl restart zabbix-agent
systemctl enable zabbix-agent
3.可能遇到错误的排查
tail -fn 200 /var/log/zabbix/zabbix_agentd.log
tail -fn 200 /var/log/zabbix/zabbix_server.log
tail -fn 200 /var/log/httpd/error_log
tail -f /var/log/php-fpm/www-error.log
find / -name 你要找的文件名
4.server和agent两台服务器之间的连通性测试
yum install zabbix-get
[root@zabbix-server zabbix]