Overview Copied

This is a Collection Agent plugin that gathers data from MongoDB. This plugin allows you to get an overview of database operations, such as:

Configure Geneos to deploy the MongoDB plugin Copied

The MongoDB plugin supports Collection Agent publication into Geneos using dynamic Managed Entities. Setting up this plugin in Geneos involves these primary steps:

  1. Set up your Collection Agent plugin.

  2. Configure your mappings.

  3. Configure your other Dynamic Entities in the Gateway. See Create Dynamic Entities in Collection Agent setup for a more detailed procedure.

Set up your Collection Agent plugin Copied

Setting up your collector in the Gateway Setup Editor by adding the following configuration in Dynamic Entities > Collectors. For more information, see Collectors in Dynamic Entities.

Configuration Reference Copied

  - name: mongodb
    type: plugin
    class-name: MongoDbCollector

    # Connection details
      # The connection string in URI format. (required)
      # Refer below for the Standard and SRV connection format.
      #   mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
      #   mongodb+srv://[username:password@]host[/[defaultauthdb][?options]]
      uri: mongodb://localhost:27017/admin

      # The alias that will be used to represent the connection string URI. (required)
      name: MyConnectionName

      # The list of Database names that will be monitored. (optional)
      # If this is not defined, then the defaultauthdb in the connection URI will be monitored.
      # If defaultauthdb is also not defined, then ALL databases will be monitored.
        - admin
        - local

      # Connect to a MongoDB instance using TLS
      # (optional, default is connecting without tls)
        # The path to a CA PEM file that contains the CA certificate. (optional)
        # If this is not specified, the MongoDB Plugin will use the default Java truststore.
        caFile: <path to CA PEM file>

        # The path to a Client certificate. (optional)
        # The mongod/mongos does not require a certificate key file from the client to verify the client's identity.
        # If mongod/mongos is configured with Client Certificate Validation, clientCert and clientKey must be supplied.
        clientCert: <path to Client Certificate>

        # The path to a Client Key PEM File. It should be in PKCS#8 format. (optional)
        clientKey: <path to Client Key PEM file>      

The basic settings for using the MongoDB plugin are the connection uri and name. The following are sample URIs to connect to a replica set:

    #   mongodb://user:password@mongo1:27017,mongo2:27018,mongo3:27019,mongo4:27020,mongo5:27021/myDb?replicaSet=myReplicaSet
    #   mongodb+srv://

The following are sample URIs to connect to a standalone server:

    #   mongodb+srv://
    #   mongodb://user:password@localhost:27027/myDb

For more information about the connection uri, see MongoDB documentation. Additionally, include the database-names to list the databases for monitoring.

For TLS-enabled MongoDB server, add the tls configuration. Note that the client key should be in PKCS#8 format. For more information, see How to convert Client Key file to PKCS#8 format.

Configure your mappings Copied

Select one of the options listed below to configure your dynamic mappings.

  1. Choosing a built in mapping in Dynamic Entities > Mapping. For more information, see Mapping and mapping group in Dynamic Entities documentation.
  2. Setting up a custom mapping in Dynamic Entities > Mapping. For more information, see the Mapping and mapping group in Dynamic Entities documentation.

Initial Connection to MongoDB Server Copied

When all databases are monitored, specifically in cases where database-names is not defined and default authentication database is not in the uri, the complete list of databases might not be available immediately when the plugin starts. In such an instance, if the list is still unavailable, the database to be monitored will default to the source authentication database associated with the provided credentials, if it exists.

If that authentication database is not accessible, the admin database will be used. The list of databases will be updated in the next collection time.

How to convert Client Key file to PKCS#8 format Copied

The default format of the openssl genrsa output is in PKCS#1. To convert it to PCKS#8, execute the command:

openssl pkcs8 -topk8 -inform PEM -outform PEM -in client.key -out clientKey.pem -nocrypt

Connecting to a MongoDB Replica Set Copied

To connect to a MongoDB Replica Set, provide the necessary connection URI which can include a single or multiple replica set hosts. Additionally, the replicaSet option must be included in the connection URI.

["Geneos"] ["Geneos > Netprobe"] ["User Guide"]

Was this topic helpful?