Hi,
I’ve tried to get metrics with [[inputs.mongodb]] but it seems that I’m missing something.
I’ve read: telegraf/plugins/inputs/mongodb at master · influxdata/telegraf · GitHub
This connection uri may be different based on your environment and mongodb setup. If the user doesn’t have the required privilege to execute serverStatus command the you will get this error on telegraf
Error in input [mongodb]: not authorized on admin to execute command { serverStatus: 1, recordStats: 0 }
System information:
CentOS Linux release 7.3.1611 (Core)
Telegraf v1.5.2
MongoDB server version: 3.4.9
Telegraf.conf:
[[inputs.mongodb]]
servers = [“mongodb://admin:admin@localhost:27017/admin”]
gather_perdb_stats = true
MongoDB user: I even created another user named “telegraf” and tried with tis also but no result.
mongo_poc:PRIMARY> show users
{
“_id” : “admin.admin”,
“user” : “admin”,
“db” : “admin”,
“roles” : [
{
“role” : “userAdminAnyDatabase”,
“db” : “admin”
}
]
}
{
“_id” : “admin.telegraf”,
“user” : “telegraf”,
“db” : “admin”,
“roles” : [
{
“role” : “read”,
“db” : “admin”
},
{
“role” : “dbAdmin”,
“db” : “admin”
}
]
}
Telegraf output:
- Plugin: inputs.mongodb, Collection 1
2018-03-10T18:56:58Z E! Error in plugin [inputs.mongodb]: not authorized on admin to execute command { serverStatus: 1, recordStats: 0 } - Plugin: inputs.mongodb, Collection 2
2018-03-10T18:56:59Z E! Error in plugin [inputs.mongodb]: not authorized on admin to execute command { serverStatus: 1, recordStats: 0 }
Kindly let me know what do you think or I must do in order to fix this?
How is meant to work this plugin in case when I have like now 3 MongoDB nodes in Cluster environment with 1 master and 2 slaves, I must put in telegraf.conf the details for [[inputs.mongodb]] only on the master?
Kind Regards,