MongoDB Metrics with InstrumentalD

MongoDB logo

The best way to get MongoDB metrics into Instrumental is with InstrumentalD, the fast and reliable server agent created by the Instrumental team. By using InstrumentalD to collect MongoDB metrics, you'll get premade MongoDB graphs and unlock the full power of our Query Language.

Quick Start

Check out our Getting Started Guide for all the details. Otherwise, here's the bare minimum to get up and running. (You'll need a project token.)

brew install instrumental/instrumentald/instrumentald
echo 'mongodb = ["localhost:27017"]' > instrumentald.toml
instrumentald -c instrumentald.toml -k PROJECT_TOKEN
curl https://packagecloud.io/install/repositories/expectedbehavior/instrumental/script.deb.sh | sudo bash
sudo apt-get install instrumentald
echo 'mongodb = ["localhost:27017"]' > instrumentald.toml
instrumentald -c instrumentald.toml -k PROJECT_TOKEN
curl https://packagecloud.io/install/repositories/expectedbehavior/instrumental/script.rpm.sh | sudo bash
sudo yum install instrumentald
echo 'mongodb = ["localhost:27017"]' > instrumentald.toml
instrumentald -c instrumentald.toml -k PROJECT_TOKEN

Configuring InstrumentalD

InstrumentalD will collect the metrics below from as many MongoDB servers as configured. Here's a basic example of the MongoDB config:

mongodb = ["root@tcp(localhost:3306)/"]

Everything you need to know about configuring InstrumentalD, including more information about MongoDB config, can be found in the InstrumentalD Configuration docs.

Metrics Collected

All MongoDB metrics collected by InstrumentalD follow this pattern:

mongodb.<mongo server hostname>.<metric>

The following metrics are collected:

Database Thread/Worker Activity Metrics

active_reads Number of threads currently reading
active_writes Number of threads currently writing
queued_reads Number of waiting read operations
queued_writes Number of waiting write operations
ttl_deletes_per_sec Number individual ttl-index deletes, on average, per second
ttl_passes_per_sec Number of scans for ttl-index deletes, on average, per second

Database Operations ("opcounters")

commands_per_sec Number of general commands, on average, per second
deletes_per_sec Number of documents deleted, on average, per second
flushes_per_sec Number of calls to fsync, on average, per second
getmores_per_sec Number of getmore commands against cursors, on average, per second
inserts_per_sec Number of documents inserted, on average, per second
queries_per_sec Number of find commands, on average, per second
updates_per_sec Number of update commands, on average, per second

Network Activity

net_in_bytes Number of bytes of network input
net_out_bytes Number of bytes of network output
open_connections Number of average open connections during the period

Shard Balancing Stats

jumbo_chunks Number of open chunks detected (mongos/mongo config only)

Server Capacity (mmapv1 storage engine)

mapped_megabytes Number of megabytes mapped to files
non-mapped_megabytes Number of megabytes not mapped to files
page_faults_per_sec Number of page faults, on average, per second
resident_megabytes Amount of memory being used by mongodb
vsize_megabytes Virtual size of mapped database - approximately total database size

Server Capacity (wiredTiger storage engine)

percent_cache_dirty Percentage of wiredTiger cache waiting to be written
percent_cache_used Percentage of wiredTiger cache currently in use
resident_megabytes Amount of memory being used by mongodb
vsize_megabytes Virtual size of database - this will be larger than the actual size on disk

Replica Set Monitoring

repl_commands_per_second Commands per second from replset primary
repl_deletes_per_sec Deletes per second from replset primary
repl_getmores_per_second Getmores per second from replset primary
repl_inserts_per_second Inserts per second from replset primary
repl_queries_per_second Queries per second from replset primary
repl_updates_per_second Updates per second from replset primary
repl_lag How far (seconds) this server is behind the replset primary

How many metrics can I expect from InstrumentalD?

InstrumentalD will collect between 22 and 30 unique metrics per MongoDB server configured.

Suggested Graphs

The following graphs are based on the metrics collected by InstrumentalD, and provide great starting point for monitoring MongoDB.

Log in or sign up to add them to your project.