ZabbixAgent 安装配置

1)下载安装zabbixagent 软件

# wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.8/zabbix-2.4.8.tar.gz

[root@192~]# tar xf zabbix-2.4.8.tar.gz

[root@192~]# cd zabbix-2.4.8

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

[root@192zabbix-2.4.8]# make && make install

[root@192zabbix-2.4.8]# cp misc/init.d/fedora/core5/zabbix_agentd  /etc/init.d/

2)配置zabbix_agentd

[root@192zabbix-2.4.8]# groupadd zabbix

[root@192zabbix-2.4.8]# useradd -g zabbix zabbix

[root@192zabbix-2.4.8]# mkdir -p /usr/local/zabbix/logs

[root@192zabbix-2.4.8]# chown zabbix.zabbix /usr/local/zabbix/ -R

[root@192zabbix-2.4.8]# vim /usr/local/zabbix/etc/zabbix_agentd.conf

[root@192zabbix-2.4.8]# cat /usr/local/zabbix/etc/zabbix_agentd.conf | egrep -v "^#|^$"

PidFile=/usr/local/zabbix/logs/zabbix_agentd.pid

LogFile=/usr/local/zabbix/logs/zabbix_agentd.log

Server=192.168.1.214

ListenPort=10050

ServerActive=192.168.1.214

Hostname=Zabbix_agent212

Timeout=15

Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/

[root@192zabbix-2.4.8]#

3)配置zabbixagent 系统启动脚本

[root@192zabbix-2.4.8]# vim /etc/init.d/zabbix_agentd

prog="Zabbix Agent"

ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"

CONF_FILE="/usr/local/zabbix/etc/zabbix_agentd.conf"

start(){

        …

        daemon $ZABBIX_BIN -c $CONF_FILE

                   …

}

(4)防火墙设置,开启防火墙端口10050

[root@192~]# iptables -A INPUT -p tcp -m tcp --dport 10050 -j ACCEPT

[root@192~]# service iptables save

iptables:Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

[root@192~]#

5)启动zabbix_agentd

[root@192~]# /etc/init.d/zabbix_agentd start

StartingZabbix Agent:                                     [  OK  ]

6)开机自启动

[root@192~]# chkconfig --add zabbix_agentd

[root@192~]# chkconfig --level 35  zabbix_agentdon

[root@192~]#

7)测试zabbixagent 是否正常工作

[root@192~]# /usr/local/zabbix/sbin/zabbix_agentd -c/usr/local/zabbix/etc/zabbix_agent.conf -t system.uptime

system.uptime                                 [u|1574020]

[root@192~]#