# How to use MongoDB exporter metrics in Grafana?

**URL:** <https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175>\
**Category:** MongoDB\
**Created:** [April 20, 2021, 2:36pm UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175 "2021-04-20T14:36:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joao\_Freire](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/joao_freire/32/3383_2.png) [@Joao\_Freire](https://forums.percona.com/u/Joao_Freire)\
**Post date:** [April 20, 2021, 2:36pm UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/1 "2021-04-20T14:36:26Z")

</div>

Good afternoon, I’m having some problems connecting Mongodb exporter metrics to Grafana. Metrics are being successfully extracted for Prometheus and now I would like to use Grafana to have a more interactive view of the data. The dashboards I used are from this link [[GitHub - percona/grafana-dashboards: PMM dashboards for database monitoring](https://github.com/percona/grafana-dashboards)] and the exporter version is the latest, 0.20.4. I wonder if anyone could assist me in this matter ?  
Cheers

---

<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:** [April 20, 2021, 3:41pm UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/2 "2021-04-20T15:41:49Z")

</div>

Hi Joao,

Could you try a dashboard that were prepared for PMM1? Dashboards for PMM2 are using a specific parameters in formulas.  
e.g.

> <https://github.com/percona/grafana-dashboards/blob/pmm-1.x/dashboards/MongoDB_Overview.json>

---

<div class="post-metadata">

**Author:** ![Joao\_Freire](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/joao_freire/32/3383_2.png) [@Joao\_Freire](https://forums.percona.com/u/Joao_Freire)\
**Post date:** [April 20, 2021, 4:05pm UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/3 "2021-04-20T16:05:56Z")

</div>

I tried to access the dashboard that indicated me and I had to change the name of the datasource that is fixed as “Prometheus” to the name of my Prometheus. However, the errors that appeared in the other dashboards did not appear to me, but data are not shown.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/3/33b6d38d90c892333cdf3caea1951acf5e8a1672.png)

---

<div class="post-metadata">

**Author:** ![Joao\_Freire](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/joao_freire/32/3383_2.png) [@Joao\_Freire](https://forums.percona.com/u/Joao_Freire)\
**Post date:** [April 20, 2021, 4:06pm UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/4 "2021-04-20T16:06:41Z")

</div>

In the image below, you can see a case of a list of metrics from the MongoDB Exporter, so I assume that it is not a problem for either the exporter or Prometheus configuration.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/4/491689aca1f26b6a439330641e53647e3d951201.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:** [April 21, 2021, 9:03am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/5 "2021-04-21T09:03:29Z")

</div>

Could you share parameters that are provided by Prometheus for a metric?  
e.g.  
_mongodb\_mongod\_op\_counters\_total_

This metric is used in the first element of the dashboard.  
rate(mongodb\_mongod\_op\_counters\_total{instance=~“$host”, type!=“command”}[$interval])

---

<div class="post-metadata">

**Author:** ![Joao\_Freire](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/joao_freire/32/3383_2.png) [@Joao\_Freire](https://forums.percona.com/u/Joao_Freire)\
**Post date:** [April 21, 2021, 9:24am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/6 "2021-04-21T09:24:46Z")

</div>

Good morning, I researched the metrics that were indicated and just found this metric from op\_counters but they have different names as you can see in the image below.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/e/e7e9d9905c306ab42abe0324e36a23e1803479c0.png)

It represents an extraction of the exporter’s metrics to a txt file. I remember that I am using the latest version of Mongodb exporter.

---

<div class="post-metadata">

**Author:** ![Joao\_Freire](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/joao_freire/32/3383_2.png) [@Joao\_Freire](https://forums.percona.com/u/Joao_Freire)\
**Post date:** [April 21, 2021, 9:34am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/7 "2021-04-21T09:34:20Z")

</div>

I looked at the dashboard json and the metrics he is waiting for have different names than those the exporter is drawing on. That is, do I have to change the name of the metrics in json manually?  
If that is the case it is worth trying, however I thought that the metrics name would not be changed in this way.

---

<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:** [April 21, 2021, 10:09am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/8 "2021-04-21T10:09:26Z")

</div>

Ok. I have missed the fact that you are using the latest version of exporter. 😕 So metrics name were changed there.

You should take [a dashboard for PMM2](https://github.com/percona/grafana-dashboards/blob/PMM-2.0/dashboards/MongoDB_Instance_Summary.json) and modify variable names.  
IMHO the easiest way is to modify formula for _service\_name_ variable.  
Please replace “service\_name” word by “instance”  
label\_values(mongodb\_up{cluster=~“$cluster”}, service\_name) → label\_values(mongodb\_up{cluster=~“$cluster”}, instance)

 ![Screenshot_20210421_130738](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/5/5c591d4d4ef133e199cd16a1d37b6dec6796e869.png)

---

<div class="post-metadata">

**Author:** ![Joao\_Freire](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/joao_freire/32/3383_2.png) [@Joao\_Freire](https://forums.percona.com/u/Joao_Freire)\
**Post date:** [April 21, 2021, 11:12am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/9 "2021-04-21T11:12:04Z")

</div>

I followed these steps and already recognized my instance as you can see.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/e/eb9e9eddcd213c3ba84f3fcda2f89afa172c2e0c.png)

I still have to add this plugin to see if the mongodb\_up metrics are really working.  
But what about the rest of the metrics do I change manually? In this edit of connections you are going to get the name of old metrics.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/8/8eaf03229f8dd8275ac204129b37759081ecb19b.png)

Or is it better to wait for the updated dashboards to come out with the new metrics?

---

<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:** [April 21, 2021, 11:24am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/10 "2021-04-21T11:24:14Z")

</div>

Dashboards in PMM-2.0 brunch has already working new metrics names.  
It’s a pretty strange that you don’t have metric mongodb\_connections.  
Could you check it on Prometheus UI?

---

<div class="post-metadata">

**Author:** ![Joao\_Freire](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/joao_freire/32/3383_2.png) [@Joao\_Freire](https://forums.percona.com/u/Joao_Freire)\
**Post date:** [April 21, 2021, 11:34am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/11 "2021-04-21T11:34:44Z")

</div>

It’s working, I just needed to add the name of the metrics that appears in my exporter regarding the connections.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/6/64df19903b51dfea156fe14afbbe511872344c76.png)

What it seems to me is that I have to do this process for all metrics. 😕

---

<div class="post-metadata">

**Author:** ![Joao\_Freire](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/joao_freire/32/3383_2.png) [@Joao\_Freire](https://forums.percona.com/u/Joao_Freire)\
**Post date:** [April 21, 2021, 11:38am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/12 "2021-04-21T11:38:00Z")

</div>

As far as connections are concerned, these are the names of the metrics that the exporter is drawing.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/0/033a17030e342047461416623f7e14043807a5b0.png)

---

<div class="post-metadata">

**Author:** ![Joao\_Freire](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/joao_freire/32/3383_2.png) [@Joao\_Freire](https://forums.percona.com/u/Joao_Freire)\
**Post date:** [April 21, 2021, 11:45am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/13 "2021-04-21T11:45:20Z")

</div>

I now also changed the cursors and did the same process, that is, the name of the metrics that the Mongodb exporter is drawing are different from those presented by the dashboard.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/8/8b4089870d59adcdf581a8b73ad88ac014aa868d.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:** [April 21, 2021, 11:59am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/14 "2021-04-21T11:59:28Z")

</div>

> [@Joao\_Freire](#):
>
> What it seems to me is that I have to do this process for all metrics. 😕

Also you may use flag --compatible-mode for exporter in order to get both variants of metrics.

 ![Screenshot_20210421_145723](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/7/77d98b065b83f2fe3027a9b1d29b6453265033f7.png)

---

<div class="post-metadata">

**Author:** ![Joao\_Freire](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/joao_freire/32/3383_2.png) [@Joao\_Freire](https://forums.percona.com/u/Joao_Freire)\
**Post date:** [April 21, 2021, 12:32pm UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/15 "2021-04-21T12:32:32Z")

</div>

Yes, I think that was the problem, when I implemented MongoDB exporter through CHEF, I did not set this flag to true, I have already seen the metrics and they are there with the correct name.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/9/9091ceb7d58f680b02ab767eabe8742c61d32919.png)

Having said that, I will configure the Grafana with these metrics and at the outset I should have no problems, thank you very much for your help and attention. 🙂

---

<div class="post-metadata">

**Author:** ![Perwaiz\_Alam](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/perwaiz_alam/32/4603_2.png) [@Perwaiz\_Alam](https://forums.percona.com/u/Perwaiz_Alam)\
**Post date:** [September 29, 2021, 12:05pm UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/17 "2021-09-29T12:05:41Z")

</div>

Did anyone face problem while importing MongoDB ReplSet Summary json file? i am not able to import any file of mongodb to grafana dashboard.I am using latest mongodb exporter and grafana version.  
please help me out.

I am using this dashboard - [GitHub - percona/grafana-dashboards: PMM dashboards for database monitoring](https://github.com/percona/grafana-dashboards)

---

<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:** [September 29, 2021, 2:04pm UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/18 "2021-09-29T14:04:57Z")

</div>

> [@Perwaiz\_Alam](#):
>
> Did anyone face problem while importing MongoDB ReplSet Summary json file? i am not able to import any file of mongodb to grafana dashboard.I am using latest mongodb exporter and grafana version.  
> please help me out.

Could you provide a screenshot with errors?

---

<div class="post-metadata">

**Author:** ![Perwaiz\_Alam](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/perwaiz_alam/32/4603_2.png) [@Perwaiz\_Alam](https://forums.percona.com/u/Perwaiz_Alam)\
**Post date:** [September 29, 2021, 8:27pm UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/20 "2021-09-29T20:27:12Z")

</div>

Metrics are not showing on grafana dashboard. I have used below version of mongo exporter and dashboard version.

**Mongodb\_exporter** → [v0.20.7](https://github.com/percona/mongodb_exporter/releases/tag/v0.20.7)  
**Grafana Dashboard version** → [v2.22.0](https://github.com/percona/grafana-dashboards/releases/tag/v2.22.0)  
**Grafana Version** → Grafana v8.1.0  
**Screenshot Attached of error**

 ![Screenshot 2021-09-30 at 12.44.52 AM](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/f/f3b904d7d388a8ab9e13e4f0833a6629174bb0fe.jpeg)

Observation: The query which starts with mongodb\_mongod doesn’t work on the Prometheus query.

---

<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:** [September 30, 2021, 2:14pm UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/21 "2021-09-30T14:14:27Z")

</div>

> [@Perwaiz\_Alam](#):
>
> Metrics are not showing on grafana dashboard. I have used below version of mongo exporter and dashboard version.

The dashboard is using PMM datasource for variables.  
Please use next script for converting dashboards.

> <https://github.com/percona/grafana-dashboards/blob/main/misc/convert-dash-from-PMM.py>

 ![Screenshot 2021-09-30 at 17.11.27](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/c/c66bcc57f6892623919110e4015acbe604f0827c.png)

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [November 7, 2025, 11:35am UTC](https://forums.percona.com/t/how-to-use-mongodb-exporter-metrics-in-grafana/10175/22 "2025-11-07T11:35:16Z")

</div>


