# Monitoring replication lag with MongoDB plugin

**URL:** <https://community.netdata.cloud/t/monitoring-replication-lag-with-mongodb-plugin/1644>\
**Category:** Help\
**Tags:** agent-collector, agent\
**Created:** [August 26, 2021, 8:27am UTC](https://community.netdata.cloud/t/monitoring-replication-lag-with-mongodb-plugin/1644 "2021-08-26T08:27:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![comete-geek](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/comete-geek/32/974_2.png) [@comete-geek](https://community.netdata.cloud/u/comete-geek)\
**Post date:** [August 26, 2021, 8:27am UTC](https://community.netdata.cloud/t/monitoring-replication-lag-with-mongodb-plugin/1644/1 "2021-08-26T08:27:20Z")

</div>

Hi,

I want to monitor MongoDB replication lag, is this metric the equivalent one ?

```
netdata_mongodb_replication_optimedate_delay_seconds_ago_average

```

I mean, if I take the value matching the secondary server like this ?

```
netdata_mongodb_replication_optimedate_delay_seconds_ago_average{chart="mongodb_local.optimedate_delay",family="replication and oplog",dimension="<secondary_server_ip>:27018"}

```

Other question, how do I dynamically find, in my queries, which ip targets the primary server ?

Thanks

Morgan

---

<div class="post-metadata">

**Author:** ![OdysLam](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/odyslam/32/98_2.png) [@OdysLam](https://community.netdata.cloud/u/OdysLam)\
**Post date:** [August 26, 2021, 3:40pm UTC](https://community.netdata.cloud/t/monitoring-replication-lag-with-mongodb-plugin/1644/2 "2021-08-26T15:40:35Z")

</div>

Hey,

First, you can find more information about our mongoDB collector in our docs:

> **[MongoDB monitoring with Netdata | Learn Netdata](https://learn.netdata.cloud/docs/agent/collectors/python.d.plugin/mongodb)**
>
> Monitors performance and health metrics of MongoDB.

Secondly, I think that the first question is `yes`. Unfortunately, I am not familiar with the prometheus syntax ( I think that’s prometheus syntax, right?)

Not sure what you mean by the last question. Perhaps @ilyam8 has more context?
