MongoHQ / newrelic-mongodb-agent

Feed MongoDB Metrics to New Relic
MIT License
16 stars 14 forks source link

SSL support #8

Closed din-kd closed 11 years ago

din-kd commented 11 years ago

Can you please share some insights around how we should configure the plugin so that it can connect to MongoDB over SSL and use a keyfile for authentication.

We are using MongoDB 2.4 (shards and replica sets) with SSL and key file authentication enabled. Our config file contains the following

sslOnNormalPorts = true sslPEMKeyFile = [path to SSL PEM file] keyFile = [path to key file]

When the plugin tries to connect to such a MongoDB setup, we see the following error in our MongoDB logs which seems to indicate that the plugin isn't connecting with MongoDB over SSL "SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol"

Thanks ahead for your help!

hersha commented 11 years ago

From what I can see the way its written right now SSL wont work unless you add the :ssl => true option to where the database initialization happens in the plug in. The could be made to happen from the plugin config file. First thing though is try and get a database connection with the ruby database driver outside of the plugin. I'll see if I can write up a fix when I get home and send the pull request.

mthomasHMA commented 11 years ago

That seem to better .... need to get a error logging for this plugin to see what is being return (status).... I've have to wait until the DBA's get online to see what he seeing from the database side logs.
10:12:49 mongodb.1 | Error authententicating to MongoDB database. Requires a user on the admin database

so in the the def client insert client = MongoClient.new(endpoint, port.to_i, :slave_ok => true, :ssl => true)

hersha commented 11 years ago

Yeah that should fix it for now. If my pull request gets accepted you will just need to update the plugin.

mthomasHMA commented 11 years ago

I'm testing it now and will let you know the results...

mthomasHMA commented 11 years ago

We have it up and running! Thanks for your support!

hersha commented 11 years ago

Cool! Please leave the issue open so maybe the maintainer will eventually merge my pull request. :smile: