zabbix agent在windows環境安裝

來源:互聯網
上載者:User

標籤:防火牆   windows   檔案夾   壓縮包   

首先在下載windows版zabbix-agent:

http://www.zabbix.com/downloads/2.0.18/zabbix_agents_2.0.18.win.zip

下載後解壓zabbix_agents壓縮包,裡面有兩個檔案夾,分別是bin檔案夾和conf檔案夾。bin檔案夾裡一個是win32 zabbix_agentd,一個是win64zabbix_agentd,生產環境都是64位,這裡選擇win64

在C盤建立一個檔案夾,然後把win64拷貝過去,再將zabbix-agent.conf拷貝進去。

650) this.width=650;" src="https://s1.51cto.com/wyfs02/M01/93/12/wKiom1kH7n-jHkDeAABJsBB24n4927.png-wh_500x0-wm_3-wmp_4-s_2734838735.png" title="QQ20170502102503.png" width="500" height="170" border="0" hspace="0" vspace="0" style="width:500px;height:170px;" alt="wKiom1kH7n-jHkDeAABJsBB24n4927.png-wh_50" />

650) this.width=650;" src="https://s5.51cto.com/wyfs02/M00/93/12/wKiom1kH79Lwi7nIAAGu4yMR79I191.jpg" title="搜狗17年05月02日1032_2.jpg" width="500" height="251" border="0" hspace="0" vspace="0" style="width:500px;height:251px;" alt="wKiom1kH79Lwi7nIAAGu4yMR79I191.jpg" />



編輯zabbix_agentd.win.conf 設定檔,修改以下幾項:

Server=47.93.162.108ServerActive=47.93.162.108UnsafeUserParameters=0UserParameter=EnableRemoteCommands=1LogRemoteCommands=1 Include=c:\zabbix\zabbix_agentd.userparams.conf


啟動zabbix_agent,開啟運行,輸入cmd->輸入以下來安裝zabbix_agent:以下代表安裝成功!

C:\zabbix\zabbix_agentd.exe -i -c C:\zabbix\zabbix_agentd.win.conf

650) this.width=650;" src="https://s3.51cto.com/wyfs02/M01/93/13/wKiom1kH87LjNY4fAAE_c2eJJBw806.jpg" title="搜狗17年05月02日1048_3.jpg" alt="wKiom1kH87LjNY4fAAE_c2eJJBw806.jpg" />

#注意:如果後面啟動不成功,則關閉服務,然後再卸載安裝:C:\zabbix\zabbix_agentd.exe  -d  -c  C:\zabbix\zabbix_agentd.win.conf


啟動zabbix_agent服務:

650) this.width=650;" src="https://s4.51cto.com/wyfs02/M02/93/11/wKioL1kH9FTw-B2SAAMPGVorM-I868.jpg" title="搜狗17年05月02日1051_4.jpg" width="650" height="474" border="0" hspace="0" vspace="0" style="width:650px;height:474px;" alt="wKioL1kH9FTw-B2SAAMPGVorM-I868.jpg" />



用netstat -an查看zabbix_agent連接埠是否監聽:

650) this.width=650;" src="https://s3.51cto.com/wyfs02/M01/93/13/wKiom1kH9QLjR5WGAAHBZA2agOI526.jpg" title="搜狗17年05月02日1054_5.jpg" alt="wKiom1kH9QLjR5WGAAHBZA2agOI526.jpg" />


若windows本身內建的防火牆已經關閉,則無需開啟10050連接埠入站規則,若是開啟了防火牆,則需要添加一條入站規則。

650) this.width=650;" src="https://s4.51cto.com/wyfs02/M00/93/14/wKiom1kH-FOyVN87AAKzokTzznY603.jpg" title="搜狗17年05月02日1108_6.jpg" width="650" height="389" border="0" hspace="0" vspace="0" style="width:650px;height:389px;" alt="wKiom1kH-FOyVN87AAKzokTzznY603.jpg" />




下面講解,自動安裝windows版zabbix_agent:

寫一個指令碼:

