You are here

MongoDB Monitoring

Download version    6    5

Included in Opsview 5
Included in Opsview 6
check_circle
Opsview Supported

MongoDB Opspack

MongoDB is a cross-platform, document-oriented database program and represents its documents in a binary-encoded JSON format called BSON (Binary JSON). The lightweight binary format adds speed to the flexibility of the JSON format, along with more data types. Fields inside MongoDB documents can also be indexed.

Mongo DB allows users to be agile and follow a stable process when running the most critical applications. Here are a few other highlight features:

  • Expressive query language & secondary indexes
  • Enterprise management and integration
  • Strong consistency
  • Always-on global deployments

What You Can Monitor

Opsview Monitor contains all the important service checks to make sure your MongoDB Server is up and running. Service Checks for MongoDB include:

  • CPU information for all of your MongoDB instances
  • Memory statistics including MongoDB_config and arbiter
  • Page Faults, database size, replication state and more

Service Checks

Service Check
asserts
chunks_balance
collection_indexes
collection_size
collection_state
collection_storageSize
connect_primary
connections
database_indexes
database_size
databases
flushing
index_miss_ratio
journaled
journal_commits
last_flush_time
memory
memory_mapped
opcounters
oplog
page_faults
queries_per_second
queues
replication_lag
replication_lag_percent
replset_quorum
replset_state
row_count
write_data_files

Database - MongoDB Opspack

MongoDB is a cross-platform, document-oriented database program and represents its documents in a binary-encoded JSON format called BSON (Binary JSON). The lightweight binary format adds speed to the flexibility of the JSON format, along with more data types. Fields inside MongoDB documents can also be indexed.

Mongo DB allows users to be agile and follow a stable process when running the most critical applications. Here are a few other highlight features:

  • Expressive query language & secondary indexes
  • Enterprise management and integration
  • Strong consistency
  • Always-on global deployments

What You Can Monitor

Opsview Monitor contains all the important service checks to make sure your MongoDB Server is up and running. Service Checks for MongoDB include:

  • CPU information for all of your MongoDB instances
  • Memory statistics including MongoDB_config and arbiter
  • Page Faults, database size, replication state and more

Service Checks

Service Check Description
MongoDB - Asserts Number of asserts
MongoDB - Chunks Balance Checks chunks are balanced across shards
MongoDB - Collection Indexes Index size of collection
MongoDB - Collection Size Size of the collection
MongoDB - Collection State Check connectivity to the collection
MongoDB - Collection Storage Size Storage size of the collection
MongoDB - Connect Primary Primary connection check
MongoDB - Connection Number of available connections being used
MongoDB - Database Indexes Database index size
MongoDB - Database Size Storage size of the database
MongoDB - Databases Number of databases
MongoDB - Flushing Average time to perform a background flush
MongoDB - Index miss Ratio Index counters miss ratio
MongoDB - Journal Average amount of data written to the recovery log (MB) in the last 4 seconds
MongoDB - Journal Commits Number of commits performed whilst in the databases write lock
MongoDB - Last Flush Time Time taken to perform the last background flush
MongoDB - Memory Total system memory
MongoDB - Memory Mapped Amount of mapped memory
MongoDB - Opcounters Number of queries per second
MongoDB - Oplog Operation log metrics
MongoDB - Page Fault Number of page faults
MongoDB - Queries Per Second Number of queries per second
MongoDB - Queue Queue metrics
MongoDB - Rep Lag Replication lag in seconds
MongoDB - Rep Lag Percent Replication lag percent
MongoDB - Replset Quorum Status of members
MongoDB - Replset State State of replset
MongoDB - Row Count Number of rows
MongoDB - Write Data Files Average amount of data in megabytes written to the databases datafiles in the last four seconds

Setup and Configuration

Download and install required packages

Pymongo is required to run this plugin and can be installed on your system by running: - apt-get install python-pip - pip install pymongo

