ZabbixAgentサービスが起動しない

お世話になります。

「vfs.file.regmatchで誤検知」と同じ環境になります。

ZabbixAgentをデバッグモードで再起動後、2日後にZabbixAgentサービスが停止していました。
zabbix_agentd.confに問題があったかと思い元のzabbix_agentd.confに戻したのですが
サービス開始時に以下のアラートがでて起動できません。

「ローカルコンピュータのZabbix Agent [hostname]サービスを開始できません。

エラー 1067: プロセスを途中で強制終了しました。」

zabbix_agentd.logには停止された際のアラート等は何も出力されていませんでした。

サービスを起動するにはどうすればよいでしょうか。

起動時のzabbix_agentd.confは以下になります。

# This is a config file for the Zabbix agent daemon (Windows)
# To get more information about Zabbix, go to http://www.zabbix.com

############ GENERAL PARAMETERS #################

### Option: LogFile
# Name of log file.
# If not set, Windows Event Log is used.
#
# Mandatory: no
# Default:
# LogFile=

LogFile=C:\Zabbix\ZabbixAgent2.2.5\zabbix_agentd.log

### Option: LogFileSize
# Maximum size of log file in MB.
# 0 - disable automatic log rotation.
#
# Mandatory: no
# Range: 0-1024
# Default:
# LogFileSize=1

### Option: DebugLevel
# Specifies debug level
# 0 - no debug
# 1 - critical information
# 2 - error information
# 3 - warnings
# 4 - for debugging (produces lots of information)
#
# Mandatory: no
# Range: 0-4
# Default:
# DebugLevel=3

### Option: SourceIP
# Source IP address for outgoing connections.
#
# Mandatory: no
# Default:
# SourceIP=

### Option: EnableRemoteCommands
# Whether remote commands from Zabbix server are allowed.
# 0 - not allowed
# 1 - allowed
#
# Mandatory: no
# Default:
# EnableRemoteCommands=0

### Option: LogRemoteCommands
# Enable logging of executed shell commands as warnings.
# 0 - disabled
# 1 - enabled
#
# Mandatory: no
# Default:
# LogRemoteCommands=0

##### Passive checks related

### Option: Server
# List of comma delimited IP addresses (or hostnames) of Zabbix servers.
# Incoming connections will be accepted only from the hosts listed here.
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally.
#
# Mandatory: no
# Default:
# Server=

Server=xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx

### Option: ListenPort
# Agent will listen on this port for connections from the server.
#
# Mandatory: no
# Range: 1024-32767
# Default:
ListenPort=20050

### Option: ListenIP
# List of comma delimited IP addresses that the agent should listen on.
# First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks.
#
# Mandatory: no
# Default:
# ListenIP=127.0.0.1

### Option: StartAgents
# Number of pre-forked instances of zabbix_agentd that process passive checks.
# If set to 0, disables passive checks and the agent will not listen on any TCP port.
#
# Mandatory: no
# Range: 0-100
# Default:
# StartAgents=3

##### Active checks related

### Option: ServerActive
# List of comma delimited IP:port (or hostname:port) pairs of Zabbix servers for active checks.
# If port is not specified, default port is used.
# IPv6 addresses must be enclosed in square brackets if port for that host is specified.
# If port is not specified, square brackets for IPv6 addresses are optional.
# If this parameter is not specified, active checks are disabled.
# Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
#
# Mandatory: no
# Default:
# ServerActive=

ServerActive=xxx.xxx.xxx.xxx

### Option: Hostname
# Unique, case sensitive hostname.
# Required for active checks and must match hostname as configured on the server.
# Value is acquired from HostnameItem if undefined.
#
# Mandatory: no
# Default:
# Hostname=

Hostname=hostname

### Option: HostnameItem
# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
# Does not support UserParameters or aliases.
#
# Mandatory: no
# Default:
# HostnameItem=system.hostname

### Option: HostMetadata
# Optional parameter that defines host metadata.
# Host metadata is used at host auto-registration process.
# An agent will issue an error and not start if the value is over limit of 255 characters.
# If not defined, value will be acquired from HostMetadataItem.
#
# Mandatory: no
# Range: 0-255 characters
# Default:
# HostMetadata=

