MongoDB Monitoring

Overview

MongoDB is a cross-platform, document oriented database that provides, high performance, high availability and easy scalability. MongoDB works on concept of collection and document.
We have created a monitor plug-in that monitors MongoDB. CMON will made connection to MongoDB database. After making connection with database, monitor will execute some MongoDB API function calls that will provide the health status of the MongoDB sever.
To make connection with MongoDB, user needs to provide connectivity credential to the monitor program, so that it can make connection to the database.

This monitor plugin we will capture following stats:

  • Global lock time
  • Operations currently queued, number waiting for the read-lock or write-lock
  • Total active connections, number of read and write operations
  • Memory metrics including bits, resident RAM, virtual memory, mapped memory, mapped memory with journaling
  • Current and available connections
  • Index counters including index access, hits and misses, resets
  • Background flushing metrics such as number of times, total time, average time, last time
  • Network traffic sent and received (in bytes), number of distinct requests received
  • Number of database operations including: insert, query, update, delete, get more, and total number of commands
  • Number of asserts since the server process started: regular, warnings, message, user, and number of times the rollover counter has rolled
  • Database related stats
  • Cluster related stats (status, health, and uptime)
Note: To make connectivity with Mongo DB, user should add Mongo jdbc jar in class-path.

MongoDB Components

Following are some key Component of MongoDB:

Database

Database is a physical container for collections. Each database gets its own set of files on the file system. A single MongoDB server typically has multiple databases.

Collection

Collection is a group of MongoDB documents. It is the equivalent of an RDBMS table. A collection exists within a single database. Collections do not enforce a schema. Documents within a collection can have different fields. Typically, all documents in a collection are of similar or related purpose.

Document

A document is a set of key-value pairs. Documents have dynamic schema. Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection’s documents may hold different types of data.

MongoDB Metrics

MongoDB Server Stats

Graph Name Data Type Description
MongoDB Up Time (Days) Sample Duration of time in days since the server is up.
MongoDB Current Connections Sample Number of current connections to the database server from clients. This number includes the current shell connection as well as any inter-node connections to support a replica set or sharded cluster.
MongoDB Available Connections Sample Number of unused available connections that the database can provide. Consider this value in combination with the value of Current to understand the connection load on the database.
MongoDB Global Lock Time (Sec) Cumulative Total time since the global Lock was started and created.
MongoDB Readers Lock Waiting Sample Number of operations waiting for the read-lock.
MongoDB Writers Lock Waiting Sample Number of operations waiting for the write-lock.
MongoDB Active Connections Sample Number of active client connections to the database.
MongoDB Readers Sample Number of readers performing read operations to the database.
MongoDB Writers Sample Number of writers performing write operations to database.
MongoDB Used Resident Memory (MB) Sample Amount of RAM in Megabytes currently used by the database process.
MongoDB Used Virtual Memory (MB) Sample Amount of virtual memory in Megabytes currently used by the mongod process.
MongoDB Mapped Memory (MB) Sample Amount of mapped memory in Megabytes currently used by the mongod process.
MongoDB Mapped With Journal Memory (MB) Sample Amount of mapped memory in Megabytes, including memory used for journaling.
MongoDB Received Throughput (Kbps) Sample Amount of network traffic received in kilo bits per seconds(kbps).
MongoDB Sent Throughput (Kbps) Sample Amount of network traffic sent in kilo bits per second(kbps).
MongoDB Requests/Min Rate Number of distinct requests that the server has received per minute.
MongoDB Inserts/Sec Rate Number of insert operations to database per second.
MongoDB Queries/Sec Rate Number of query operations to database per second.
MongoDB Updates/Sec Rate Number of update operations to database per second.
MongoDB Deletes/Sec Rate Number of delete operations to database per second.
MongoDB Commands/Sec Rate Number of commands issued to database per second.
MongoDB Message Assertions/Sec Rate Number of message assertions raised per second. Message asserts indicate internal server exceptions.
MongoDB Warning Assertions/Sec Rate Number of warning assertions raised per second. Warning asserts indicate things that might be worth checking like too low ulimit or readahead.
MongoDB Regular Assertion/Sec Rate Number of regular assertions raised per second. Regular asserts are per-operation invariants (e.g. “unexpected failure while reading a BSON document”).
MongoDB User Assertions/Sec Rate Number of assertions corresponding to errors generated by users per second. User asserts are triggered as the result of user operations or commands generating an error like a full disk space, a duplicate key exception, or write errors (e.g. insert not properly formatted, or no access right).

MongoDB Database Stats

Graph Name Data Type Description
MongoDB Average Object Size (MB) Sample Average size of each document in Megabytes. This is the dataSize divided by the number of documents.
MongoDB Collections Count Sample Number of collections in that database.
MongoDB Data Size (GB) Sample Total size in Gigabytes of the data held in this database including the padding factor.
MongoDB Indexes Sample Total number of indexes across all collections in the database.
MongoDB Indexes Size (MB) Sample Total size in Megabytes of all indexes created on this database.
MongoDB Extents Sample Number of extents in the database across all collections.
MongoDB Objects Sample Number of objects (i.e. documents) in the database across all collections.
MongoDB Storage Size (GB) Sample Total amount of space in Gigabytes allocated to collections in this database for document storage.

MongoDB Collection Stats

Graph Name Data Type Description
MongoDB Collection Documents Sample Number of objects or documents in this collection.
MongoDB Collection Size (MB) Sample Size of the data stored in this collection in Megabytes.
MongoDB Collection Average Object Size Sample The average size of an object in the collection in Megabytes.
MongoDB Collection Document Storage Size (MB) Sample Total amount of storage allocated to this collection for document storage in Megabytes.
MongoDB Collection Index Count Sample Number of indexes on the collection. All collections have at least one index on the _id field.
MongoDB Collection Index Size (MB) Sample Total size of all indexes in Megabytes.