MongoDBプラグイン

概要

設定パラメータを使用すると、MongoDBプラグインの動作をカスタマイズできます。

これらは、エージェント 2 の設定ファイルではなく、専用の設定ファイル(例: mongodb.conf)に指定することを推奨します。その後、Include ディレクティブを使用して、このファイルを Zabbix エージェント 2 の設定に含めます。

MongoDBプラグインはロード可能なプラグインであり、MongoDB plugin repository にて利用可能で、詳細も記載されています。

特にパラメータが必須であると明記されていない限り、すべてのパラメータは任意です。

注意:

  • デフォルト値は、配布される設定ファイルの値ではなく、プロセスのデフォルト値を反映しています。
  • 値では環境変数を使用できます。
  • Zabbix がサポートする設定ファイルは、BOM を含まない UTF-8 エンコーディングのみです。
  • "#" で始まるコメントは、行頭でのみサポートされます。

Parameter details

Plugins.MongoDB.Default.AuthMechanism

Specify the default authentication mechanism for connecting to MongoDB server.
<SessionName> - define name of a session for using in item keys.

Range: SCRAM-SHA-1, SCRAM-SHA-256, or MONGODB-X509

Plugins.MongoDB.Default.AuthSource

Specify the default database for authenticating connection to MongoDB server.
<SessionName> - define name of a session for using in item keys.

Default: admin

If MONGODB-X509 authentication mechanism is used, this parameter is automatically set to $external; modifying it to any other value will cause an error when launching.

Plugins.MongoDB.Default.Direct

Disable automatic discovery of MongoDB replica set nodes.
<SessionName> - define name of a session for using in item keys.

Default: false Range: true - connect only to the specified server, ignoring other members of the replica set, false - automatically discover all nodes in the replica set.

If the tcp:// (deprecated) scheme is used, the parameter is set to true by default.

Plugins.MongoDB.Default.Password

Specify the default password.
<SessionName> - define name of a session for using in item keys.

Plugins.MongoDB.Default.ReplicaSet

Specify the default replica set name, used for automatic discovery of MongoDB replica set nodes.
<SessionName> - define name of a session for using in item keys.
If this parameter is used with the mongodb+srv:// scheme, it will behave as if multiple URLs have been provided; a DNS server may have a TXT record that can override this (or any other) parameter.
Unavailable if the Plugins.MongoDB.Sessions.<SessionName>.Direct parameter is set to true; the agent will fail to start.

Plugins.MongoDB.Default.ReadPreference

Specify the default order for connecting to MongoDB replica set nodes or fallback.
<SessionName> - define name of a session for using in item keys.
Unavailable if the Plugins.MongoDB.Sessions.<SessionName>.Direct parameter is set to true; the agent will fail to start.

Range: PrimaryMode, PrimaryPreferredMode, SecondaryMode, SecondaryPreferredMode, or NearestMode

Plugins.MongoDB.Default.TLSConnect

Specify the level of encryption required for communications between Zabbix agent 2 and monitored databases.
<SessionName> - define name of a session for using in item keys.
Supported since plugin version 1.2.1.

Range: required - require TLS connection, verify_ca - verify certificates, verify_full - verify certificates and IP address

Plugins.MongoDB.Default.TLSCAFile

Specify full pathname of the file containing the top-level CA(s) certificates for peer certificate verification, used for encrypted communications between Zabbix agent 2 and monitored databases.
<SessionName> - define name of a session for using in item keys.

Mandatory: yes, if Plugins.MongoDB.Sessions.<SessionName>.TLSConnect is set to verify_ca or verify_full

Plugins.MongoDB.Default.TLSCertFile

Specify full pathname of the file containing the agent certificate or certificate chain, used for encrypted communications between Zabbix agent 2 and monitored databases.
<SessionName> - define name of a session for using in item keys.

Mandatory: yes, if Plugins.MongoDB.Sessions.<SessionName>.TLSKeyFile is specified

Plugins.MongoDB.Default.TLSKeyFile

Specify full pathname of the file containing the database private key, used for encrypted communications between Zabbix agent 2 and monitored databases.
<SessionName> - define name of a session for using in item keys.

Mandatory: yes, if Plugins.MongoDB.Sessions.<SessionName>.TLSCertFile is specified

