4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Zabbixエージェント導入(Win版)

Last updated at Posted at 2018-01-03

ZabbixエージェントWin版をダウンロード

参考1
参考2

http://www.zabbix.com/jp/download.php

C直下にzabbix用ディレクトリを作成する

※例として「zabbix_agent」にする

C:\zabbix_agent

ダウンロードした「zabbix_agents_3.2.0.win.zip」を解凍する

→bin,confフォルダが作成される。

解凍した「zabbix_agents_3.2.0.win.zip」の中身をzabbix用ディレクトリにコピーする

  1. bin/win64直下のexeファイル(zabbix_agentd.exe,zabbix_get.exe,zabbix_sender.exe)をC:\zabbix_agentにコピーする
  • bin/win64直下のexeファイル
C:\bin\win64\zabbix_agentd.exe
C:\bin\win64\zabbix_get.exe
C:\bin\win64\zabbix_sender.exe
  • コピー後C:\zabbix_agent直下
C:\zabbix_agent\zabbix_agentd.exe
C:\zabbix_agent\zabbix_get.exe
C:\zabbix_agent\zabbix_sender.exe
  1. conf/zabbix_agentd.win.confをzabbix用ディレクトリにコピーする
  • コピー後C:\zabbix_agent直下
C:\zabbix_agent\zabbix_agentd.exe
C:\zabbix_agent\zabbix_get.exe
C:\zabbix_agent\zabbix_sender.exe
C:\zabbix_agent\zabbix_agentd.win.conf
  1. zabbix用ディレクトリのconfファイル名を変更する
変更前 変更後
zabbix_agentd.win.conf zabbix_agentd.conf
  • confファイル名変更後C:\zabbix_agent直下
C:\zabbix_agent\zabbix_agentd.exe
C:\zabbix_agent\zabbix_get.exe
C:\zabbix_agent\zabbix_sender.exe
C:\zabbix_agent\zabbix_agentd.conf

Zabbix-Agentの設定変更

  • zabbix_agentd.confを編集する
項目名 変更前 変更後
LogFile c:\zabbix_agentd.log c:\zabbix_agentd\zabbix_agentd.log
Server 127.0.0.1 ZabbixサーバのIPアドレス
ServerActive 127.0.0.1 ZabbixサーバのIPアドレス
Hostname Windows Host WindowsHost

Zabbix-Agentのインストール

  • コマンドプロンプトを「管理者として実行」しコマンドを実行
zabbix_agentd.exe -i -c c:\zabbix_agent\zabbix_agentd.conf
  • 以下の結果が返ってきたらインストール成功
zabbix_agentd.exe [XXXX]: service [Zabbix Agent] installed successfully
zabbix_agentd.exe [XXXX]: event source [Zabbix Agent] installed successfully

Zabbix-Agentの追加を確認

  1. Windowsのサービスとして登録されていることを確認して開始する。
  2. Zabbixサーバ側でAgentが追加されていることを確認する。

MySQL監視について

参考

MySQLに監視用のユーザーを追加する

  1. zabbixユーザの追加(パスワードは任意)
 mysql> grant process on *.* to 'zabbix'@'localhost' identified by '[zabbixユーザに対して設定する任意のパスワード]';
  1. 権限の反映
mysql -uroot -p -e "flush privileges"

Windowsでcut,grep,wcコマンドを使用するためのツール導入

  1. 以下のページにアクセスしてBinariesとDenpendenciesのZipファイルをダウンロードする
    http://gnuwin32.sourceforge.net/packages/coreutils.htm

  2. 以下のページにアクセスしてBinariesとDenpendenciesのZipファイルをダウンロードする
    http://gnuwin32.sourceforge.net/packages/grep.htm

  3. 1,2の手順でダウンロードしたBinariesのZipファイル「coreutils-5.3.0-bin.zip」と「grep-2.5.4-bin.zip」を解凍する

  4. 1,2の手順でダウンロードしたDependenciesのZipファイル「coreutils-5.3.0-dep.zip」と「grep-2.5.4-dep.zip」を解凍する

  5. 解凍後のbinフォルダの「cut.exe」「grep.exe」「wc.exe」「libconv2.dll」「libintl3.dll」「pcre3.dll」「regex2.dll」をC:\Windowsにコピーする

  • bin直下の「cut.exe」「grep.exe」「wc.exe」「libconv2.dll」「libintl3.dll」「pcre3.dll」「regex2.dll」ファイル
C:\bin\cut.exe
C:\bin\grep.exe
C:\bin\wc.exe
C:\bin\libconv2.dll
C:\bin\libintl3.dll
C:\bin\pcre3.dll
C:\bin\regex2.dll
  • コピー後のC:\Windows直下
C:\Windows\cut.exe
C:\Windows\grep.exe
C:\Windows\wc.exe
C:\Windows\libconv2.exe
C:\Windows\libintl3.exe
C:\Windows\pcre3.exe
C:\Windows\regex2.dll

Zabbix-AgentでMySQL監視をするための設定

Zabbix-AgentでMySQL監視を行うためのファイルの追加を行う

  1. zabbix用ディレクトリに「zabbix_mysql.cnf」ファイルの作成を行う
  • ファイルの内容は以下の通り
[client]
user = zabbix
password =[ zabbixユーザに対して設定した任意のパスワード]
host = localhost
  • ファイル作成後
C:\zabbix_agent\zabbix_mysql.cnf
  1. zabbix用ディレクトリに「zabbix_agentd.userparams.conf」ファイルの作成を行う
  • ファイルの内容は以下の通り
UserParameter=mysql.status[*],chcp 65001>nul&& mysql --defaults-extra-file="C:\zabbix_agent\zabbix_mysql.cnf" -N -e "show global status like '$1';" -s | cut -f2
UserParameter=mysql.ping,chcp 65001>nul&& mysqladmin --defaults-extra-file="C:\zabbix_agent\zabbix_mysql.cnf" ping | grep alive | wc -l | cut -d" " -f 7
UserParameter=mysql.version,mysql -V
  • ファイル作成後
C:\zabbix_agent\zabbix_userparams.conf

zabbix_agentd.confにMySQL監視を行うためのファイルを読み込む記述を追記

項目名 変更前 変更後
Include #Include #Include=c:\zabbix_agent\zabbix_userparams.conf

Zabbix-Agentを再起動しMySQL監視ができていることを確認

  1. サービスからZabbix-Agentを再起動する

  2. Zabbixサーバ側でMySQLの監視項目から項目値が取得できていることを確認する

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?