- MongoDB plugin
- Overview
- Parameter details
- Plugins.MongoDB.Default.AuthMechanism
- Plugins.MongoDB.Default.AuthSource
- Plugins.MongoDB.Default.Direct
- Plugins.MongoDB.Default.Password
- Plugins.MongoDB.Default.ReplicaSet
- Plugins.MongoDB.Default.ReadPreference
- Plugins.MongoDB.Default.TLSConnect
- Plugins.MongoDB.Default.TLSCAFile
- Plugins.MongoDB.Default.TLSCertFile
- Plugins.MongoDB.Default.TLSKeyFile
- Plugins.MongoDB.Default.Uri
- Plugins.MongoDB.Default.User
- Plugins.MongoDB.KeepAlive
- Plugins.MongoDB.Sessions.<SessionName>.AuthMechanism
- Plugins.MongoDB.Sessions.<SessionName>.AuthSource
- Plugins.MongoDB.Sessions.<SessionName>.Direct
- Plugins.MongoDB.Sessions.<SessionName>.Password
- Plugins.MongoDB.Sessions.<SessionName>.ReplicaSet
- Plugins.MongoDB.Sessions.<SessionName>.ReadPreference
- Plugins.MongoDB.Sessions.<SessionName>.TLSConnect
- Plugins.MongoDB.Sessions.<SessionName>.TLSCAFile
- Plugins.MongoDB.Sessions.<SessionName>.TLSCertFile
- Plugins.MongoDB.Sessions.<SessionName>.TLSKeyFile
- Plugins.MongoDB.Sessions.<SessionName>.Uri
- Plugins.MongoDB.Sessions.<SessionName>.User
- Plugins.MongoDB.System.Path
- Plugins.MongoDB.Timeout
- Options
- See also
MongoDB plugin
Overview
Configuration parameters allow customizing the MongoDB plugin behavior.
It is recommended to specify them in their own configuration file (e.g. mongodb.conf), rather than in the agent 2 configuration file. Then use the Include directive to include this file in the Zabbix agent 2 configuration.
The MongoDB plugin is a loadable plugin and is available and fully described in the MongoDB plugin repository.
All parameters are optional, unless explicitly stated that the parameter is mandatory.
When connecting to MongoDB, the plugin checks its configuration in a specific order, which determines which value to use. The order, from highest to lowest priority, is as follows:
- Parameters specified in the connection URI (e.g., query parameters defined after
?inPlugins.MongoDB.Sessions.<session_name>.Urihave the highest priority). - Parameters in the Zabbix agent 2 item key (e.g., mongodb.collection.stats).
- Parameters defined in a named session (e.g.,
Plugins.MongoDB.Sessions.<SessionName>.User,Plugins.MongoDB.Sessions.<SessionName>.Password). - Default values (e.g.,
Plugins.MongoDB.Default.User,Plugins.MongoDB.Default.Password).
For example:
- If you specify the database for authenticating a connection to the MongoDB server in the
*.<SessionName>.Uriparameter (e.g.,Plugins.MongoDB.Sessions.<session_name>.Uri=mongodb://user:[email protected]:27017/?authSource=admin), then the plugin will consider the*.<SessionName>.AuthSourceparameter to be set toadmin, even if the*.<SessionName>.AuthSourceparameter is set to a different value. - If you specify the URI in the
*.<SessionName>.Uriparameter (e.g.,Plugins.MongoDB.Sessions.<session_name>.Uri=mongodb://127.0.0.1:27017), but provide the username and the password in the Zabbix agent 2 item key, the plugin will use the username and password from the item key, even ifPlugins.MongoDB.Sessions.<SessionName>.UserandPlugins.MongoDB.Sessions.<SessionName>.Passwordare configured.
If the mongodb+srv:// scheme is used, the URI may retrieve parameters from a DNS TXT record.
Parameters obtained from this TXT record override all other configurations, including URI parameters, Zabbix Agent 2 item key parameters, and session parameters.
Only one TXT record may exist for the hostname used in the connection string.
This page is structured as:
- Parameter overview (to see full details of a parameter, click its name)
- Parameter details
| Parameter | Description |
|---|---|
| Plugins.MongoDB.Default.AuthMechanism | Specify the default authentication mechanism for connecting to MongoDB server. |
| Plugins.MongoDB.Default.AuthSource | Specify the default database for authenticating connection to MongoDB server. |
| Plugins.MongoDB.Default.Direct | Disable automatic discovery of MongoDB replica set nodes. |
| Plugins.MongoDB.Default.Password | Specify the default password. |
| Plugins.MongoDB.Default.ReplicaSet | Specify the default replica set name, used for automatic discovery of MongoDB replica set nodes. |
| Plugins.MongoDB.Default.ReadPreference | Specify the default order for connecting to MongoDB replica set nodes or fallback. |
| Plugins.MongoDB.Default.TLSConnect | Specify the level of encryption required for communications between Zabbix agent 2 and monitored databases. |
| Plugins.MongoDB.Default.TLSCAFile | Specify full pathname of the file containing the top-level CA(s) certificates for peer certificate verification. |
| Plugins.MongoDB.Default.TLSCertFile | Specify full pathname of the file containing the agent certificate or certificate chain. |
| Plugins.MongoDB.Default.TLSKeyFile | Specify full pathname of the file containing the database private key. |
| Plugins.MongoDB.Default.Uri | Specify the default URI. |
| Plugins.MongoDB.Default.User | Specify the default username. |
| Plugins.MongoDB.KeepAlive | Set the maximum time of waiting before unused plugin connections are closed. |
| Plugins.MongoDB.Sessions.<SessionName>.AuthMechanism | Specify the named session authentication mechanism for connecting to MongoDB server. |
| Plugins.MongoDB.Sessions.<SessionName>.AuthSource | Specify the named session database for authenticating connection to MongoDB server. |
| Plugins.MongoDB.Sessions.<SessionName>.Direct | Disable automatic discovery of MongoDB replica set nodes for named session. |
| Plugins.MongoDB.Sessions.<SessionName>.Password | Specify the named session password. |
| Plugins.MongoDB.Sessions.<SessionName>.ReplicaSet | Specify the named session replica set name, used for automatic discovery of MongoDB replica set nodes. |
| Plugins.MongoDB.Sessions.<SessionName>.ReadPreference | Specify the named session order for connecting to MongoDB replica set nodes or fallback. |
| Plugins.MongoDB.Sessions.<SessionName>.TLSConnect | Specify the level of encryption required for communications between Zabbix agent 2 and monitored databases for named session. |
| Plugins.MongoDB.Sessions.<SessionName>.TLSCAFile | Specify full pathname of the file containing the top-level CA(s) certificates for peer certificate verification for named session. |
| Plugins.MongoDB.Sessions.<SessionName>.TLSCertFile | Specify full pathname of the file containing the agent certificate or certificate chain for named session. |
| Plugins.MongoDB.Sessions.<SessionName>.TLSKeyFile | Specify full pathname of the file containing the database private key for named session. |
| Plugins.MongoDB.Sessions.<SessionName>.Uri | Specify the named session URI. |
| Plugins.MongoDB.Sessions.<SessionName>.User | Specify the named session username. |
| Plugins.MongoDB.System.Path | Specify path to the plugin executable. |
| Plugins.MongoDB.Timeout | Set the request execution timeout. |
Note that:
- The default values reflect process defaults, not the values in the shipped configuration files.
- Values support environment variables.
- Zabbix supports configuration files only in UTF-8 encoding without BOM.
- Comments starting with "#" are only supported at the beginning of the line.
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
Options
| Parameter | Description |
|---|---|
| -V --version | Print the plugin version and license information. |
| -h --help | Print help information (shorthand). |
| -t, --test <item key> | Launch plugin for testing (plugin config ignored). |
See also
- Description of general Zabbix agent 2 configuration parameters: Zabbix agent 2 (UNIX) / Zabbix agent 2 (Windows)
- Instructions for configuring plugins