简体   繁体   English

MongoDB Sensu脚本(检查)未在日志中显示指标

[英]MongoDB Sensu Script(Check) not showing Metrics in Log

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. 我已经在Mongo DB服务器上安装了sensu客户端,并且正在使用脚本执行Mongo DB Check。当我的Mongodb配置为不进行身份验证时,它工作得很好,但是当我在Mongo DB上启用身份验证时,它不显示指标正确传递了数据库身份验证凭据,但是身份验证使用来自irb提示符的相同凭据。 What should be the fix to get the Monitoring Metric using MongoDB Authentication ? 使用MongoDB身份验证获取监控指标的解决方法应该是什么?

I am using Sensu version 0.1 6 and MongoDB 2.4.11 on Ubuntu 12.04. 我在Ubuntu 12.04上使用Sensu版本0.1 6和MongoDB 2.4.11。

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. 实际上,这不是问题,而是MongoDB 2.4的用户身份验证问题,Mongo允许在admin db中创建的用户收集其他数据库的信息。

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 然后,我在mongodb-metrics.rb中修改了以下参数,可在此处免费使用

  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 在这里我给db_name作为'mydb'这是错误的

after all I can see my metrics and graphs 毕竟我可以看到我的指标和图表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM