# What privileges mongodb user should have for fetching the mongodb status through metricbeat mongodb module

**URL:** <https://discuss.elastic.co/t/what-privileges-mongodb-user-should-have-for-fetching-the-mongodb-status-through-metricbeat-mongodb-module/201197>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [September 26, 2019, 9:38am UTC](https://discuss.elastic.co/t/what-privileges-mongodb-user-should-have-for-fetching-the-mongodb-status-through-metricbeat-mongodb-module/201197 "2019-09-26T09:38:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GRV](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@GRV](https://discuss.elastic.co/u/GRV)\
**Post date:** [September 26, 2019, 9:38am UTC](https://discuss.elastic.co/t/what-privileges-mongodb-user-should-have-for-fetching-the-mongodb-status-through-metricbeat-mongodb-module/201197/1 "2019-09-26T09:38:57Z")

</div>

In mongodb.yml file inside metricbeat modules, i am using user which is assign readWrite permission for admin db.

I am getting these errors

Error 1 : Error fetching data for metricset mongodb.dbstats: Error retrieving database names from Mongo instance: not authorized on admin to execute command { listDatabases: 1, $readPreference: { mode: "secondaryPreferred" }, $db: "admin" }

What role need to be use for fetching the mongodb status.  
In production environment i can not use "root" role for security reason.

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [September 27, 2019, 1:44pm UTC](https://discuss.elastic.co/t/what-privileges-mongodb-user-should-have-for-fetching-the-mongodb-status-through-metricbeat-mongodb-module/201197/2 "2019-09-27T13:44:41Z")

</div>

Sorry right now we don't have the privileges documented, a github issue is created to track this work: [https://github.com/elastic/beats/issues/13820](https://github.com/elastic/beats/issues/13820)

---

<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:** [October 25, 2019, 1:44pm UTC](https://discuss.elastic.co/t/what-privileges-mongodb-user-should-have-for-fetching-the-mongodb-status-through-metricbeat-mongodb-module/201197/3 "2019-10-25T13:44:41Z")

</div>

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