Plugins.MongoDB.Default.Uri

Specify the default URI.
<SessionName> - define name of a session for using in item keys.
Must match the URI format.
Supported schemes: mongodb:// and mongodb+srv://; the tcp:// scheme is deprecated and kept for backward compatibility with existing configurations.
A port can be omitted (default=27017).
Examples: ``

Default: tcp://127.0.0.1:27017

Examples:

mongodb://127.0.0.1:27017
mongodb+srv://example.com
localhost
Plugins.MongoDB.Default.User

Specify the default username.
<SessionName> - define name of a session for using in item keys.

Plugins.MongoDB.KeepAlive

Set the maximum time of waiting (in seconds) before unused plugin connections are closed.

Default: 300 Range: 60-900

Plugins.MongoDB.Sessions.<SessionName>.AuthMechanism

Specify the named session authentication mechanism for connecting to MongoDB server.
<SessionName> - define name of a session for using in item keys.

Range: SCRAM-SHA-1, SCRAM-SHA-256, or MONGODB-X509

Plugins.MongoDB.Sessions.<SessionName>.AuthSource

Specify the named session database for authenticating connection to MongoDB server.
<SessionName> - define name of a session for using in item keys.

Default: admin

If MONGODB-X509 authentication mechanism is used, this parameter is automatically set to $external; modifying it to any other value will cause an error when launching.

Plugins.MongoDB.Sessions.<SessionName>.Direct

Disable automatic discovery of MongoDB replica set nodes for named session.
<SessionName> - define name of a session for using in item keys.

Default: false Range: true - connect only to the specified server, ignoring other members of the replica set, false - automatically discover all nodes in the replica set.

If the tcp:// (deprecated) scheme is used, the parameter is set to true by default.

Plugins.MongoDB.Sessions.<SessionName>.Password

Specify the named session password.
<SessionName> - define name of a session for using in item keys.

Plugins.MongoDB.Sessions.<SessionName>.ReplicaSet

Specify the named session replica set name, used for automatic discovery of MongoDB replica set nodes.
<SessionName> - define name of a session for using in item keys.
If this parameter is used with the mongodb+srv:// scheme, it will behave as if multiple URLs have been provided; a DNS server may have a TXT record that can override this (or any other) parameter.
Unavailable if the Plugins.MongoDB.Sessions.<SessionName>.Direct parameter is set to true; the agent will fail to start.

Plugins.MongoDB.Sessions.<SessionName>.ReadPreference

Specify the named session order for connecting to MongoDB replica set nodes or fallback.
<SessionName> - define name of a session for using in item keys.
Unavailable if the Plugins.MongoDB.Sessions.<SessionName>.Direct parameter is set to true; the agent will fail to start.

Range: PrimaryMode, PrimaryPreferredMode, SecondaryMode, SecondaryPreferredMode, or NearestMode

Plugins.MongoDB.Sessions.<SessionName>.TLSConnect

Specify the level of encryption required for communications between Zabbix agent 2 and monitored databases for named session.
<SessionName> - define name of a session for using in item keys.
Supported since plugin version 1.2.1.

Range: required - require TLS connection, verify_ca - verify certificates, verify_full - verify certificates and IP address

Plugins.MongoDB.Sessions.<SessionName>.TLSCAFile

Specify full pathname of the file containing the top-level CA(s) certificates for peer certificate verification, used for encrypted communications between Zabbix agent 2 and monitored databases for named session.
<SessionName> - define name of a session for using in item keys.

Mandatory: yes, if Plugins.MongoDB.Sessions.<SessionName>.TLSConnect is set to verify_ca or verify_full

Plugins.MongoDB.Sessions.<SessionName>.TLSCertFile

Specify full pathname of the file containing the agent certificate or certificate chain, used for encrypted communications between Zabbix agent 2 and monitored databases for named session.
<SessionName> - define name of a session for using in item keys.

Mandatory: yes, if Plugins.MongoDB.Sessions.<SessionName>.TLSKeyFile is specified

Plugins.MongoDB.Sessions.<SessionName>.TLSKeyFile

Specify full pathname of the file containing the database private key, used for encrypted communications between Zabbix agent 2 and monitored databases for named session.
<SessionName> - define name of a session for using in item keys.

Mandatory: yes, if Plugins.MongoDB.Sessions.<SessionName>.TLSCertFile is specified

