自定义安装zabbix_agentd

临时目录:

$ mkdir /mnt/tmp

$ cd /mnt/tmp

下载zabbix管理程序,因为里面有我们要使用的客户端配置文件,建议单独保存,不然每次都下,可不好玩。

$ wget http://ncu.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/1.8.10/zabbix-1.8.10.tar.gz

$ tar zxvf zabbix-1.8.10.tar.gz

$ adduser zabbix

$ addgroup zabbix admin

$ wget http://www.zabbix.com/downloads/1.8.5/zabbix_agents_1.8.5.linux2_6_23.i386.tar.gz32位)

$ wget http://www.zabbix.com/downloads/1.8.5/zabbix_agents_1.8.5.linux2_6.amd64.tar.gz64位)

$ tar zxvf zabbix_agents_1.8.5.linux2_6_23.i386.tar.gz

$ cp bin/zabbix_get /usr/bin/

$ cp bin/zabbix_sender /usr/bin/

$ cp sbin/zabbix_agent /usr/sbin/

$ cp sbin/zabbix_agentd /usr/sbin/ 

$ cd /mnt/zabbix/zabbix-1.8.10

$ mkdir /etc/zabbix

$ chown -R zabbix.zabbix /etc/zabbix/

$ cp misc/conf/zabbix_agent* /etc/zabbix/

$ vi /etc/zabbix/zabbix_agentd.conf

---------------------------------------zabbix_agentd.conf------------------------------------------------

#LogFile=c:\win32\zabbix_agentd.log

LogFile=/tmp/zabbix_agentd.log

Hostname=mmot

Server=192.168.1.103

ServerPort=10051

ListenPort=10050

ListenIP=192.168.1.112

StartAgents=3

Timeout=3

------------------------------------------------------------------------------------------------------------------ 

这个文件是我修改好了的,直接copy过去

cp zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf 

配置zabbix客户端启动项

$ cp misc/init.d/debian/zabbix-agent /etc/init.d 

$ vi /etc/init.d/zabbix-agent

DAEMON=/home/zabbix/bin/${NAME} to DAEMON=/usr/sbin/${NAME}

(old versions use /usr/bin/${NAME}) 

$ chmod 755 /etc/init.d/zabbix-agent 

$ update-rc.d zabbix-agent defaults 

$ /etc/init.d/zabbix-agent start 

$ /etc/init.d/zabbix-agent restart

 

 

二 在线安装

#sudo apt-get install zabbix-agent

安装客户端后,若不是服务器本机,都需要修改zabbix配置文件/etc/zabbix/zabbix_agent.conf/etc/zabbix/zabbix_sagentd.conf的一行

server=zabbix服务端地址或域名

 

三 windows下安装zabbix-agentd

一、所需文件位置
Windows客户端程序安装文件和配置文件分别在zabbix-1.6.6.tar.gz压缩包(使用winrar打开)bin\win32misc\conf下。
二、安装
1.copy bin\win32\zabbix_agentd.exe misc\conf\zabbix_agentd.conf c:\下。

修改zabbix_agentd.conf
Server=192.168.1.1                             <------zabbix服务器ip地址
Hostname=sale server                         <------客户端机器名
StartAgents=5 
DebugLevel=3 
PidFile=c:\zabbix_agentd.pid                <------保存PidFile的路径
LogFile=c:\zabbix_agentd.log               <------保存LogFile的路径
Timeout=3
2.使用命令安装zabbix_agentd
cd c:\
zabbix_agentd.exe -i                            <------安装                            
zabbix_agentd.exe -s                           <------启动服务

三、安装完毕后,在zabbix Web管理页面使用Discovery查找新安装的客户端。




也可以将zabbix_agentd.exe存放在共享文件服务器上,使用脚本方式自动安装,脚本内容如下

@echo off
echo copying exe

net use y: \\共享服务器地址\zabbix
xcopy Y:\zabbix_agentd.exe c:\
net use y: /delete


echo creating config file

echo Server=192.168.1.1 >> c:\zabbix_agentd.conf
echo Hostname=%COMPUTERNAME% >> c:\zabbix_agentd.conf
echo StartAgents=5 >> c:\zabbix_agentd.conf
echo DebugLevel=3 >> c:\zabbix_agentd.conf
echo PidFile=c:\zabbix_agentd.pid >> c:\zabbix_agentd.conf
echo LogFile=c:\zabbix_agentd.log >> c:\zabbix_agentd.conf
echo Timeout=3 >> c:\zabbix_agentd.conf

echo installing service
cd c:\
zabbix_agentd.exe -i

echo start service?
pause

zabbix_agentd.exe -s