Created: 2011-07-15 19:43
Updated: 2019-02-16 05:40
License: mit


collectd-mongodb is a collectd plugin that collects statistics from a MongoDB server.

This plugin is a direct port of the MongoDB C plugin that will be part of collectd 5.1, it works with Collectd 4.9.x and 4.10.x.



The plugin has some configuration options even though none are mandatory. This is done by passing parameters via the config section in your Collectd config. The following parameters are recognized:

  • User - the username for authentication
  • Password - the password for authentication
  • Host - hostname or IP address of the mongodb server defaults to
  • Port - the port of the mongodb server defaults to 27017
  • Database - the databases you want to monitor defaults to "admin". You can provide more than one database. Note that the first database must be "admin", as it is used to perform a serverStatus()

The following is an example Collectd configuration for this plugin:

<LoadPlugin python>
    Globals true

<Plugin python>
    # is at path /opt/collectd-plugins/
    ModulePath "/opt/collectd-plugins/"

    Import "mongodb"
    <Module mongodb>
        Host ""
        Password "password"
        Database "admin" "db-prod" "db-dev"

The data-sets in types.db need to be added to the types.db file given by the collectd.conf TypesDB directive. See the types.db(5) man page for more information.

If you're monitoring a secured MongoDB deployment, declaring a user with minimal read-only roles is a good practice, such as :

db.createUser( {
  user: "collectd",
  pwd: "collectd",
  roles: [ { role: "readAnyDatabase", db: "admin" }, { role: "clusterMonitor", db: "admin" } ]
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more