:: 一鍵安裝zabbix agent 2.2.9:: 1、修改指令碼裡的zabbix_server變數:: 2、執行本指令碼,自動安裝zabbix agent到C盤@Echo offsetlocal enabledelayedexpansion:: 需要修改IP:set zabbix_server=47.93.162.108:: 替換設定檔中的server ipset conf_file=%~dp0\zabbix_agents_2.2.9.win\conf\zabbix_agentd.win.conffor /f "delims=" %%a in (‘type "%conf_file%"‘) do (  set str=%%a  set "str=!str:127.0.0.1=%zabbix_server%!"  echo !str!>>"%conf_file%"_tmp.txt)move "%conf_file%" "%conf_file%"_bak.txtmove "%conf_file%"_tmp.txt "%conf_file%":: 32 bit or 64 bit process detectionIF "%PROCESSOR_ARCHITECTURE%%PROCESSOR_ARCHITEW6432%"=="x86" (  set _processor_architecture=32bit  goto x86) ELSE (  set _processor_architecture=64bit  goto x64):x86xcopy "%~dp0\zabbix_agents_2.2.9.win\bin\win32" c:\zabbix_x86 /e /i /ycopy "%conf_file%" c:\zabbix_x86\zabbix_agentd.conf /ysc stop  "Zabbix Agent" >nul 2>nulsc delete  "Zabbix Agent" >nul 2>nulc:\zabbix_x86\zabbix_agentd.exe -c c:\zabbix_x86\zabbix_agentd.conf -ic:\zabbix_x86\zabbix_agentd.exe -c c:\zabbix_x86\zabbix_agentd.conf -sgoto firewall:x64xcopy "%~dp0\zabbix_agents_2.2.9.win\bin\win64" c:\zabbix_x64 /e /i /ycopy "%conf_file%" c:\zabbix_x64\zabbix_agentd.conf /ysc stop  "Zabbix Agent" >nul 2>nulsc delete  "Zabbix Agent" >nul 2>nulc:\zabbix_x64\zabbix_agentd.exe -c c:\zabbix_x64\zabbix_agentd.conf -ic:\zabbix_x64\zabbix_agentd.exe -c c:\zabbix_x64\zabbix_agentd.conf -sgoto firewall:firewall:: Get windows Version numbersFor /f "tokens=2 delims=[]" %%G in (‘ver‘) Do (set _version=%%G) For /f "tokens=2,3,4 delims=. " %%G in (‘echo %_version%‘) Do (set _major=%%G& set _minor=%%H& set _build=%%I) Echo Major version: %_major%  Minor Version: %_minor%.%_build%:: OS detectionIF "%_major%"=="5" (  IF "%_minor%"=="0" Echo OS details: Windows 2000 [%_processor_architecture%]  IF "%_minor%"=="1" Echo OS details: Windows XP [%_processor_architecture%]  IF "%_minor%"=="2" IF "%_processor_architecture%"=="32bit" Echo OS details: Windows 2003 [%_processor_architecture%]  IF "%_minor%"=="2" IF "%_processor_architecture%"=="64bit" Echo OS details: Windows 2003 or XP 64 bit [%_processor_architecture%]  :: 開啟防火牆10050連接埠  netsh firewall delete portopening protocol=tcp port=10050  netsh firewall add portopening protocol=tcp port=10050 name=zabbix_10050 mode=enable scope=custom addresses=%zabbix_server%) ELSE IF "%_major%"=="6" (  IF "%_minor%"=="0" Echo OS details: Windows Vista or Windows 2008 [%_processor_architecture%]  IF "%_minor%"=="1" Echo OS details: Windows 7 or Windows 2008 R2 [%_processor_architecture%]  IF "%_minor%"=="2" Echo OS details: Windows 8 or Windows Server 2012 [%_processor_architecture%]  IF "%_minor%"=="3" Echo OS details: Windows 8.1 or Windows Server 2012 R2 [%_processor_architecture%]  IF "%_minor%"=="4" Echo OS details: Windows 10 Technical Preview [%_processor_architecture%]  :: 開啟防火牆10050連接埠  netsh advfirewall firewall delete rule name="zabbix_10050"  netsh advfirewall firewall add rule name="zabbix_10050" protocol=TCP dir=in localport=10050 action=allow remoteip=%zabbix_server%)pauserd /s /q "%~dp0\zabbix_agents_2.2.9.win"del %0


然後和zabbix_agent解壓好的檔案放在一起執行就能安裝,附件中有指令碼和zabbix_agent檔案。


本文出自 “王家東哥” 部落格,謝絕轉載!

zabbix agent在windows環境安裝

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.