MongoDB is a popular cross-platform document-oriented database. Classified as a NoSQL database, MongoDB avoids the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas, making the integration of data in certain types of applications easier and faster.

The Librato Agent allows you to easily monitor MongoDB’s health and performance. We use a custom collectd plugin to gather metrics from your running MongoDB instance(s).

Create the Integration

The MongoDB integration depends on the Librato Agent. If you haven’t already, you will first need to install the Librato Agent. Once this is complete, select the MongoDB icon in the integrations catalogue.


Toggle the Enabled switch to activate the MongoDB integration on your Librato account and create the preconfigured MongoDB space.


At this point any MongoDB metrics associated with this integration will be allowed through your Librato Agent service-side filters.

Plugin Configuration

Librato Agent provides a default /opt/collectd/etc/collectd.conf.d/mongodb.conf configuration file, which must be edited to suit your environment.

<LoadPlugin python>
  Globals true

<Plugin python>
  ModulePath "/opt/collectd/share/collectd"
  ModulePath "/opt/collectd/share/collectd/pymongo.egg"

  Import "collectd-mongodb"

  <Module "collectd-mongodb">
    # Host ""
    # Port "27017"
    # User "username"
    # Password "password"
    # Database "admin"
    # Name "mongodb"

If necessary, update Host and Port to the host and port corresponding to your MongoDB instance. If authenication has been enabled for your MongoDB deployment, set User and Password to a user who has access to the admin database. Use the Name configuration parameter to set the plugin instance for the reported metrics, which is mongodb by default.

By default, the plugin will gather and report storage metrics for the admin database using the dbstats command. You can use the Database configuration parameter to instruct the plugin to report storage metrics on other databases. If specified, Database must be a space-separated list of database names, starting with admin. For example, to report storage metrics for the database named orders, configure Database as shown below.

Database "admin" "orders"

Note: You must restart the agent after any changes to your Librato Agent configuration files.

$ sudo service collectd restart

At this point you should begin seeing librato.mongodb.* metrics in your Librato account.

MongoDB Workspace

Visit your MongoDB preconfigured spaces to observe your new metrics as they stream in.


Use our dynamic source field at the top to filter your view to a specific MongoDB instance or subset of metric sources. For example, to isolate the view to the MongoDB instance associated with the name production, use a dynamic source value of *.production.


For specific answers to Librato Agent questions check out our Librato Agent FAQ.

Let us know what you think when you take this for a spin. We would love to incorporate your feedback and any new dashboards you design into the ongoing development of this key server monitoring technology.