Scott Wardrop from AIDEV told me that they produced a plugin for Oracle Enterprise Manager Cloud Control 12c to monitor MongoDB. We use MongoDB in our production systems, so I decided to examine the plugin and write a blog post about it. Unfortunately version of our MongoDB databases are too old (2.4.x series) so the plugin didn’t work. Of course, it didn’t stop me. We created a simple MongoDB Cluster environment to test the MongoDB plugin for EM12c.
Becasue the installation is well documented by the vendor, I will not give a step by step installation guide. You can find the installation document on the download page. By the way, you need to manually download and deploy the plugin using EMCLI. Before you start deployment, send an email to info@aidev.uk for the unlock password (of the zip file). After you receive the password, download the latest plugin zip file, unzip it and run EMCLI:
cd /home/oracle wget http://www.aidev.uk/12.1.0.3.0_aidev.mongo.xdbs_2000_0.zip unzip 12.1.0.3.0_aidev.mongo.xdbs_2000_0.zip emcli import_update -file=/home/oracle/12.1.0.3.0_aidev.mongo.xdbs_2000_0.opar -omslocal
After the installation is done, you need to deploy it to the OMS, and to the agents running on MongoDB servers.
Before you add the MongoDB targets using “Add Targets Declaratively by Specifying Target Monitoring Properties”, you also need to make some preparation on target MongoDB database and server. First you need to create a “monitoring” user. Login to target MongoDB database and run the following scripts:
use admin db.createRole( { role: "emRole", privileges: [ { resource: { db: "admin", collection: "system.users" }, actions: [ "find" ] }, { resource: { db: "admin", collection: "system.roles" }, actions: [ "find" ] } ], roles: [ { role: "clusterMonitor", db: "admin" } ] } ) db.createUser( { user: "em_monitor", pwd: "", roles: [ { role: "emRole", db: "admin" } ] } )
The above script creates a new role (emRole) and give required permission to read-only access to MongoDB cluster/database, then it will create a new user and assign the emRole role to it. Don’t forget to modify the password. The plugin will need some JAR files, so download org.json libraries v20140107 and mongDB java driver v2.13.1 from http://search.maven.org/ to the target server(s). Be careful about the version numbers! The deployment document shows the correct versions and you should download exact versions. These files should be accessible by the user running EM agent.
When everything is ready, you can add the mongoDB database target. Click setup > add target > add target manually, pick the server, enter the target name, the user name (you created in MongoDB), the folder which contains jar files, MongoDB port number and then click OK. The plugin can monitor both mongos and mongod instances. If you’ll monitor a MongoDB cluster, I recommend you to add all nodes, config servers, database nodes and mongos instances to EM12c system.
If you connect mongos instance, you won’t be able to use “top waits” and “clients” page (these pages will be blank). On the other hand, to check the database sizes of the cluster, you need to connect mongos instances.
The MongoDB plugin shows very detailed information including replication info (when connected to database nodes), sharding information (when connected to mongos instances).
You can see how much disk storage used by each database, their growth history, connections, locks and many more. It is surely well designed and fetch all the useful information provided by MongoDB.
It’s also very useful to be able to see the logs of the instance.
One of the interesting feature of the plugin is, you can create javascript jobs to run on MongoDB servers. When testing this feature, I’ve found a small error about the path of the mongodb client. When creating a javascript job, instead of entering full path of the executable, you need to enter the path of the bin directory, because the plugin will add “mongo” to the path. I’m sure it will be fixed soon.
I liked the plugin, and I recommend you to use it if you want to monitor MongoDB clusters with EM12c. It’s really easy to connect Scott (the developer of the plugin) and ask questions, even ask new features By the way, I do not know the price but the plugin is not free. On the other hand, you can test it for 31 days at no cost.