Getting Started with Mongo Monitoring Service (MMS) on OpenShift

If you care about your customers and your business, you probably have some system in place to monitor the health of your IT infrastructure.  For those of you familiar with software like Nagios, you already understand how important it is to monitor the pulse of your services.  The great folks over at 10gen have built a Mongo Monitoring Service for MongoDB that takes the hassle out of setting up your own monitoring service for MongoDB.  MMS does much more than make sure that MongoDB is up and running.  The agent that runs on your MongoDB server reports back information such as opcounters, memory information, number of connections, network in/out, db storage size, and more.  All of this information is displayed with draggable charts (JS/HTML/CSS) that allow you to zoom in / expand on a particular set of data (just drag and highlight some data in one of the charts) and then zoom back out with a simple double click).  There are also some presets that allow you select the time window for data so if you had months worth of data for example you could select ‘by day’ and then by ‘month’ or ‘year’ to change the amount of data shown in the graph.

So you might be thinking why are you reading this blog on the OpenShift site.  Hold on to your hat and I’ll tell you!

OpenShift is announcing built-in support for Mongo Monitoring Service (MMS).  It’s so easy to bake this in to your application that I’ll walk you through setting this up in just a few minutes!

Step 1

Sign up for MMS @ https://mms.10gen.com/.  You’ll have to specify a ‘group’ which MMS uses for managing access to multiple users.

 

Step 2

Download the agent.  The agent download link will be on the ‘Hosts’ page when you log in to MMS.

 

Step 3

If you’re application is called ‘mmstest’ and the git repo is in ‘$HOME/shiftapps/mmstest’, create the directory ‘$HOME/shiftapps/mmstest/.openshift/mms’ and copy in settings.py from the agent download from Step 2.

The settings.py is the MMS agent settings that contain the API keys for connecting to your MMS account and updating the monitoring metrics.

From $HOME/shiftapps/mmstest, run:
git add –A
git commit –a –m “add setttings.py for MMS agent”
git push

 

Step 4

Embed the MMS cartridge into your application.  If your application is called ‘mmstest’ you will run:
rhc cartridge add 10gen-mms-agent-0.1 -a mmstest

Step 5

Add the host to the MMS ‘Hosts’ page.  Click the ‘+’ sign next to ‘Hosts’ to add it.

This will prompt you to enter the information like in this screenshot:

 

This information was provided when you added MongoDB to your applicaton, but in case you don’t have it you can connect to your application over SSH and print the information.

ssh UUID@appname-namespace.rhcloud.com

Your applications UUID was printed to the screen as part of the ‘git push’ from step 4 (in the video below I use copy/paste to make this easier).

Once connected to your application over SSH, run:

echo $OPENSHIFT_MONGODB_DB_URL

The output will be something like:

mongodb://admin:PASSWORD@127.X.X.X:27017

You can copy and paste this information to the new host being created in MMS.

FINISHED!

That’s it!  Now all you have to do is wait for the data to start streaming in.

 

 

Want to see more of the MongoDb and OpenShift goodness live? Then sign up for our webinar with 10Gen on Dec. 20.

Thanks for tuning in!

- Your friendly neighborhood PaaS Evangelist – aka http://twitter.com/#!/dblado

 

 

Tags:

I just wanted to thank you for this tutorial.

Thanks, the piece I was missing was the openshift local IP address.

BK

More from this author