Mongo Monitor : Mongo Current Operations monitoring by lite application
Introduction
In this blog, we have mentioned how we can monitor the current operations of MongoDB instances with a small application developed by us. Its light weight application was developed using Nodejs, HTML, and javascript. It’s a very helpful application to monitor running queries on MongoDB and do the analysis on it:
Pre-requisite :
-
- Nodejs and npm.
- Network connectivity between MongoDB and the application
- MongoDB Database user to authenticate the application with the database.
- Browser : Chrome, Edge, Firefox
Git Download Link :
How to Install / Use :
-
- Create a database user on the MongoDB database with limited privileges (clustermonitor) to fetch the current operation data.
use admin; db.createUser({ user: "mongomon", pwd: "yourStrongPassword", roles: [ { role: "clusterMonitor", db: "admin" }, { role: "read", db: "admin" } ] })
-
- Download the git repo from the download link.
- Make a change in the config file with the host and port of your Mongo instance.
- Go to the path where the repo is downloaded and open a terminal.
- Run command : node ./app.js
- Now open the link on browser: http://localost:3000
- Login to the application using the newly created database user.
- Click on the current ops button.
- You will see the current operations running on the database by the user. operation id, query, seconds running ( in millis ), app name ( if exists ), and index used by the query.
Conclusion
Here we are monitoring our Mongo long running queries / current operations using our lite application. In this application you can efficiently monitor your Mongo queries with only analytical information.