zabbix在windows下的安装

1、下载与解压

地址: http://www.zabbix.com/downloads/2.4.4/zabbix_agents_2.4.4.win.zip

解压zabbix_agents_2.4.0.win.zip

clip_image001[4]

conf目录存放是agent配置文件

bin文件存放windows下32位和64位安装程序。

2、配置zabbix agent.win.conf

找到conf下的配置文件 zabbix_agentd.win.conf ,修改LogFile、Server、ServerActive 、Hostname这几个参数。具体配置如下:

复制代码
LogFile=E:\zabbix\zabbix_agentd.log

Server=172.17.22.155

ServerActive=172.17.22.155

Hostname=Windows_A
复制代码

参数说明:

Server:  zabbix server的ip地址,

ServerActive: zabbix 主动监控server的ip地址,

其中Server和ServerActive都指定zabbix Server的IP地址,不同的是,前者是被动后者是主动。也就是说Server这个配置是用来允许172.17.22.155这个ip来我这取数据。而ServerActive的172.17.22.155的意思是,客户端主动提交数据给他。

Hostname 主机名,必须唯一,区分大小写。Hostname必须和zabbix web上配置的一直,否则zabbix主动监控无法正常工作。因为agent拿着这个主机名去问server,我有配置主动监控项吗?server拿着这个主机名去配置里面查询,然后返回信息。

zabbix agent检测分为主动(agent active)和被动(agent)两种形式,主动与被动的说法均是相对于agent来讨论的。

主动:agent请求server获取主动的监控项列表,并主动将监控项内需要检测的数据提交给server/proxy

被动:server向agent请求获取监控项的数据,agent返回数据。

3、安装agent

修改好文件后,用CMD(需有管理员权限)将Zabbix Agent安装为Windows系统的服务,在windows控制台下执行以下命令:

E:\zabbix\bin\win64\zabbix_agentd.exe -i -c E:\zabbix\conf\zabbix_agentd.win.conf

控制台信息如下:

zabbix_agentd.exe [10540]: service [Zabbix Agent] installed successfully

zabbix_agentd.exe [10540]: event source [Zabbix Agent] installed successfully

4、启动agent客户端

E:\zabbix\bin\win64>zabbix_agentd.exe -c E:\zabbix\conf\zabbix_agentd.win.conf -s

控制台信息

zabbix_agentd.exe [3176]: service [Zabbix Agent] started successfully

查看Windows端口使用

复制代码
E:\zabbix\bin\win64>netstat -ano|findstr "10050"

TCP 0.0.0.0:10050 0.0.0.0:0 LISTENING 10268

TCP [::]:10050 [::]:0 LISTENING 10268

E:\zabbix\bin\win64>tasklist|findstr "10268"

zabbix_agentd.exe 10268 Services 0 6,944 K
复制代码

查看任务管理器

clip_image002

查看启动的日志zabbix_agentd.log:

复制代码
11036:20160114:102150.316 Starting Zabbix Agent [Windows host]. Zabbix 2.4.4 (revision 52334).
11036:20160114:102150.317 using configuration file: E:\zabbix\conf\zabbix_agentd.win.conf
11036:20160114:102150.319 agent #0 started [main process]
11040:20160114:102150.320 agent #1 started [collector]
11024:20160114:102150.320 agent #4 started [listener #3]
9112:20160114:102150.320 agent #3 started [listener #2]
11108:20160114:102150.320 agent #3 started [listener #2]
11028:20160114:102150.320 agent #5 started [active checks #1]
11028:20160114:102150.328 no active checks on server [172.17.22.155:10051]: host [Windows host] not found
复制代码

5、windows系统防火墙中开放端口10050

参照http://www.xitonghe.com/jiaocheng/Windows10-3861.html开放10050端口

控制面板--à选择windows 防火墙--à高级设置--à设置入站规则--à新建规则

clip_image003

6、设置开机启动

运行services.msc

clip_image004

7、zabbix_agentd.exe命令说明

      -c    制定配置文件所在位置

      -i     安装客户端

      -s     启动客户端

      -x    停止客户端

      -d    卸载客户端

8、批处理脚本agentd.bat

下面为Windows批处理脚本agentd.bat对客户端服务器上的zabbix_agentd进行安装、启动、停止、卸载。

前提:

1、解压zabbix_agents_2.4.4.win.zip到c:\zabbix目录

2、修改了参数文件c:\zabbix\conf\zabbix_agentd.win.conf

image

脚本内容如下:

复制代码
@echo off

CHCP 65001

echo ****************************************

echo *****Zabbix Agentd Operation************

echo ****************************************

echo ** a. start Zabbix Agentd********

echo ** b. stop Zabbix Agentd********

echo ** c. restart Zabbix Agentd********

echo ** d. install Zabbix Agentd********

echo ** e. uninstall Zabbix Agentd********

echo ** f. exit Zabbix Agentd********

echo ****************************************

:loop

choice /c abcdef /M "please choose"

if errorlevel 6 goto :exit 

if errorlevel 5 goto uninstall

if errorlevel 4 goto install

if errorlevel 3 goto restart

if errorlevel 2 goto stop

if errorlevel 1 goto start

:start

c:\zabbix\bin\win64\zabbix_agentd.exe -c c:\zabbix\conf\zabbix_agentd.win.conf -s

goto loop

:stop

c:\zabbix\bin\win64\zabbix_agentd.exe -c c:\zabbix\conf\zabbix_agentd.win.conf -x

goto loop

:restart

c:\zabbix\bin\win64\zabbix_agentd.exe -c c:\zabbix\conf\zabbix_agentd.win.conf -x

c:\zabbix\bin\win64\zabbix_agentd.exe -c c:\zabbix\conf\zabbix_agentd.win.conf -s

goto loop

:install

c:\zabbix\bin\win64\zabbix_agentd.exe -c c:\zabbix\conf\zabbix_agentd.win.conf -i

goto loop

:uninstall

c:\zabbix\bin\win64\zabbix_agentd.exe -c c:\zabbix\conf\zabbix_agentd.win.conf -d

goto loop

:exit

exit
复制代码

9、创建主机,查看监控效果

configuration(组态,配置)–>Hosts(主机)–>Create host(创建主机)

clip_image005

连接模板

clip_image006

查看结果

clip_image007

10、安装中遇到的问题

如果未开放10050端口,查看主机监控状态,则结果如下

clip_image008

后台日志

2924:20160114:103211.044 cannot send list of active checks to [172.17.22.187]: host [Windows host] not found,原因是被监控的window系统防火墙未开放10050端口

参考

http://mayulin.blog.51cto.com/1628315/514447