Zabbix agent 在windows上安裝部署


Zabbix agent 在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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM