准备工作:
- 管理—> agent代理程序 —>创建代理 —> 填写信息 —>添加
1.修改server3的主机名为proxy,给三个节点添加地址解析
hostnamectl set-hostname proxy
[root@server1 ~]# vim /etc/hosts
172.25.68.3 server3 proxy
[root@server2 ~]# vim /etc/hosts
2.安装zabbix-proxy,mariadb,开启mariadb服务,安全初始化
[root@proxy ~]# yum install -y zabbix-proxy-mysql-4.0.5-1.el7.x86_64.rpm fping-3.10-1.el7.x86_64.rpm
[root@proxy ~]# yum install -y mariadb-server
[root@proxy ~]# systemctl start mariadb
[root@proxy ~]# mysql_secure_installation
3.创建数据库,用户授权
[root@proxy ~]# mysql -p
Enter password:
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
MariaDB [(none)]> create database zabbix_proxy character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix_proxy.* to zabbix@localhost identified by 'redhat';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| zabbix_proxy |
+--------------------+
4.导入数据库
[root@proxy ~]# zcat /usr/share/doc/zabbix-proxy-mysql-4.0.5/schema.sql.gz | mysql -uzabbix -p zabbix_proxy
[root@proxy ~]# mysql -p
Enter password:
MariaDB [(none)]> use zabbix_proxy;
MariaDB [zabbix_proxy]> show tables;
5.编辑配置文件,开启服务
[root@proxy ~]# vim /etc/zabbix/zabbix_proxy.conf
[root@proxy ~]#
[root@proxy ~]# systemctl start zabbix-proxy
30 Server=172.25.68.1
39 ServerPort=10051
49 Hostname=proxy
173 DBName=zabbix_proxy
188 DBUser=zabbix
196 DBPassword=redhat
329 JavaGateway=172.25.68.1
337 JavaGatewayPort=10052
345 StartJavaPollers=5
[root@proxy ~]# netstat -tnlp
6.agent
server2 将server指向proxy
[root@server2 ~]# vim /etc/zabbix/zabbix_agentd.conf
[root@server2 ~]#
[root@server2 ~]# systemctl restart zabbix-agent
98 Server=172.25.68.3
139 ServerActive=172.25.68.2
7.浏览器配置
- 配置—> 主机 —> server2—> agent代理程序接口—> agent代理程序检测 —> 更新
8.重启服务
[root@server1 ~]# zabbix_server -R config_cache_reload
zabbix_server [2005]: command sent successfully
[root@server1 ~]#
[root@server1 ~]# systemctl restart zabbix-server
- 刷新网页后server2的ZBX变绿