ksaitoの日記

日々試したことの覚え書き

ZabbixでWindowsマシンを監視する

移転しました。

自動的にリダイレクトします。

WindowsマシンにZabbix agentをインストールして監視できるようにしました。

インストール

Windows版のZabbix agentは、Zabbixのソースにバイナリでバンドルされています。
Zabbixのオフシャルサイト から最新の安定版ソースをダウンロードします。
展開したファイルから下記をc:\bin\zabbixにコピーします。

$ find zabbix-1.8.5 -name *.exe | grep -v win64
zabbix-1.8.5/bin/win32/zabbix_agentd.exe
zabbix-1.8.5/bin/win32/zabbix_get.exe
zabbix-1.8.5/bin/win32/zabbix_sender.exe
$ find zabbix-1.8.5 -name *.win.conf
zabbix-1.8.5/misc/conf/zabbix_agentd.win.conf
$ 

設定

zabbix_agentd.win.confをzabbix_agentd.confにコピーして下記のように修正します。

$ diff -u zabbix-1.8.5/misc/conf/zabbix_agentd.win.conf /tmp/zabbix_agentd.conf 
--- zabbix-1.8.5/misc/conf/zabbix_agentd.win.conf    2011-05-02 07:47:46.459413687 +0900
+++ /tmp/zabbix_agentd.conf    2011-05-02 12:43:40.239412258 +0900
@@ -24,7 +24,7 @@
 # Default:
 # LogFile=

-LogFile=c:\zabbix_agentd.log
+LogFile=c:\bin\zabbix\zabbix_agentd.log

 ### Option: LogFileSize
 #    Maximum size of log file in MB.
@@ -71,7 +71,7 @@
 # Default:
 # Server=

-Server=127.0.0.1
+Server=zabbix

 ### Option: Hostname
 #    Unique, case sensitive hostname.
@@ -81,7 +81,7 @@
 # Default:
 # Hostname=system.hostname

-Hostname=Windows host
+Hostname=winpc

 ### Option: ListenPort
 #    Agent will listen on this port for connections from the server.
@@ -115,7 +115,7 @@
 #
 # Mandatory: no
 # Default:
-# DisableActive=0
+DisableActive=0

 ### Option: ServerPort
 #    Server port for retrieving list of and sending active checks.
$ 

Windowsサービスへの登録

zabbix_agentの-iオプションでWindowsサービスに登録されます。
デフォルトで自動起動ですが、初回の起動は、なぜか手動です。

C:\bin\zabbix>zabbix_agentd.exe -i --conf "c:\bin\zabbix\zabbix_agentd.conf" 
zabbix_agentd.exe [3192]: Service "Zabbix Agent" installed successfully.
zabbix_agentd.exe [3192]: Event source "Zabbix Agent" installed successfully.

C:\bin\zabbix>net start "Zabbix Agent" 
Zabbix Agent サービスを開始します.
Zabbix Agent サービスは正常に開始されました。

C:\bin\zabbix>

Windowsファイアウォールの設定

設定のWindowsファイアウォールにZabbix Agentが使用する10050ポートを設定します。
あとは、Zabbixで通常のマシンと同じように監視することができます。
Template_windowsというテンプレートが定義されているのでバイタルの監視は、これを適用すればOKです。