配置企业6的虚拟机进行主动模式的配置:
[root@server2 ~]# ls
zabbix-agent-3.4.6-1.el6.x86_64.rpm
[root@server2 ~]# rpm -ivh zabbix-agent-3.4.6-1.el6.x86_64.rpm
[root@server2 ~]# cd /etc/zabbix/
[root@server2 zabbix]# ls
zabbix_agentd.conf zabbix_agentd.d
[root@server2 zabbix]# hostname
server2
[root@server2 zabbix]# /etc/init.d/zabbix-agent start
Starting Zabbix agent: [ OK ]
[root@server2 zabbix]# cd /var/log/
[root@server2 log]# cd zabbix/
[root@server2 zabbix]# cat zabbix_agentd.log 查看日志
1468:20180815:174702.736 Starting Zabbix Agent [server2]. Zabbix 3.4.6 (revision 76823).
1468:20180815:174702.736 **** Enabled features ****
1468:20180815:174702.736 IPv6 support: YES
1468:20180815:174702.736 TLS support: YES
1468:20180815:174702.736 **************************
1468:20180815:174702.736 using configuration file: /etc/zabbix/zabbix_agentd.conf
1468:20180815:174702.736 agent #0 started [main process]
1470:20180815:174702.737 agent #2 started [active checks #1]
1469:20180815:174702.739 agent #1 started [collector]
1470:20180815:174705.739 active check configuration update from [172.25.38.11:10051] started to fail (ZBX_TCP_READ() timed out)
[root@server2 zabbix]# ls
zabbix_agentd.log
[root@server2 zabbix]# cd /etc/zabbix/
[root@server2 zabbix]# ls
zabbix_agentd.conf zabbix_agentd.d
[root@server2 zabbix]# vim zabbix_agentd.conf
[root@server2 zabbix]# vim zabbix_agentd.conf 文件更改内容
[root@server2 zabbix]# /etc/init.d/zabbix-agent restart 重载服务
[root@server2 zabbix]# netstat -antlp 查看端口会出来10050
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 906/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 982/master
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 1537/zabbix_agentd
tcp 0 0 172.25.38.2:44745 172.25.38.11:10051 ESTABLISHED 1542/zabbix_agentd
tcp 0 0 172.25.38.2:22 172.25.38.250:42488 ESTABLISHED 1377/sshd
tcp 0 0 :::22 :::* LISTEN 906/sshd
tcp 0 0 ::1:25 :::* LISTEN 982/master
tcp 0 0 :::10050 :::* LISTEN 1537/zabbix_agentd
进行agent的主动模式的配置:
进行proxy代理,可以减轻agent端的负载:
[root@server2 ~]# ls
fping-2.4b2-16.el6.x86_64.rpm
zabbix-agent-3.4.6-1.el6.x86_64.rpm
zabbix-proxy-mysql-3.4.6-1.el6.x86_64.rpm
[root@server2 ~]# yum install zabbix-proxy-mysql-3.4.6-1.el6.x86_64.rpm fping-2.4b2-16.el6.x86_64.rpm -y
[root@server2 ~]# yum install mysql-server -y 安装数据库
[root@server2 ~]# /etc/init.d/mysqld start 开启服务
[root@server2 ~]# cd /etc/zabbix/
[root@server2 zabbix]# ls
zabbix_agentd.conf zabbix_agentd.d zabbix_proxy.conf
[root@server2 zabbix]# vim zabbix_proxy.conf
24 Server=172.25.38.11
43 Hostname=server2
190 DBPassword=westos
197 DBSocket=/var/lib/mysql/mysql.sock
[root@server2 zabbix]# mysql
mysql> create database zabbix_proxy character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix_proxy.* to zabbix@localhost identified by 'westos'; 授权
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@server2 zabbix]# cd /usr/share/doc/
[root@server2 doc]# cd zabbix-proxy-mysql-3.4.6/
[root@server2 zabbix-proxy-mysql-3.4.6]# ls
AUTHORS ChangeLog COPYING NEWS README schema.sql.gz
[root@server2 zabbix-proxy-mysql-3.4.6]# zcat schema.sql.gz | mysql -u zabbix -p zabbix_proxy
Enter password: westos
’
在网页进行配置:
在agent端:
[root@server3 ~]# vim /etc/zabbix/zabbix_agentd.conf
97 Server=172.25.38.2
......
138 ServerActive=172.25.38.2
[root@server3 ~]# /etc/init.d/zabbix-agent restart
Shutting down Zabbix agent: [ OK ]
Starting Zabbix agent: [ OK ]
[root@server3 ~]#
在网页可以看到有代理: