# MongoDB metrics PMM monitoring

**URL:** <https://forums.percona.com/t/mongodb-metrics-pmm-monitoring/7625>\
**Category:** PMM 1.x\
**Created:** [May 14, 2020, 2:46am UTC](https://forums.percona.com/t/mongodb-metrics-pmm-monitoring/7625 "2020-05-14T02:46:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Catoman](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@Catoman](https://forums.percona.com/u/Catoman)\
**Post date:** [May 14, 2020, 2:46am UTC](https://forums.percona.com/t/mongodb-metrics-pmm-monitoring/7625/1 "2020-05-14T02:46:22Z")

</div>

Hi,  
I’m setting up monitoring of MongoDB in PMm and after activating authentification the monitoring stopped working (except for Replication Lag).&nbsp;  
I have added the user acc to this link&nbsp;[Percona Monitoring and Management](https://www.percona.com/doc/percona-monitoring-and-management/conf-mongodb.html) and the MongoDB logs say :  
&nbsp;[conn800] Successfully authenticated as principal mongodb\_exporter on admin from client 172.26.156.212:52260  
but the PMM mongodb metrics logs says&nbsp;  
time=“2020-05-13T10:42:36+02:00” level=error msg=“Failed to get replSet status: command replSetGetStatus requires authentication” source="replset\_status.go:264"time=“2020-05-13T10:42:36+02:00” level=error msg=“Failed to get oplog status: command find requires authentication” source="oplog\_status.go:143"time=“2020-05-13T10:42:41+02:00” level=error msg=“Failed to get server status: command serverStatus requires authentication” source="server\_status.go:234"What else is needed ?

---

<div class="post-metadata">

**Author:** ![Catoman](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@Catoman](https://forums.percona.com/u/Catoman)\
**Post date:** [May 14, 2020, 4:04am UTC](https://forums.percona.com/t/mongodb-metrics-pmm-monitoring/7625/2 "2020-05-14T04:04:20Z")

</div>

Screenshot

 ![mongo.png](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/1/114ad12ac4b246349b0db179108a320d8b7ec102.png)

---

<div class="post-metadata">

**Author:** ![Vadim\_Yalovets](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadim_yalovets/32/43_2.png) [@Vadim\_Yalovets](https://forums.percona.com/u/Vadim_Yalovets)\
**Post date:** [May 17, 2020, 4:08am UTC](https://forums.percona.com/t/mongodb-metrics-pmm-monitoring/7625/3 "2020-05-17T04:08:34Z")

</div>

Hi,  
Have you&nbsp;passed the user name and password in the value of the&nbsp;–uri&nbsp;option when adding the&nbsp;mongodb:metrics&nbsp;monitoring service in the&nbsp; **_pmm-admin add_** &nbsp;command?

---

<div class="post-metadata">

**Author:** ![Catoman](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@Catoman](https://forums.percona.com/u/Catoman)\
**Post date:** [May 18, 2020, 12:55am UTC](https://forums.percona.com/t/mongodb-metrics-pmm-monitoring/7625/4 "2020-05-18T00:55:25Z")

</div>

Hi @adivinho   
I used this command : sudo pmm-admin add mongodb --uri mongodb://mongodb\_exporter:password@FQDN:27017/admin

---

<div class="post-metadata">

**Author:** ![Vadim\_Yalovets](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadim_yalovets/32/43_2.png) [@Vadim\_Yalovets](https://forums.percona.com/u/Vadim_Yalovets)\
**Post date:** [May 20, 2020, 3:15am UTC](https://forums.percona.com/t/mongodb-metrics-pmm-monitoring/7625/5 "2020-05-20T03:15:57Z")

</div>

Hi @Catoman,  
Here is a solution that was found [here](https://github.com/dcu/mongodb_exporter/issues/100 "Link: https://github.com/dcu/mongodb\_exporter/issues/100")  
Set environment variable MONGODB\_URL before starting the exporter:  
export MONGODB\_URL=mongodb://mongodb\_exporter:password@FQDN:27017

---

<div class="post-metadata">

**Author:** ![Catoman](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@Catoman](https://forums.percona.com/u/Catoman)\
**Post date:** [May 20, 2020, 3:52am UTC](https://forums.percona.com/t/mongodb-metrics-pmm-monitoring/7625/6 "2020-05-20T03:52:15Z")

</div>

Hi @adivinho,  
Edit, i think i made an error in the process. Have removed my comment and will test more&nbsp;

---

<div class="post-metadata">

**Author:** ![Catoman](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@Catoman](https://forums.percona.com/u/Catoman)\
**Post date:** [May 20, 2020, 4:03am UTC](https://forums.percona.com/t/mongodb-metrics-pmm-monitoring/7625/7 "2020-05-20T04:03:37Z")

</div>

Thanks @adivinho, that solved the problem. The graphs are getting populated now&nbsp; 🙂