### Option: HostMetadataItem
# Optional parameter that defines an item used for getting host metadata.
# Host metadata is used at host auto-registration process.
# During an auto-registration request an agent will log a warning message if
# the value returned by specified item is over limit of 255 characters.
# This option is only used when HostMetadata is not defined.
#
# Mandatory: no
# Default:
# HostMetadataItem=

### Option: RefreshActiveChecks
# How often list of active checks is refreshed, in seconds.
#
# Mandatory: no
# Range: 60-3600
# Default:
# RefreshActiveChecks=120

### Option: BufferSend
# Do not keep data longer than N seconds in buffer.
#
# Mandatory: no
# Range: 1-3600
# Default:
# BufferSend=5

### Option: BufferSize
# Maximum number of values in a memory buffer. The agent will send
# all collected data to Zabbix server or Proxy if the buffer is full.
#
# Mandatory: no
# Range: 2-65535
# Default:
# BufferSize=100

### Option: MaxLinesPerSecond
# Maximum number of new lines the agent will send per second to Zabbix Server
# or Proxy processing 'log', 'logrt' and 'eventlog' active checks.
# The provided value will be overridden by the parameter 'maxlines',
# provided in 'log', 'logrt' or 'eventlog' item keys.
#
# Mandatory: no
# Range: 1-1000
# Default:
# MaxLinesPerSecond=100

############ ADVANCED PARAMETERS #################

### Option: Alias
# Sets an alias for an item key. It can be used to substitute long and complex item key with a smaller and simpler one.
# Multiple Alias parameters may be present. Multiple parameters with the same Alias key are not allowed.
# Different Alias keys may reference the same item key.
# For example, to retrieve paging file usage in percents from the server:
# Alias=pg_usage:perf_counter[\Paging File(_Total)\% Usage]
# Now shorthand key pg_usage may be used to retrieve data.
# Aliases can be used in HostMetadataItem but not in HostnameItem or PerfCounter parameters.
#
# Mandatory: no
# Range:
# Default:

### Option: Timeout
# Spend no more than Timeout seconds on processing
#
# Mandatory: no
# Range: 1-30
# Default:
# Timeout=3

### Option: PerfCounter
# Syntax: ,"",
# Defines new parameter which is an average value for system performance counter for the specified time period (in seconds).
# For example, if you wish to receive average number of processor interrupts per second for last minute, you can define new parameter "interrupts" as following:
# PerfCounter = interrupts,"\Processor(0)\Interrupts/sec",60
# Please note double quotes around performance counter path.
# Samples for calculating average value will be taken every second.
# You may run "typeperf -qx" to get list of all performance counters available in Windows.
#
# Mandatory: no
# Range:
# Default:

### Option: Include
# You may include individual files in the configuration file.
#
# Mandatory: no
# Default:
# Include=

# Include=c:\zabbix\zabbix_agentd.userparams.conf

####### USER-DEFINED MONITORED PARAMETERS #######

### Option: UnsafeUserParameters
# Allow all characters to be passed in arguments to user-defined parameters.
# 0 - do not allow
# 1 - allow
#
# Mandatory: no
# Range: 0-1
# Default:
# UnsafeUserParameters=0

### Option: UserParameter
# User-defined parameter to monitor. There can be several user-defined parameters.
# Format: UserParameter=,
#
# Mandatory: no
# Default:
# UserParameter=

以上、よろしくお願いいたします。

コメント表示オプション

お好みのコメント表示方法を選び「設定の保存」をクリックすると変更が反映されます。
ユーザー ogata の写真

ポートは10050ではなく20050を使用しています。

ユーザー TNK の写真

利用されているOSの詳細な情報をお教えください。

恐らくWindowsなのだと思いますが、イベントログに何か出力され
ていないかもご確認ください。

エラー 1067とのことですので、プログラムやレジストリの状態が
正しくない場合も考えられます。
一度アンインストールしてからインストールし直すこともご検討く
ださい。

気になったのは、利用されているバージョンはZabbix 2.2.5のエー
ジェントですか?
そうであるならば、それ以降にWindows関連のメモリリークなどの
不具合が修正されていたと思いますので、より新しいバージョンを
利用することをお勧めします。

ユーザー ogata の写真

Zabbixエージェントのバージョン: 2.2.5
OS:Windows2003 SP1

になります。

イベントログを確認したところ、停止したと思われる時間に以下の内容が出力されていました。

エラー発生アプリケーション zabbix_agentd.exe、バージョン 2.2.5.47406、
エラー発生モジュール ntdll.dll、バージョン 5.2.3790.1830、エラー発生アドレス 0x000224b2

ユーザー ogata の写真

アプリケーション C:\Zabbix\ZabbixAgent2.2.5\zabbix_agentd.exeがアプリケーションエラーを起こしました。
11/11/2015 01:06:30.601にエラーが発生しました。発生した例外:c0000005 アドレス 7C8224B2 (ntdll!ExpInterlockedPopEntrySListFault)

というエラーも同じ時間帯に出力されていました。

何かわかりますでしょうか。

ユーザー ogata の写真

Zabbixエージェントを再インストールするしかないのでしょうか?
OSの再起動は意味がないでしょうか。

ユーザー TNK の写真

メモリが確保できないようなエラーであれば、OSの再起動で回復す
る場合があります。

しかし、利用されているOSがWindows Server 2003 SP1と古くSP2以
降も適用されていないような環境のようですし、発生しているエラ
ーも条件によってはSP2で対応されている可能性もあるのですが、
完全に状況やエラーメッセージが一致していないので、SP2を適用
しても解決するかは不明です。

エージェントをインストールし直すとしても先に書かせて頂いた通
り、メモリリークなどの不具合が修正されていますので、より新し
いバージョンを利用した方が良いでしょう。

ユーザー ogata の写真

再度イベントログを確認したところ、何度も自動起動しようとして失敗しているエラーが出力されていました。

一旦コマンドプロンプトより、zabbix_agentd.exe --stop で停止を実行後に該当サービスを管理ツールのサービスから開始するとエラーが発生せずに起動できました。

このホストには別のZabbixサーバも監視を行っていて、別のZabbixエージェントが起動しています(ポートは10050)。
複数のZabbixエージェントが存在していることが問題なのでしょうか。

ユーザー TNK の写真

複数Zabbixエージェントが存在している、だけではわかりません。
どのような設定を行って複数起動するよう設定されているのかを
お教えください。

ユーザー ogata の写真

もう一つのZabbixエージェントは1.4.6になり、以下の場所に配置しています。
C:\Program Files\ZABBIX Agent

zabbix_agentd.confは以下の内容を設定しています。
Serverのxxxは2.2.5で指定していたIPとは別のIPになります。

--------------------------------------------------------
Server=xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx

Hostname=hostname

StartAgents=3

EnableRemoteCommands=1

DebugLevel=3

LogFile=C:\Program Files\ZABBIX Agent\zabbix_agentd.log

LogFileSize=100

Timeout=3

Encoding=utf8
---------------------------------------------------------

ユーザー TNK の写真

サービスにはどのようにして複数のエージェントを登録しましたか?

ユーザー ogata の写真

1.4.6の方は登録したのが大分昔でわかりませんでした。
2.2.5の方はC:\Zabbix\ZabbixAgent2.2.5のフォルダを作成して
以下を置きました。

zabbix_agentd.conf
zabbix_agentd.exe
zabbix_get.exe
zabbix_sender.exe

その後コマンドプロンプトから以下を実行しています。

cd C:\Zabbix\ZabbixAgent2.2.5
zabbix_agentd.exe -i -m -c zabbix_agentd.conf

そのあとで管理ツールのサービスからZabbixAgentサービスを起動しました。

ユーザー TNK の写真

コントロールパネルのサービス上で、きちんと複数のエージェント
を認識できていて、個別に起動できるようになっていますか?

ユーザー ogata の写真

はい。なっています。

ZabbixAgent
ZabbixAgent [hostname]
と区別されています。(hostnameがあるほうが2.2.5)

ユーザー fripper の写真

わかりにくくなってしまったため、纏めてみます
>ogata さん 間違いあれば訂正お願いします

■OS:Windows Server 2003 SP1
■エージェント1 (ver 1.4.6)
 実行ファイル:C:\Program Files\ZABBIX Agent\zabbix_agentd.exe
 設定ファイル:C:\Program Files\ZABBIX Agent\zabbix_agentd.conf
 インストール方法:詳細は昔のことなので不明
 Server・ServerActive:1.4.6側を監視しているサーバX
 ListenPort:10050
 サービスとして登録:されている、名称(ZabbixAgent)
■エージェント2 (ver 2.2.5)
 実行ファイル:C:\Zabbix\ZabbixAgent2.2.5\zabbix_agentd.exe
 設定ファイル:C:\Zabbix\ZabbixAgent2.2.5\zabbix_agentd.conf
 インストール方法:zabbix_agentd.exe -i -m -c zabbix_agentd.conf
      (Multiple Agent 対応の方法でインストールしている)
 Server・ServerActive:2.2.5側を監視しているサーバY
 ListenPort:20050
 サービスとして登録:されている、名称(ZabbixAgent [hostname])

サービスの登録状態は、正直なところレジストリまで見ないとどうなっているか解らないので、
1.4.6側含め、複数のエージェント稼働が問題ない状態か、までは解りません
ただ、「管理ツール・サービス」から各々起動・終了してみながら、タスクマネージャ等で確認すれば
キチンと「各々を意図したように制御できているか」までは判ると思いますので、確認をお願いします

ポートの重複は、設定ファイル内の記載が異なっている限りは大丈夫だと思います
ファイヤウォール等で遮断されたりしていない限りはおそらく問題ないかと思います

また、ネットワークポートの利用状況については、コマンドプロンプト等で
C:> netstat -ano
等を実行すれば、各プロセス毎のListenポート待受状況などは確認できるはずですので合わせて確認を。

クラッシュしてしまう点については、記載頂いているエラーメッセージ(ExpInterlockedPopEntrySListFault)等で
検索してみましたが、メモリリークやスタック破壊などでも起こりうるエラーのようです
Windows OS 側が古いので、nt.dll 含め、OSコアのモジュールが古くて何らかの不具合が起きている可能性もありますし
Zabbix エージェント側の不具合による可能性もあるとは思います

> エージェントをインストールし直すとしても先に書かせて頂いた通
> り、メモリリークなどの不具合が修正されていますので、より新し
> いバージョンを利用した方が良いでしょう。
TNK さんのコメントにもある通り、まずは 2.2.5 となっているエージェントを、新しい版に入れ替えてみたうえで
同様の現象が再発するか否か、様子を見る、というのが良いかと思います

もちろん、OS 側にSP2ほか更新を適用するなど、他にもあるとは思いますが‥ご判断にお任せします

ユーザー fripper の写真

追加コメントです

https://www.zabbix.com/documentation/2.2/manual/appendix/install/windows...

英語版マニュアルですが、少しエージェントのインストールの仕方を確認してみました
zabbix_agentd.exe に与えるコマンドライン引数ですが、
--install は -i
--config は -c
--multiple-agents は -m
など、短縮形で記述できるのは良いとして‥

ページ中央付近に
> If you wish to use a configuration file other than c:\zabbix_agentd.conf, you should use the following command for service installation:
> ...
> A full path to the configuration file should be specified.
デフォルトの「C;\zabbix_agentd.conf」以外を使いたい場合には、引数で指定しなければいけません
指定する際には、フルパスで記述してください

このような記載があるようです
サービス登録の時点で、設定ファイルがうまく認識されていない可能性があるのかもしれません

また、
> 一旦コマンドプロンプトより、zabbix_agentd.exe --stop で停止を実行後に...
のような記載をされていますが、こちらについても、

ページ下寄り
> To stop one of multiple instances of Zabbix agent:
> zabbix_agentd.exe --config [[configuration_file_for_this_instance]] --stop --multiple-agents

--start や --stop 等を指定する場合にも、エージェント複数を利用する場合には、
「--multiple-agents」の複数起動を意味する引数と
「--config」の設定ファイルを意味する引数を
両方指定すべき‥といった記載があります

一旦、両方のエージェントをアンインストールしたうえで、正しい方法でエージェントのサービス登録等を
やり直したほうが良いのかもしれません
#私自身は 1.4.6 のエージェントに関する手順やマニュアルなどは確認していません
#各々のバージョンにあった手順を、確認してからにするよう、お願いします

ユーザー ogata の写真

回答ありがとうございます。

再度手順等確認して検討してみます。
ありがとうございました。