mongodb_exporter icon indicating copy to clipboard operation
mongodb_exporter copied to clipboard

server returned error on SASL authentication step: Authentication failed.

Open LzxUser opened this issue 6 years ago • 3 comments

I tried to use mongo to connect, it is correct, I do not know what happened

LzxUser avatar Mar 08 '19 10:03 LzxUser

User rights are not enough,create a dbOwner in mongo. db.createUser({user: "exporterdb", pwd: "*********", roles: [{role: "dbOwner", db: "user_data"}]})

Willsms avatar Jul 25 '19 08:07 Willsms

I have the same problem 🤔

User in mongo:

Successfully added user: {
	"user" : "exporterdb",
	"roles" : [
		{
			"role" : "dbOwner",
			"db" : "proxy"
		}
	]
}

Logs from exporter:

{"level":"error","msg":"Could not get MongoDB BuildInfo: auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-1\": Authentication failed.!","source":"connection.go:192","time":"2019-09-16T17:48:11+02:00"}
{"level":"error","msg":"Problem gathering the mongo server version: auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-1\": Authentication failed.","source":"mongodb_collector.go:213","time":"2019-09-16T17:48:11+02:00"}

What's wrong?

jsedy7 avatar Sep 16 '19 15:09 jsedy7

I would advice to use the role clusterMonitor instead the much more permission dbOwner. In case you are still having trouble after creating a user with appropriate permissions, the issue often seems that the @ character in the connection stream causes issues in cause no escaping is used. Easiest fix seems to be to just quote the whole connection string with single quotes.

Ah, sorry. The exporter was returning some metrics, but I noticed later that it is still printing the error message on each request it serves. I was about to check if the percona fork would fix this issue, however it looks like they do not provide any binaries, and I have no experience with go. So, no good idea how to quickly fix this right now :/

st-h avatar Dec 23 '19 16:12 st-h