MongoDB Moduleedit

This module periodically fetches metrics from MongoDB servers.

Module-Specific Configuration Notesedit

When configuring the hosts option, you must use MongoDB URLs of the following format:

[mongodb://host[:port][?options]

The URL can be as simple as:

- module: mongodb
  hosts: ["localhost"]

Or more complex like:

- module: mongodb
  hosts: ["mongodb://myuser:mypass@localhost:40001", "otherhost:40001"]

In case you use username and password in the hosts array, this information will be sent with each event as part of the metricset.host field. To prevent sending username and password the config options username and password can be used.

- module: mongodb
  metricsets: ["status"]
  hosts: ["localhost:27017"]
  username: root
  password: test

Compatibilityedit

The MongoDB metricsets were tested with MongoDB 3.0 and are expected to work with all versions >= 2.8.

Example Configurationedit

The MongoDB module supports the standard configuration options that are described in Modules Configuration. Here is an example configuration:

metricbeat.modules:
#- module: mongodb
  #metricsets: ["status"]
  #enabled: true
  #period: 10s

  # The hosts must be passed as MongoDB URLs in the format:
  # [mongodb://][user:pass@]host[:port].
  # Warning: specifying the user/password in the hosts array is possible
  # but it will result in the password being present in the output documents.
  # We recommend using the username and password options instead.
  #hosts: ["localhost:27017"]

  # Username to use when connecting to MongoDB. Empty by default.
  #username: user

  # Password to use when connecting to MongoDB. Empty by default.
  #password: pass

Metricsetsedit

The following metricsets are available: