Reputation: 555
I have sensu client installed on Mongo DB server and I am executing the Mongo DB Check using this script It Works great when my Mongodb is configured without Authentication, But it does not show the metrics when Authentication is enabled on the Mongo DB, Though I am passing the DB Authentication Credentials correctly, but authentication works with same credential from irb prompt. What should be the fix to get the Monitoring Metric using MongoDB Authentication ?
I am using Sensu version 0.1 6 and MongoDB 2.4.11 on Ubuntu 12.04.
Upvotes: 1
Views: 428
Reputation: 555
I resolved it,
In fact it is not an sensu-plugin issue, it was an user authentication issue with MongoDB 2.4, Mongo allows the user which is created within admin db to collect the information of other databases.
So the following simple steps solved my issue
rahul@rahul:~$ mongo
MongoDB shell version: 2.4.12
connecting to: test
> use admin
switched to db admin
> db.addUser("rahul","rahul@123")
{
"user" : "rahul",
"readOnly" : false,
"pwd" : "85a20670734aeb830a7903183bd4132f",
"_id" : ObjectId("54d88f4950e99f42d01abfe8")
}
> use mydb
switched to db mydb
>
Then I modified following paramaters in mongodb-metrics.rb which is freely available here
option :user,
description: 'MongoDB user',
long: '--user rahul',
default: nil
option :password,
description: 'MongoDB password',
long: '--password rahul@123',
default: nil
and note that the following has to be unchanged
db_name = 'admin'
here I was giving db_name as 'mydb' which was going wrong
after all I can see my metrics and graphs
Upvotes: 2