# Email alerts configuration for Mongodb

**URL:** <https://forums.percona.com/t/email-alerts-configuration-for-mongodb/36217>\
**Category:** Percona Monitoring and Management (PMM)\
**Tags:** percona, mongodb-exporter\
**Created:** [January 20, 2025, 5:36am UTC](https://forums.percona.com/t/email-alerts-configuration-for-mongodb/36217 "2025-01-20T05:36:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhivya](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@Dhivya](https://forums.percona.com/u/Dhivya)\
**Post date:** [January 20, 2025, 5:36am UTC](https://forums.percona.com/t/email-alerts-configuration-for-mongodb/36217/1 "2025-01-20T05:36:35Z")

</div>

Hi All,

Am trying to configure emails alerts for critical parameters like service down ,replication lag and connections for now.  
For Service down I used the default alert rule templates it worked. But for replication lag and connections I tried to configure alert and it gives me alert with data dource not found.  
Alert email sample :  
**Firing: 1 alert for alertname=DatasourceNoData grafana\_folder=MongoDB**  
Firing **DatasourceNoData**  
**Value:**  
**Labels:**

- alertname: DatasourceNoData
- datasource\_uid: PA58DA793C7250F1B
- grafana\_folder: MongoDB
- ref\_id: A
- rulename: MongoDB\_Connections

Condition used for Alert :  
For monitoring connections : mongodb\_mongod\_connections \> 100  
For replication lag : mongodb\_repl\_lag\_seconds \> 30

the default template for service down has the below condition which is working properly.  
up{service\_type=“mongodb”} == bool 0 and on() (up{service\_type=“mongodb”} == bool 0)[6s]

Can somehelp help to correct the datasource no data issue for configuring and triggering alert emais.

Thanks & Regards,  
Dhivya.K

---

<div class="post-metadata">

**Author:** ![radoslaw.szulgo](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/radoslaw.szulgo/32/17315_2.png) [@radoslaw.szulgo](https://forums.percona.com/u/radoslaw.szulgo)\
**Post date:** [September 25, 2025, 12:44pm UTC](https://forums.percona.com/t/email-alerts-configuration-for-mongodb/36217/2 "2025-09-25T12:44:51Z")

</div>

Make sure the metric names are correct and exists. Please use the **Explore** feature within PMM to find the exact metric names and build the correct query.

1. In the PMM sidebar, go to **Explore**.

2. At the top, ensure the data source is set to **VictoriaMetrics**.

3. In the “Metrics” field, start typing `mongo`. PMM will provide an autocomplete list of all available metrics from the MongoDB exporter. This is where you’ll find the correct names.

Once you find the right metric, select it. PMM will show you a graph and also let you add labels to filter the data for a specific service.

Also you may try with that PromQL:  
`mongodb_connections{state=“current”, service_name=“your_mongo_service_name”} > 100`

and

```auto
pmm_mongodb_replication_lag{service_name="your_mongo_service_name"} > 30

```

Hope this helps to move forward
