MongoDB

Introduction

MongoDB is a popular open source database option that uses document-oriented data model.  Documents in MongoDB comprise sets of key-value pairs and are the basic unit of data in MongoDB.  Sets of documents are called collections and are functionally equivalent to relational database tables.

In this article, we'll go over all necessary specific details for managing the OpsClarity - MongoDB service integration:

 

Requirements

 

Configure MongoDB Data Sources

There is one default MongoDB data source under the Configure Data Sources tab:

 

These are the field names (along with their default values) and a detailed description of what should go in each field under the Kafka Producer JMX data source:

Field Name Default Value Description
Host 127.0.0.1

Host, localhost
Ex. localhost, 127.0.0.1
Opsclarity Magic host    _HOST:<port>_ 
Example _HOST:27017_

Port 27012 Port number
User Name empty MongoDB user name
Password empty Password for the user 
Path to Password File empty Absolute path to the Password File
Path to PemKey File empty Absolute path to the Pem key file
Path to Certificate File empty Absolute path to the Certificate file
Run as Unix User empty To run this operation as another user, populate this field.

Take note that the MongoDB user here doesn't need write access to the Database, but at a minimum he should have the "ClusterMonitor" role assigned. You can create a monitor user by running the following command:

 db.createUser({"user":"monitor_user", "pwd" : "test_monitor", "roles":[{"role":"clusterMonitor", "db":"admin"}]})

 

MongoDB Default Monitors

For help with adding and configuring new monitors, click here.  There are four default monitors that are already created for you in a newly added MongoDB service:

Monitor Metric Description
Overall Service Health Multiple This is a rollup of the health of all service monitors.
Default MongoDB Port Monitor  - Reaches out to a specified port with a ping request a specified number of times in a 30 second window.
Connection Count connections.service Detects unexpected behavior in Connection Count.
Operations Count Multiple Detects unexpected behavior in Operations Count.

 

 

MongoDB Metrics

These are the metrics we count for MongoDB:

Metric Name Units Metric Description
db.size Bytes Number of connected slaves across all master nodes.
connections.service Connections Number of connections to the database server from clients, including current one, across the cluster.
current.connections Connections Number of connections to the database server from clients, including current one.
database.size Bytes Total size in bytes of the data held in this database including the padding factor.
memory.used.service Bytes Amount of RAM, in bytes, currently used by the database process, across the cluster.
memory.used Bytes Amount of RAM, in bytes, currently used by the database process.
commands.total.service Ops/Sec Number of commands issued to the database per second, across the cluster.
commands.total Ops/Sec Number of commands issued to the database per second.
deletes.total.service Ops/Sec Number of delete operations received per second, across the cluster.
deletes.total Ops/Sec Number of delete operations received per second.
getmore.total.service Ops/Sec Number of getmore operations received per second, across the cluster.
getmore.total Ops/Sec Number of getmore operations received per second.
inserts.total.service Ops/Sec Number of insert operations received per second, across the cluster.
inserts.total Ops/Sec Number of insert operations received per second.
queries.total.service Queries/Sec Number of queries received per second, across the cluster.
queries.total Queries/Sec Number of queries received per second.
updates.total.service Ops/Sec Number of update operations received per second, across the cluster.
updates.total Ops/Sec Number of update operations received per second.

 

 

Verification

Opsclarity MongoDB plugin, executes the following commands, to obtain mongodb metrics.

mongo --username monitor_user --password test_monitor  --eval "printjson(db.serverStatus())"
mongo --username monitor_user --password test_monitor  --eval "printjson(db.serverStatus().connections)"
mongo --username monitor_user  --password test_monitor  --eval "printjson(db.adminCommand('listDatabases'))"

SSL Based Authentication:
 
AllowInvalidCertifactes and AllowInvalidHostnames  are enabled by default.
 
 
 
If you have any questions or comments about this article, feel free to contact us at support@opsclarity.com.
 
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.