Plugins.MongoDB.Sessions.<SessionName>.Uri

Specify the named session URI.
<SessionName> - define name of a session for using in item keys.
Must match the URI format.
Supported schemes: mongodb:// and mongodb+srv://; the tcp:// scheme is deprecated and kept for backward compatibility with existing configurations.
A port can be omitted (default=27017).
Examples: ``

Default: tcp://127.0.0.1:27017

Examples:

mongodb://127.0.0.1:27017
mongodb+srv://example.com
localhost
Plugins.MongoDB.Sessions.<SessionName>.User

Specify the named session username.
<SessionName> - define name of a session for using in item keys.

Plugins.MongoDB.System.Path

Specify path to the MongoDB plugin executable.

Example usage: Plugins.MongoDB.System.Path=/usr/libexec/zabbix/zabbix-agent2-plugin-mongodb

Plugins.MongoDB.Timeout

Set the request execution timeout (the duration, in seconds, to wait for a request to complete before shutting it down).

Default: global timeout Range: 1-30

オプション

Parameter Description
-V --version プラグインのバージョンとライセンス情報を表示します。
-h --help ヘルプ情報を表示します(省略形)。
-t, --test <item key> テスト用にプラグインを起動します(プラグイン設定は無視されます)。

パラメータ

MongoDB に接続する際、プラグインは特定の順序で設定を確認し、どの値を使用するかを決定します。
優先順位の高い順から低い順まで、次のとおりです。

  1. 接続 URI で指定されたパラメータ(例: Plugins.MongoDB.Sessions.<session_name>.Uri? の後に定義されたクエリパラメータが最優先)。
  2. Zabbix エージェント 2 のアイテムキー内のパラメータ(例: mongodb.collection.stats)。
  3. 名前付きセッションで定義されたパラメータ(例: Plugins.MongoDB.Sessions.<SessionName>.UserPlugins.MongoDB.Sessions.<SessionName>.Password)。
  4. デフォルト値(例: Plugins.MongoDB.Default.UserPlugins.MongoDB.Default.Password)。

