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.
Librato Agent provides a default
configuration file, which must be edited to suit your environment.
<LoadPlugin python> Globals true </LoadPlugin> <Plugin python> ModulePath "/opt/collectd/share/collectd" ModulePath "/opt/collectd/share/collectd/pymongo.egg" Import "collectd-mongodb" <Module "collectd-mongodb"> # Host "127.0.0.1" # Port "27017" # User "username" # Password "password" # Database "admin" # Name "mongodb" </Module> </Plugin>
If necessary, update
Port to the host and port corresponding to
your MongoDB instance. If authenication has been enabled for your MongoDB deployment,
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,
mongodb by default.
By default, the plugin will gather and report storage metrics for the
database using the
dbstats command. You can use the
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,
admin. For example, to report storage metrics for the database named
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.
Visit your MongoDB preconfigured spaces to observe your new metrics as they stream in.