centos下Zabbix Agent端部署和安装

首先重复一下前面的规划

 

server端:  192.168.136.144    centos6.5 (虚拟机)

agent端:    192.168.136.155    centos6.5( 虚拟机)

下面,我们要在agent端155上安装 zabbix的agent ,看看如何进行安装和监控起来

1、同步客户端时间,防止跟服务器端不一致,导致检测到不可用的监控数据

本次实践只是涉及zabbix本身,所以ntp时间同步不详细说明,本博客的其他章节有介绍。


2、创建zabbix运行所需要的用户跟组
groupadd  -g 201 zabbix
useradd -g zabbix -u 201 -m zabbix

usermod -s /sbin/nologin zabbix

3、解压安装zabbixagent端
进入自己放安装包的目录, 首先要解压安装包。 

tar -zvxf zabbix-3.2.0.tar.gz 
cd zabbix-3.2.0
./configure --prefix=/usr/local/zabbix-3.2.0--with-net-snmp --enable-agent
make
make install
make成功时的界面如下图:



4、copy agent端运行所需要的脚本
cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_agentd
注意,要修改一下这个启动脚本, vi   /etc/init.d/zabbix_agentd   将目录修改为如下

DAEMON=/usr/local/zabbix-3.2.0/sbin/zabbix_agentd

5、配置agent端配置文件

vim  /usr/local/zabbix/etc/zabbix_agentd.conf        #此处千万别写成了zabbix_agent.conf,否则配置了不生效
Server=192.168.136.144                   #填写Server的IP地址
ServerActive=192.168.136.144             #修改为Server的IP地址
Hostname=h3.worker.com                       #填写本机的HostName,注意Server端要能解析
UnsafeUserParameters=1                   #是否允许自定义的key,1为允许,0为不允许
#Include= etc/zabbix/zabbix_agentd.conf.d/   这个选项不要配置,否则会造成agent 查找conf 出现递归,无法启动。

6、从zabbix 服务端验证一下,可以解析客户端服务器的hostname(注意:此步骤在服务端操作)


7、启动zabbix agent端
/etc/init.d/zabbix_agentd start

 

备注:如果希望使用root用户启动,则修改 zabbix_agentd.conf中 AllowRoot=1

 

zabbix_agentd.conf 配置中,解释如下:
### Option: AllowRoot
#       Allow the agent to run as 'root'. If disabled and the agent is started by 'root', the agent
#       will try to switch to user 'zabbix' instead. Has no effect if started under a regular user.
#       0 - do not allow
#       1 - allow
#
# Mandatory: no
# Default:
# AllowRoot=0

 

posted @ 2017-12-27 11:42  啊朋  阅读(7946)  评论(0编辑  收藏  举报