例:

  • MongoDB サーバーへの接続を認証するためのデータベースを *.<SessionName>.Uri パラメータで指定した場合(例: Plugins.MongoDB.Sessions.<session_name>.Uri=mongodb://user:[email protected]:27017/?authSource=admin)、*.<SessionName>.AuthSource パラメータは admin に設定されているものとしてプラグインは扱います。たとえ *.<SessionName>.AuthSource パラメータに別の値が設定されていても同様です。
  • *.<SessionName>.Uri パラメータで URI を指定し(例: Plugins.MongoDB.Sessions.<session_name>.Uri=mongodb://127.0.0.1:27017)、ユーザー名とパスワードを Zabbix エージェント 2 のアイテムキーで指定した場合、Plugins.MongoDB.Sessions.<SessionName>.UserPlugins.MongoDB.Sessions.<SessionName>.Password が設定されていても、プラグインはアイテムキーのユーザー名とパスワードを使用します。

mongodb+srv:// スキームを使用する場合、URI は DNS の TXT レコードからパラメータを取得することがあります。
この TXT レコードから取得したパラメータは、URI パラメータ、Zabbix Agent 2 のアイテムキーのパラメータ、セッションパラメータを含む他のすべての設定よりも優先されます。
接続文字列で使用されるホスト名に対しては、TXT レコードは 1 つ మాత్రమే存在できます。

Parameter Mandatory Range Default Description
Plugins.MongoDB.System.Path no MongoDB プラグイン実行ファイルへのパス。
使用例: Plugins.MongoDB.System.Path=/usr/libexec/zabbix/zabbix-agent2-plugin-mongodb
Plugins.MongoDB.Timeout no 1-30 global timeout リクエスト実行のタイムアウト(リクエストが完了するまで待機してから停止する秒数)。
Plugins.MongoDB.KeepAlive no 60-900 300 未使用のプラグイン接続を閉じるまでの最大待機時間(秒)。
Plugins.MongoDB.Sessions.<SessionName>.Uri no tcp://127.0.0.1:27017 名前付きセッションの接続文字列。
<SessionName> - アイテムキーで使用するセッション名を定義します。

URI 形式に一致する必要があります。
サポートされるスキーム: mongodb://mongodb+srv://tcp:// スキームは非推奨で、既存の設定との後方互換性のために残されています。
ポートは省略できます(デフォルト=27017)。
例: mongodb://127.0.0.1:27017mongodb+srv://example.comlocalhost
Plugins.MongoDB.Sessions.<SessionName>.User no 名前付きセッションのユーザー名。
<SessionName> - アイテムキーで使用するセッション名を定義します。
Plugins.MongoDB.Sessions.<SessionName>.Password no 名前付きセッションのパスワード。
<SessionName> - アイテムキーで使用するセッション名を定義します。
Plugins.MongoDB.Sessions.<SessionName>.Direct no false MongoDB レプリカセットのノードの自動検出を有効にするか無効にするかを決定するために使用される接続方法。
<SessionName> - アイテムキーで使用するセッション名を定義します。

サポートされる値:
true - プラグインは指定されたサーバーにのみ接続し、レプリカセットの他のメンバーは無視します。
false - プラグインはレプリカセット内のすべてのノードを自動的に検出します。
tcp://(非推奨)スキームを使用する場合、このパラメータはデフォルトで true に設定されます。
Plugins.MongoDB.Sessions.<SessionName>.AuthMechanism no MongoDB サーバーへの接続に使用する認証メカニズム。
<SessionName> - アイテムキーで使用するセッション名を定義します。

サポートされる値: SCRAM-SHA-1SCRAM-SHA-256MONGODB-X509
Plugins.MongoDB.Sessions.<SessionName>.AuthSource no admin MongoDB サーバーへの接続を認証するためのデータベース。
<SessionName> - アイテムキーで使用するセッション名を定義します。

MONGODB-X509 認証メカニズムを使用する場合、このパラメータは自動的に $external に設定されます。これを他の値に変更すると、起動時にエラーになります。
Plugins.MongoDB.Sessions.<SessionName>.ReplicaSet no MongoDB レプリカセットのノードを自動検出するために使用されるレプリカセット名。
<SessionName> - アイテムキーで使用するセッション名を定義します。

このパラメータを mongodb+srv:// スキームと併用すると、複数の URL が指定されたものとして動作します。DNS サーバーの TXT レコードにより、これ(または他の)パラメータが上書きされる場合があります。

Plugins.MongoDB.Sessions.<SessionName>.Direct パラメータが true に設定されている場合は使用できず、エージェントは起動に失敗します。
Plugins.MongoDB.Sessions.<SessionName>.ReadPreference no MongoDB レプリカセットのノードへの接続順序、またはフォールバック。
<SessionName> - アイテムキーで使用するセッション名を定義します。

サポートされる値: PrimaryModePrimaryPreferredModeSecondaryModeSecondaryPreferredModeNearestMode
Plugins.MongoDB.Sessions.<SessionName>.Direct パラメータが true に設定されている場合は使用できず、エージェントは起動に失敗します。
Plugins.MongoDB.Sessions.<SessionName>.TLSConnect no Zabbix エージェント 2 と監視対象データベース間の通信に使用する暗号化方式。
<SessionName> - アイテムキーで使用するセッション名を定義します。

サポートされる値:
required - TLS 接続を必須にします。
verify\_ca - 証明書を検証します。
verify\_full - 証明書と IP アドレスを検証します。

プラグインバージョン 1.2.1 以降でサポートされます。
Plugins.MongoDB.Sessions.<SessionName>.TLSCAFile yes, if Plugins.MongoDB.Sessions.<SessionName>.TLSConnect is set to one of: verify_ca, verify_full ピア証明書検証のための最上位 CA 証明書を含むファイルの完全パス。Zabbix エージェント 2 と監視対象データベース間の暗号化通信で使用されます。
<SessionName> - アイテムキーで使用するセッション名を定義します。
Plugins.MongoDB.Sessions.<SessionName>.TLSCertFile yes, if Plugins.MongoDB.Sessions.<SessionName>.TLSKeyFile is specified エージェント証明書または証明書チェーンを含むファイルの完全パス。Zabbix エージェント 2 と監視対象データベース間の暗号化通信で使用されます。
<SessionName> - アイテムキーで使用するセッション名を定義します。
Plugins.MongoDB.Sessions.<SessionName>.TLSKeyFile yes, if Plugins.MongoDB.Sessions.<SessionName>.TLSCertFile is specified Zabbix エージェント 2 と監視対象データベース間の暗号化通信で使用されるデータベース秘密鍵を含むファイルの完全パス。
<SessionName> - アイテムキーで使用するセッション名を定義します。
Plugins.MongoDB.Default.Uri no tcp://127.0.0.1:27017 MongoDB への接続に使用するデフォルト URI。

URI 形式に一致する必要があります。
サポートされるスキーム: mongodb://mongodb+srv://
非推奨スキーム: tcp://(既存の設定との後方互換性のためにデフォルトとして使用)。
ポートは省略できます(デフォルト=27017)。
例: mongodb://127.0.0.1:27017mongodb+srv://example.comlocalhost
Plugins.MongoDB.Default.User no MongoDB への接続に使用するデフォルトのユーザー名。
Plugins.MongoDB.Default.Password no MongoDB への接続に使用するデフォルトのパスワード。
Plugins.MongoDB.Default.Direct no false MongoDB レプリカセットのノードの自動検出を有効にするか無効にするかを決定するために使用されるデフォルトの接続方法。

サポートされる値:
true - プラグインは指定されたサーバーにのみ接続し、レプリカセットの他のメンバーは無視します。
false - プラグインはレプリカセット内のすべてのノードを自動的に検出します。
tcp://(非推奨)スキームを使用する場合、このパラメータはデフォルトで true に設定されます。
Plugins.MongoDB.Default.AuthMechanism no MongoDB サーバーへの接続に使用するデフォルトの認証メカニズム。

サポートされる値: SCRAM-SHA-1SCRAM-SHA-256MONGODB-X509
ここ、アイテムキー、名前付きセッション、または URI のいずれにも値が指定されていない場合は、SCRAM ベースのメカニズムが使用されます(ユーザー名が指定されている場合)。それ以外の場合は認証は使用されません。
Plugins.MongoDB.Default.AuthSource no admin MongoDB サーバーへの接続を認証するためのデフォルトのデータベース。

MONGODB-X509 認証メカニズムを使用する場合、このパラメータは自動的に $external に設定されます。これを他の値に変更すると、起動時にエラーになります。
Plugins.MongoDB.Default.ReplicaSet no MongoDB レプリカセットのノードを自動検出するために使用されるデフォルトのレプリカセット名。

このパラメータを mongodb+srv:// スキームと併用すると、複数の URL が指定されたものとして動作します。DNS サーバーの TXT レコードにより、これ(または他の)パラメータが上書きされる場合があります。

Plugins.MongoDB.Default.Direct パラメータが true に設定されている場合は使用できず、エージェントは起動に失敗します。
Plugins.MongoDB.Default.ReadPreference no MongoDB レプリカセットのノードへの接続順序、またはフォールバックのデフォルト。

サポートされる値: PrimaryModePrimaryPreferredModeSecondaryModeSecondaryPreferredModeNearestMode
Plugins.MongoDB.Default.Direct パラメータが true に設定されている場合は使用できず、エージェントは起動に失敗します。
Plugins.MongoDB.Default.TLSConnect no Zabbix エージェント 2 と監視対象データベース間の通信に使用するデフォルトの暗号化方式。

サポートされる値:
required - TLS 接続を必須にします。
verify\_ca - 証明書を検証します。
verify\_full - 証明書と IP アドレスを検証します。
ここ、アイテムキー、名前付きセッション、または URI のいずれにも値が指定されていない場合、TLS 接続は確立されません。
Plugins.MongoDB.Default.TLSCAFile no ピア証明書検証のための最上位 CA 証明書を含むファイルのデフォルトの完全パス。Zabbix エージェント 2 と監視対象データベース間の暗号化通信で使用されます。
Plugins.MongoDB.Default.TLSCertFile no MongoDB クライアント証明書または証明書チェーンを含むファイルのデフォルトの完全パス。Zabbix エージェント 2 と監視対象データベース間の暗号化通信で使用されます。
Plugins.MongoDB.Default.TLSKeyFile no Zabbix エージェント 2 と監視対象データベース間の暗号化通信で使用される MongoDB クライアント秘密鍵を含むファイルのデフォルトの完全パス。

関連項目: