MongoDB is an open source, distributed database that supports high availability and horizontal scaling. It is rapidly gaining popularity in developer communities. Because of its flexibility and distributed architecture, most MongoDB production environments are configured with at least three config-server nodes, two mongos-router nodes, and one or more shards containing three or more MongoDB replicas per shard. Additional shards can be added on-the-fly if your MongoDB cluster needs horizontal scaling. As a result of this, gathering MongoDB metrics can be difficult. Not so with Wavefront’s new MongoDB dashboard. [Editor’s Note: You can try Wavefront for free here.]
While MongoDB scales as you grow, its functionality can soon become a monitoring challenge with many daunting tasks for MongoDB Admins. In addition, to ensure high scale, you need to understand the performance and availability of the MongoDB database to avoid potential latency problems, throughput bottlenecks or unanticipated infrastructure effects.
Wavefront’s SaaS-based metrics-driven analytics platform and its included MongoDB integration can help a MongoDB Admin overcome monitoring challenges helping provide proactive notifications to avoid future database performance issues.
For example, the Wavefront MongoDB integration provides detailed shard-level metrics for replication, performance metrics for WiredTiger storage, and other MongoDB performance metrics. You can combine these application performance metrics with infrastructure-level metrics in a single-pane view to quickly discover overall system health. Here is an overview and step-by-step process that describes how to configure the Wavefront Telegraf input plugin for MongoDB.
• Make sure a Wavefront proxy is pre-installed and running. If not follow the instruction on how to install proxies by selecting Browse > Proxies > ADD NEW PROXY
• Verify network access between proxies and all MongoDB nodes where you will be installing the Telegraf agent.
The process of configuring Wavefront Telegraf input plugin for MongoDB consist of the following three steps:
1. Install the Wavefront Telegraf Agent
2. Configure the Telegraf Input Plugin for MongoDB
3. Restart the Wavefront Telegraf Agent
Install the Wavefront Telegraf Agent
To install the Telegraf agent, click on Integrations, find and click the MongoDB tile, click the Setup tab, and follow the setup instructions.
Configure the Telegraf Input Plugin for MongoDB
Gather the following information prior to configuring the Telegraf input plugin:
First, make a note of bindIP and port used from all the MongoDB nodes. This information can be found in /etc/mongod.conf or /etc/mongos.conf. Here is an example of bindIP and port used in a MongoDB config server.
# network interfaces
Next, create a file mongodb.conf in each MongoDB nodes inside /etc/telegraf/telegraf.d/ and copy the following snippet. Use the bindIP and port information that you obtained previously from /etc/mongod.conf.
- If you do not want to collect db.stats metrics set gather_perdb_stats = false
- Optional and based on your security configurations you may need to provide authentication and SSL information
# Read metrics from one or many mongodb servers
## An array of URLs of the form:
## “mongodb://” [user “:” pass “@”] host [ “:” port] ## For example:
servers = [“mongodb://10.xxx.xxx.xxx:27019”] ##Collects metrics exposed by db.stats
gather_perdb_stats = true
## Optional SSL Config
# ssl_ca = “/etc/telegraf/ca.pem”
# ssl_cert = “/etc/telegraf/cert.pem”
# ssl_key = “/etc/telegraf/key.pem”
## Use SSL but skip chain & host verification
# insecure_skip_verify = false
Restart the Telegraf Agent
sudo service telegraf restart
A few minutes after configuration is done, you should start seeing metrics from your MongoDB nodes. To view the metrics, you can go to Browse > Sources and type your MongoDB hostname in the search field. The results will display two sets of metrics. MongoDB metrics are listed with corresponding port numbers and system-level metrics are listed by hostname.
Metrics Collected by the Wavefront MongoDB Integration
The Telegraf input plugin for MonogoDB, mainly collects MongoDB related metrics and it also collects a set of system-level metrics from host VMs and containers. To view MongoDB application metrics collected by Wavefront, go to Integrations > MongoDB. You will find a list of all collected MongoDB application metrics.
The following metrics are collected by Wavefront MongoDB integration from a MongoDB cluster, consisting of mongos routers, config servers, MongoDB shards and replica-sets.
db.stat – Metrics from databases
WiredTigerStats – Wired Tiger Storage Engine cache metrics
WiredTigerExtStats – Wired Tiger Storage Engine metrics
ReplStats – Replication status metrics
The Wavefront MongoDB integration also includes out-of-the-box (OOTB) dashboards where you can find all of the metrics listed above. The beauty of Wavefront is in its easy customization and the power of the Wavefront Query Language. You can clone the MongoDB OOTB dashboards and modify, add, and remove charts based on your monitoring requirements. Or, correlate MongoDB metrics with both cloud service performance metrics or custom code performance metrics for end-to-end visibility.
In addition to MongoDB application metrics, the system-level metrics from MongoDB nodes provide visibility into CPU, memory, disk, network, swap, etc. You can aggregate and correlate metrics from numerous MongoDB nodes and display them in a single pane view. Then you can proactively set alerts and avoid future problems in your MongoDB clusters by using Wavefront’s MongoDB integration. Want to try it for yourself? Check out our free trial.Get Started with Wavefront Follow@vmw_rupesh Follow @WavefrontHQ
The post Monitor MongoDB Metrics for Better Scaling and Optimized Database Performance appeared first on Wavefront by VMware.