MongoDB

Supported Versions

Confirmed support for metrics, configuration data and manual tracing: versions 3.2 to 3.7 and 4.0 to 4.1.

Sensor (Data Collection)

Tracked Configuration

  • Version
  • Port
  • Storage engine
  • Databases

Metrics

Database Activity

Metric Description
Read Number of documents read
Inserted Number of documents inserted
Uploaded Number of documents uploaded
Deleted Number of documents deleted

Clients

Metric Description
Connections Number of current active clients connected to MongoDb server.

Databases (per database)

Metric Description
Database Size Database size

Replica Set (if exists)

Metric Description
Apply Ops Number of internal apply operations
Apply Batches Number of internal apply batches
Apply Batches Total (ms) Duration of apply batches in milliseconds
Buffer Count Number of buffers
Buffer Size Buffer size
Network Ops Number of network operations
Network Bytes Size of network operations
Preload Docs Number of preload docs operation
Preload Docs Total (ms) Duration of preload docs in milliseconds
Preload Idx Number of preload idx operation
Preload Idx Total (ms) Duration of preload idx in milliseconds
Replication Lag Delay between a write operation on the primary and its copy to a secondary (milliseconds)

Health Signatures

The Instana MongoDB sensor will conduct custom health checks. If the checks fail for given time period, an issue will be raised to inform the user.

Health Description
Background Flushing Database reports increasing background flushing latency (sampling in sliding window of 150 seconds)
Host Dependency Cpu Steal Database might not get sufficient CPU, which can lead to lower throughput (triggered instantly, reported by Instana Host sensor)
Host Dependency Cpu Wait Database might be either overloaded, or indexes might be missing (triggered instantly, reported by Instana Host sensor)
Host Dependency Load Database might be either overloaded, or indexes might be missing (triggered instantly, reported by Instana Host sensor)
Journal Write Lock Journal commits in write lock growing (sampling in sliding window of 150 seconds)
Lock Queue Continuously increasing lock queue length (sampling in sliding window of 150 seconds)
Non-mapped virtual memory Too high ratio of non-mapped virtual memory (triggered instantly, reported by Instana Host sensor)
Page faults Increasing page faults (sampling in sliding window of 150 seconds)
Replication Lag Replication lag is growing (sampling in sliding window of 150 seconds)
Replica Set Member Down The member, as seen from another member of the set, is unreachable.

Configuration

Required Server/Database Permissions

To monitor MongoDB, Instana users must have access to the following:

  • list databases
  • serverStatus command.

If clustered:

  • local.system.replset
  • admin.replSetGetStatus on the primary node.

In a mongo shell, create a read-only user for the Instana Agent in the admin database:

Authenticate as the admin user.

use admin
db.auth("admin", "YOUR_MONGODB_ADMIN_PASSWORD")

On MongoDB >= 3.x, use the createUser command.

db.createUser({
  "user":"stan",
  "pwd": "UNIQUEPASSWORD",
  "roles" : [
    {role: 'read', db: 'admin' },
    {role: 'clusterMonitor', db: 'admin'},
    {role: 'read', db: 'local' }
  ]
})

In order to enable in depth metric monitoring, you need to inform the Agent about the credentials to access monitoring information. You can configure it in the agent <agent_install_dir>/etc/instana/configuration.yaml:

com.instana.plugin.mongodb:
  user: 'stan'
  source: 'admin'
  password: 'UNIQUEPASSWORD'

Notes:

  • source refers to the database or authentication source the user is defined. Please refer to the MongoDB documentation for more details.

SSL/TLS support

In order to enable Instana agent to securely connect to your MongoDB server, agent needs to be configured in <agent_install_dir>/etc/instana/configuration.yaml:

com.instana.plugin.mongodb:
  ...
  sslTrustStore: '/path/to/truststore.jks'
  sslTrustStorePassword: 'mongoTsPassword'
  sslKeyStore: '/path/to/sslKeyStoreFile.jks'
  sslKeyStorePassword: 'mongoKsPassword'

Keys need to be in Java Keystore format (JKS), those can be created using keytool.

Note: This will enable the Instana agent to connect to MongoDB server via SSL. Once it is connected, credentials (user/password) will be used to access the auth-database.