# Mongodb\_exporter metric for db size

**URL:** <https://forums.percona.com/t/mongodb-exporter-metric-for-db-size/8917>\
**Category:** MongoDB\
**Tags:** mongodb\
**Created:** [January 25, 2021, 11:19am UTC](https://forums.percona.com/t/mongodb-exporter-metric-for-db-size/8917 "2021-01-25T11:19:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Rozinsky](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@Dan\_Rozinsky](https://forums.percona.com/u/Dan_Rozinsky)\
**Post date:** [January 25, 2021, 11:19am UTC](https://forums.percona.com/t/mongodb-exporter-metric-for-db-size/8917/1 "2021-01-25T11:19:46Z")

</div>

Hi all,

I’m using the latest release of mongodb\_exporter by percona (v0.20.1) an I’m looking for a metric that will show the database size as requested by the developers in my company but I can’t find any…

I do see that by using the following query in the mongo I can see some close metrics like dataSize:  
db.runCommand({dbStats: 1, scale: 1})

However I can’t find an equivalent in the exporter.  
Do you know of any metric that will get me this information?

Thanks!

---

<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:** [January 25, 2021, 1:09pm UTC](https://forums.percona.com/t/mongodb-exporter-metric-for-db-size/8917/2 "2021-01-25T13:09:06Z")

</div>

Hi Dan,

Exporter generates metric mongodb\_mongos\_db\_data\_size\_bytes

e.g.  
[https://pmmdemo.percona.com/graph/d/mongodb-cluster-summary/mongodb-cluster-summary?orgId=1&var-cluster=MongoDBCluster1&refresh=1m](https://pmmdemo.percona.com/graph/d/mongodb-cluster-summary/mongodb-cluster-summary?orgId=1&var-cluster=MongoDBCluster1&refresh=1m)

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

---

<div class="post-metadata">

**Author:** ![Dan\_Rozinsky](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@Dan\_Rozinsky](https://forums.percona.com/u/Dan_Rozinsky)\
**Post date:** [January 25, 2021, 4:26pm UTC](https://forums.percona.com/t/mongodb-exporter-metric-for-db-size/8917/3 "2021-01-25T16:26:43Z")

</div>

Hi,  
Thanks for the reply!

I don’t see this metric on the exposed port of my server… maybe I’m missing something on the configuration?  
I’m running the exporter with the following flags:  
mongodb\_exporter --mongodb.uri --compatible-mode -web.listen-address “:9001”

---

<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:** [January 27, 2021, 9:21am UTC](https://forums.percona.com/t/mongodb-exporter-metric-for-db-size/8917/4 "2021-01-27T09:21:57Z")

</div>

Hi Dan,

Metric _ **mongodb\_mongos\_db\_data\_size\_bytes** _ is collected for a shared cluster.  
But it’s turned out that similar metric for a node (_ **mongodb\_mongod\_db\_data\_size\_bytes** _) doesn’t collect by the latest exporter version.  
Here is the [ticket](https://jira.percona.com/browse/PMM-7424) regarding this issue.

---

<div class="post-metadata">

**Author:** ![Dan\_Rozinsky](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@Dan\_Rozinsky](https://forums.percona.com/u/Dan_Rozinsky)\
**Post date:** [January 27, 2021, 9:40am UTC](https://forums.percona.com/t/mongodb-exporter-metric-for-db-size/8917/5 "2021-01-27T09:40:59Z")

</div>

Hi,

I looked at the ticket and we did enable collStats but still didn’t see any dbStats metrics.  
For now we went with the older exporter (0.11.2), and we’ll wait for the metrics to be available in the new exporter before we upgrade.

Thank you!
