[root@zabbix_agent src]# cd zabbix-3.0.3
[root@zabbix_agent zabbix-3.0.3]# ls
aclocal.m4 bin ChangeLog conf config.sub configure.ac database frontends INSTALL m4 Makefile.in misc NEWS src
AUTHORS build compile config.guess configure COPYING depcomp include install-sh Makefile.am man missing README upgrades
[root@zabbix_agent zabbix-3.0.3]# ./configure --prefix=/usr/local/zabbix-3.0.3/ --enable-agent



[root@zabbix_agent zabbix-3.0.3]# yum install -y gcc c++



[root@zabbix_agent zabbix-3.0.3]# ./configure --prefix=/usr/local/zabbix-3.0.3/ --enable-agent



[root@zabbix_agent zabbix-3.0.3]# make install



# vim /usr/local/zabbix-3.0.3/etc/zabbix_agentd.conf
Server=ip(zabbix_server的ip)
ServerActive==ip(zabbix_server的ip)
Hostname=Zabbix server
其中Server和ServerActive都指定zabbixserver的IP地址,不同的是,前者是被动后者是主动。也就是说Server这个配置是用来允许127.0.0.1这个ip来我这取数据。而serverActive的127.0.0.1的意思是,客户端主动提交数据给他.
主机安装客户端记得添加zabbix用户



[root@zabbix_agent zabbix-3.0.3]# userdel zabbix<br>[root@zabbix_agent zabbix-3.0.3]# groupadd zabbix<br>[root@zabbix_agent zabbix-3.0.3]# useradd -g zabbix zabbix

 启动zabbix客户端:

[root@zabbix_agent zabbix-3.0.3]# /usr/local/zabbix-3.0.3/sbin/zabbix_agentd 
[root@zabbix_agent zabbix-3.0.3]# netstat -lnutp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 8899/zabbix_agentd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2097/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1493/master
tcp 0 0 :::22 :::* LISTEN 2097/sshd
tcp 0 0 ::1:25 :::* LISTEN 1493/master
udp 0 0 0.0.0.0:68 0.0.0.0:* 1247/dhclient



[root@zabbix_agent zabbix-3.0.3]# ln -s /usr/local/zabbix-3.0.3/sbin/* /usr/local/sbin/
[root@zabbix_agent zabbix-3.0.3]# ln -s /usr/local/zabbix-3.0.3/bin/* /usr/local/bin/



[root@zabbix_agent zabbix-3.0.3]# vi /etc/services #添加以下内容
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper


 修改Zabbix配置文件

[root@zabbix_agent zabbix-3.0.3]# vi /usr/local/zabbix-3.0.3/etc/zabbix_agentd.conf
Server=192.168.1.122
Include=/usr/local/zabbix-3.0.3/etc/zabbix_agentd.conf.d/
UnsafeUserParameters=1 #启用自定义key


 添加开机启动脚本

[root@zabbix_agent ~]# cp /usr/local/src/zabbix-3.0.3/misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd



[root@zabbix_agent ~]# vi /etc/rc.d/init.d/zabbix_agentd

# Zabbix-Directory
BASEDIR=/usr/local/zabbix-3.0.3/ #Zabbix安装目录



[root@zabbix_agent ~]# chmod +x /etc/rc.d/init.d/zabbix_agentd 
[root@zabbix_agent ~]# chkconfig zabbix_agentd on
[root@zabbix_agent ~]# service zabbix_agentd start
/etc/init.d/zabbix_agentd : zabbix_agentd (pid 8899) already running



[root@zabbix_agent ~]# netstat -lnutp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 8899/zabbix_agentd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2097/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1493/master
tcp 0 0 :::22 :::* LISTEN 2097/sshd
tcp 0 0 ::1:25 :::* LISTEN 1493/master
udp 0 0 0.0.0.0:68 0.0.0.0:* 1247/dhclient


 ​测试Zabbix客户端与Zabbix服务端通信是否正常

[root@zabbix_agent ~]# /usr/local/zabbix-3.0.3/bin/zabbix_get -s 192.168.1.119 -p10050 -k "system.uptime"
zabbix_get [9070]: Check access restrictions in Zabbix agent configuration


 备注:192.168.1.119是Zabbix客户端IP地址


  网名:bass 分享技术 突破难点 创新思维