Email alerts configuration for Mongodb

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

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

pmm_mongodb_replication_lag{service_name="your_mongo_service_name"} > 30

Hope this helps to move forward