MongoDB

The MongoDB Integration allows you to ingest and monitor the performance and health metrics of your NoSQL database instances. This integration is useful for tracking the total number of active connections and operations executed within your instances, the total space allocated to database indexes, and the count of all document operations executed.

Prerequisites

Middleware Host Agent (MW Agent) must be installed on your local machine. To install the MW Agent, see our Installation Guide.

Setup

Step 1: Create Database Credentials

Create a .yaml file containing database credentials like the below example. If the database is not password protected, the username and password fields can be removed.

For Docker users, create the credentials yaml file in the /var/log directory.

/home/ubuntu/mongodb-creds.yaml

Config AttributeDescription
endpointEndpoint for mongodb connection.Required.
usernameUsername for mongodb connection.Required.
passwordPassword for mongodb connection.Required.
profiling_levelSpecifies which mongodb query operations should be profiled. Possible value are 0, 1, 2. Profiling level 0 will disable query profiling, 1 will profile queries based on slow_ms and 2 will profile all queries.Optional.
slow_msSpecifies which mongodb query operations should be profiled based on slow_ms in milliseconds. Works only for profiling level 1.Optional.

Step 2: Access Integrations

Log in to Middleware, navigate to the Installations Page in the bottom left corner, select All Integration and click MongoDB

Step 3: Enable Integration

Add a host machine from the dropdown list, input the credential path from Step 1, and Save

Visualize Analytics

Default MongoDB Dashboard

Once the MongoDB integration setup is complete, a new MongoDB-specific dashboard will appear in the Dashboard Builder. This default dashboard serves as a jumping off point for visualizing and analyzing MongoDB data.

Create MongoDB Widget

MongoDB data can be added to dashboards as a custom widget. When adding a new widget, select the mongodb data source to view a full list of available MongoDB data.

The exhaustive list for MongoDB metrics can be seen here

Alerts

Alerts can be configured for any MongoDB metrics. When creating a new rule select the Database detection method and MongoDB database type for available metrics to appear in the Metrics dropdown list. Select the desired metric and continue configuring the alert conditions.

Metrics Collected

MetricDescription
mongodb.cache.operationsNumber of cache operations
mongodb.collection.countNumber of collections
mongodb.data.sizeSize of the collection, data compression does not affect this value
mongodb.connection.countNumber of connections
mongodb.extent.countNumber of extents
mongodb.global_lock.timeTotal time the global lock has been held
mongodb.index.countNumber of indexes
mongodb.index.sizeTotal space allocated to all database indexes, including free index space
mongodb.memory.usageAmount of memory used
mongodb.object.countNumber of objects
mongodb.operation.latency.timeTotal latency of operations
mongodb.operation.countNumber of operations executed
mongodb.operation.repl.countNumber of replicated operations executed
mongodb.storage.sizeTotal amount of storage allocated to this collection
mongodb.database.countNumber of existing databases
mongodb.index.access.countNumber of times an index has been accessed
mongodb.document.operation.countNumber of document operations executed
mongodb.network.io.receiveNumber of bytes received
mongodb.network.io.transmitNumber of bytes transmitted
mongodb.network.request.countNumber of requests received by a server
mongodb.operation.timeTotal time spent performing operations
mongodb.session.countTotal number of active sessions
mongodb.cursor.countNumber of opened cursors maintained for clients
mongodb.cursor.timeout.countNumber of cursors that have timed out
mongodb.lock.acquire.countNumber of times a lock was acquired in the specified mode
mongodb.lock.acquire.wait_countNumber of times lock acquisitions encountered waits due to locks held in conflicting modes
mongodb.lock.acquire.timeCumulative wait time for the lock acquisitions.
mongodb.lock.deadlock.countNumber of times lock acquisitions encountered deadlocks
mongodb.healthHealth status of the server
mongodb.uptimeAmount of time the server has been running

Troubleshooting

Missing Integrations Menu

If you do not see the Integrations Menu in Middlware, that means your account has not been granted Installation permissions. Contact your system administrator to add the Installation permission to your user role in Settings.

Next Steps

Need assistance or want to learn more about Middleware? Contact our support team in Slack.