LoginSignup
9
8

More than 5 years have passed since last update.

Windows用Zabbixエージェントについて

Posted at

Windows用のZabbixエージェントですが通常のZabbixエージェントといくつか異なる点が有ります。


■その1 オプション
左がWindows用、右が通常のZabbixエージェントで--helpオプションを実行したものです。

>zabbix_agentd.exe --help                                                       ]# zabbix_agentd --help
usage:                                                                          usage:
  zabbix_agentd.exe [-c config-file]                                              zabbix_agentd [-c config-file]
  zabbix_agentd.exe [-c config-file] -p                                           zabbix_agentd [-c config-file] -p
  zabbix_agentd.exe [-c config-file] -t item-key                                  zabbix_agentd [-c config-file] -t item-key
  zabbix_agentd.exe [-c config-file] -i [-m]                                      zabbix_agentd [-c config-file] -R runtime-option
  zabbix_agentd.exe [-c config-file] -d [-m]                                      zabbix_agentd -h
  zabbix_agentd.exe [-c config-file] -s [-m]                                      zabbix_agentd -V
  zabbix_agentd.exe [-c config-file] -x [-m]                                    
  zabbix_agentd.exe -h                                                          A Zabbix daemon for monitoring of various server parameters.
  zabbix_agentd.exe -V                                                          
                                                                                Options:
A Zabbix daemon for monitoring of various server parameters.                      -c --config config-file        Absolute path to the configuration file
                                                                                                                 (default: "/etc/zabbix/zabbix_agentd.conf")
Options:                                                                          -f --foreground                Run Zabbix agent in foreground
  -c --config config-file        Absolute path to the configuration file          -p --print                     Print known items and exit
                                 (default: "C:\zabbix_agentd.conf")               -t --test item-key             Test specified item and exit
  -f --foreground                Run Zabbix agent in foreground                   -R --runtime-control runtime-option   Perform administrative functions
  -p --print                     Print known items and exit                     
  -t --test item-key             Test specified item and exit                       Runtime control options:
  -m --multiple-agents           For -i -d -s -x functions service name will          log_level_increase=target  Increase log level, affects all processes if
                                 include Hostname parameter specified in                                         target is not specified
                                 configuration file                                   log_level_decrease=target  Decrease log level, affects all processes if
Functions:                                                                                                       target is not specified

  -i --install                   Install Zabbix agent as service                      Log level control targets:
  -d --uninstall                 Uninstall Zabbix agent from service                    pid                      Process identifier
  -s --start                     Start Zabbix agent service                             process-type             All processes of specified type (e.g.,
  -x --stop                      Stop Zabbix agent service                                                       listener)
                                                                                        process-type,N           Process type and number (e.g., listener,3)
  -h --help                      Display this help message                      
  -V --version                   Display version number                           -h --help                      Display this help message
                                                                                  -V --version                   Display version number
Example: zabbix_agentd -c C:\zabbix\zabbix_agentd.conf                          
                                                                                Example: zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
Report bugs to: <https://support.zabbix.com>                                    
Zabbix home page: <http://www.zabbix.com>                                       Report bugs to: <https://support.zabbix.com>
Documentation: <https://www.zabbix.com/documentation>                           Zabbix home page: <http://www.zabbix.com>
                                                                                Documentation: <https://www.zabbix.com/documentation>
>

●オプションの違いその1 -R(Runtime control)オプション

通常のZabbixエージェントは-Rオプションを使用することで再起動を行わなくてもログ出力のデバックレベルを変更できるのですが、Windows用は-Rオプションが使えないのでデバックレベルを変更する場合はzabbix_agentd.confのDebugLevelを変更してサービスの再起動が必要になります。

●オプションの違いその2 サービスの登録(-i)、削除(-d)、開始(-s)、停止(-x)と-mオプション

WindowsではZabbixエージェントはWindowsサービスとして登録して使用します。
その為のオプションがサービスの登録(-i)、削除(-d)、開始(-s)、停止(-x)になります。
Zabbixエージェントをサービス登録するとサービス名は「Zabbix Agent」で登録されます。

Windowsサービスに単純に2つのZabbixエージェントを登録しようとするとサービス名がバッティングしてエラーになります。
2016-12-03_001.png

複数のZabbixエージェントをサービス登録する場合は-mオプションを使います。(準備としてHostnameが異なるzabbic_agentd.confを用意します。)
そして、-mオプションを加えて実行すると以下の様に登録できます。
2016-12-03_002.png

サービスを見ると以下の様に登録されました。
2016-12-03_003.png

-mオプションを付けるとサービス名は「Zabbix Agent [Hostnameに設定した文字]」で登録されるのでバッティングせずに登録することができます。
※:複数Zabbixエージェントを登録するときはListenPortもバッティングしない様に気を付けてください。

尚、-mオプションはサービスの登録(-i)以外の削除(-d)、開始(-s)、停止(-x)でも使用します。


■その2 OSの文字コードの影響による違い
Zabbixですが文字コードはUTF-8を使用しています。

日本語のWindowsはデフォルトがShift_JISに設定されている為、zabbix_agentd.exeを実行する際に下記の様な文字化けメッセージが表示される場合があります。
2016-12-03_004.png

この文字化けはnkfwin32.exeを使うと簡単に回避できます。
2016-12-03_005.png

尚、下記のエラーですが「サービスマネージャに接続しようとしたけど権限がない」と言うエラーになります。

ERROR: cannot connect to Service Manager: [0x00000005] アクセスが拒否されました。

zabbix_agentd.exeを実行する場合、「コマンドプロンプト」は「管理者として実行」を選択して起動しないとサービス登録・削除・起動・停止すべてでこのエラーが発生しますので注意が必要です。

使用しているnkf32.exeですが、Vectorの下記リンクからダウンロードした物を使用しています。
nkf.exe nkf32.dll Windows用

蛇足として…
zabbix_sender.exeを使った監視でも同様でzabbix_sender.exeはデータをUTF-8で取り込みます。その為、監視データがShift_JISの場合、zabbix_sender.exeに引き渡す前にUTF-8に変換する必要があります。


■その3 使用できるアイテムとできないアイテム
これについてはマニュアルの下記を見て頂ければ良いかなと…A(^_^;

1 Items supported by platform

Windows-specific item keys


■その4 設定ファイルの違い
以下の違いが有ります。

Windows用では使用できないパラメータ

  • PidFile
  • AllowRoot
  • User
  • LoadModulePath
  • LoadModule

Windows用でのみ使用できるパラメータ

  • PerfCounter

その他

  • LogType … Windows用はsystemを指定するとsyslogではなくeventlogにログを出力します。
  • MaxLinesPerSecond … Windows用はeventlogアイテムにも影響します。
9
8
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
9
8