# \[Metricbeat\]About the configuration of mongodb module to connet a mongodb server with SCRAM-SHA-256

**URL:** <https://discuss.elastic.co/t/metricbeat-about-the-configuration-of-mongodb-module-to-connet-a-mongodb-server-with-scram-sha-256/193015>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [July 31, 2019, 2:09am UTC](https://discuss.elastic.co/t/metricbeat-about-the-configuration-of-mongodb-module-to-connet-a-mongodb-server-with-scram-sha-256/193015 "2019-07-31T02:09:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuewu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuewu/32/51313_2.png) [@yuewu](https://discuss.elastic.co/u/yuewu)\
**Post date:** [July 31, 2019, 2:09am UTC](https://discuss.elastic.co/t/metricbeat-about-the-configuration-of-mongodb-module-to-connet-a-mongodb-server-with-scram-sha-256/193015/1 "2019-07-31T02:09:37Z")

</div>

I want to use metricbeat to monitor a mongodb(4.0) server with SCRAM-SHA-256

But the metricbeat service shows:  
Jul 31 09:45:55 Perf-7151 metricbeat[19520]: 2019-07-31T09:45:55.724+0800 ERROR mongodb/mongodb.go:98 Error establishing direct connection to mongo node at [localhost:27019]. Error output: server returned error on SASL authentication step: Authentication failed.  
Jul 31 09:45:55 Perf-7151 metricbeat[19520]: 2019-07-31T09:45:55.724+0800 INFO module/wrapper.go:244 Error fetching data for metricset mongodb.dbstats: error creating new Session: server returned error on SASL authentication step: Authentication failed.

Tried as fllowing:

1. hosts: ["localhost:27019"]  
username: admin  
password: admin
2. hosts: ["mongodb://admin:admin@localhost:27019/admin?authMechanism=SCRAM-SHA-256"]
3. hosts: ["mongodb://admin:admin@localhost:27019/?authSource=admin?authMechanism=SCRAM-SHA-256"]
4. [https://github.com/elastic/beats/pull/12867](https://github.com/elastic/beats/pull/12867)  
hosts: ["localhost:27019"]  
username: admin  
password: admin  
mechanism: SCRAM-SHA-256

None of them worked!

If there is an answer that what is the correct way to access mongodb server with SCRAM-SHA-256?  
Or does it supported?

# metricbeat version

metricbeat version 7.2.0 (amd64), libbeat 7.2.0 [9ba65d864ca37cd32c25b980dbb4020975288fc0 built 2019-06-20 15:07:31 +0000 UTC]

Thanx,  
Yuewu

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 28, 2019, 2:09am UTC](https://discuss.elastic.co/t/metricbeat-about-the-configuration-of-mongodb-module-to-connet-a-mongodb-server-with-scram-sha-256/193015/2 "2019-08-28T02:09:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