This will install the latest version of pymongo to your system.

Setup for using all service checks

To get all the service checks working correctly, MongoDB must be set up with a database, collection, sharding and replicaset. Any of the service checks that are not needed should be disabled.

If you are not running sharding, then Chunks Balance should be disabled.

If MongoDB is running without replSet, then Rep Lag, Rep Lag percentage, Replset Quorum and Replset State should be disabled.

If you are running a MongoDB 3.2+ system, then Journal, Journal Commits and Write Data Files should be disabled as it uses WiredTiger as its storage engine.

Create a user with appropriate role for plugin to login as with MongoDB

In order for this Opspack to work, it queries the admin database to get system-wide statistics about the database deployment.

It is recommended to set up a user in a role with permissions (at least) 'ClusterMonitor', as this role "Provides read-only access to monitoring tools for administering the whole system rather than just a single database".

For example, to create a user 'Opsview' with password 'Opsview' and role 'clusterMonitor':

  • db = db.getSiblingDB("admin");
  • db.createUser( { user:"opsview",pwd:"opsview",roles:["clusterMonitor"] } );

The Opspack can then use these credentials, which you enter into Opsview, to login and query metrics.

You are at liberty to instead allow Opsview to login as an already existing user with at least this level of role access.

To configure and utilize this Opspack, you simply need to add the 'Database - MongoDB' Opspack to your Opsview Monitor system.

Step 1: Add the host template

Add host template

Step 2: Add and configure variables required for this host

Add variables

Step 3: Reload and the system will now be monitored

View Service Checks

Setup and Configuration

Pymongo is required to run this plugin and can be installed on your system by running:

/opt/opsview/python/bin/pip install pymongo

This will install the latest version of pymongo to your system.

For more information, refer to Installing PyMongo

Setup for using all service checks

To get all the service checks working correctly, MongoDB must be set up with a database, collection, sharding and replicaset. Any of the service checks that are not needed should be disabled.

If you are not running sharding, then Chunks Balance should be disabled.

If MongoDB is running without replSet, then Rep Lag, Rep Lag percentage, Replset Quorum and Replset State should be disabled.

If you are running a MongoDB 3.2+ system, then Journal, Journal Commits and Write Data Files should be disabled as it uses WiredTiger as its storage engine.

Create a user with appropriate role for plugin to login as with MongoDB

In order for this Opspack to work, it queries the admin database to get system-wide statistics about the database deployment.

It is recommended to set up a user in a role with permissions (at least) 'ClusterMonitor', as this role "Provides read-only access to monitoring tools for administering the whole system rather than just a single database".

For example, to create a user 'Opsview' with password 'Opsview' and role 'clusterMonitor':

db = db.getSiblingDB("admin");
db.createUser( { user:"opsview",pwd:"opsview",roles:["clusterMonitor"] } );

The Opspack can then use these credentials, which you enter into Opsview, to login and query metrics.

You are at liberty to instead allow Opsview to login as an already existing user with at least this level of role access.

Step 1: Add the host template

Add the Database - MongoDB Host Template to your Opsview Monitor host.

Add host template

For more information, refer to Opsview Knowledge Center - Adding Host Templates to Hosts.

Step 2: Add and configure variables required for this host

Variable Description
MONGODB_CREDENTIALS Used in authenticating with MongoDB. Override the Username and Password with your credentials.
MONGODB_DATABASES Used to select the database to monitor. Set the value to your database name and override the Collection and Replicaset with your details.

Add variables Add variables

For more information, refer to Opsview Knowledge Center - Adding Variables to Hosts.

Step 3: Apply changes and the system will now be monitored

View Service Checks

v1.0-opsview-5

ODI-6 - MongoDB Opspack

Initial release for MongoDB Opspack

v2.0-opsview-6

ODI-1154 Release Opspacks for Opsview Monitor 6.0

Initial release of Opspack to work with Opsview Monitor 6.0