安装基础环境
# yum install wget vim tree gcc gcc-c++ -y
安装客户端
# groupadd -g 201 zabbix
#useradd -g zabbix -u 201 -s /sbin/nologin zabbix
#tar zxf zabbix-2.4.7.tar.gz
#cd zabbix-2.4.7
#./configure --prefix=/usr/local/zabbix --enable-agent
编译安装客户端
#make && make install
创建zabbix的日志目录
#mkdir /var/log/zabbix
#chown zabbix.zabbix /var/log/zabbix
复制 zabbix_agentd 启动文件到/etc/init.d 目录下
#cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
#chmod 755 /etc/init.d/zabbix_agentd
在 iptables 中放行 10050 和 10051 端口
#iptables -I INPUT -p tcp -m multiport --dports 10050:10051 -j ACCEPT
#service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
查看 iptables 结果
#iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 multiport dports 10050:10051
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
修改启动文件和配置软连接
#sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_agentd
#ln -s /usr/local/zabbix/etc/ /etc/zabbix
#ln -s /usr/local/zabbix/bin/* /usr/bin
#ln -s /usr/local/zabbix/sbin/* /usr/sbin/
/etc/zabbix/zabbix_agentd.conf,这里的 IP 地址写的是 zabbix_server 端的 IP 地址
#sed -i "s@Server=127.0.0.1@Server=192.168.32.128@g" /etc/zabbix/zabbix_agentd.conf
#sed -i "s@ServerActive=127.0.0.1@ServerActive=192.168.32.128:10051@g" /etc/zabbix/zabbix_agentd.conf
#sed -i "s@tmp/zabbix_agentd.log@var/log/zabbix/zabbix_agentd.log@g" /etc/zabbix/zabbix_agentd.conf
#sed -i "s@^# UnsafeUserParameters=0@UnsafeUserParameters=1\n@g" /etc/zabbix/zabbix_agentd.conf
设置 zabbix_agentd 开机自动启动,并启动 zabbix_agentd 服务
#chkconfig zabbix_agentd on
#service zabbix_agentd start
Starting zabbix_agentd: [ OK ]