How to use MongoDB exporter metrics in Grafana?

Good Morning,
I’m having some problems connecting MongoDB exporter metrics to Grafana. Prometheus is able to successfully extract metrics but data does not load in Grafana.

Exporter - v0.20.5 Release v0.20.5 · percona/mongodb_exporter · GitHub
Dashboards - v2.18.0 Release v2.18.0 · percona/grafana-dashboards · GitHub

“Cluster” in the dashboards shows as “None”. Is this the problem?

Can anyone assist me in this matter ?
Thanks

Hi Prabhav,

Are you using PMM server or just imported the dashboard into your own installation?

1 Like

Hi Adivinho,

Thanks for taking time to help.

I installed mongodb_exporter on one mongo and configured it to send data to existing Prometheus. I verified the metrics and data and then imported the dashboards to my Grafana installation.

1 Like

I am not using PMM server, I am using mongodb_exporter

1 Like

Please add additional labels for mongodb_exporter targets. Such labels are generated in PMM2 and used in dashboards formulas.
e.g.
node_name: nodeWithMongo1
service_name: mongo1
cluster: myCluster
replication_set: repl1
service_type: mongodb

2 Likes

Thank you, it worked.

Now I am able to see the cluster, node & service.

1 Like

When I import the dashboards, I see dummy data on all dashboards.

When I try and edit it and select data source as Prometheus, the query is getting blank. It is happening in all the dashboards.

I am cloning the git repo and using PMM2.0 branch, alternatively I also tried downloading the dashboards from release Release v2.18.0 · percona/grafana-dashboards · GitHub

Once the dashboards are locally available on the system, I am importing it in Grafana.

Not sure what am I doing wrong here. Is there a standard procedure to import?

1 Like

IMHO the most easiest way is to create a copy of your Prometheus datasource but with name Metrics.

2 Likes

Hi Prabhav,

Thank you for your question!

We would like to organize a community engineering meeting on June 29 (2 PM - 3 PM UTC) to start talking about PR, issues, future. Join and give your feedback:

Thanks,
Andrii

2 Likes

Thanks a lot for your help, at least the metrics started coming.

Though I ran into some more issues which I would like to clarify.

  1. The replicaSet metrics are not coming & I am getting this error on mongodb_exporter “cannot get replSetGetStatus: replSetGetStatus is not supported through mongos”.
    Dashboards shows Replica Set as “None”

  2. Though most of graphs are working, some are not. It shows no data. I noticed some metrics used within graph is not present in Prometheus, e.g. mongodb_mongod_replset_my_state, mongodb_mongos_metrics_cursor_open, mongodb_mongod_cursors, mongodb_mongod_op_latencies_ops_total, mongodb_mongod_metrics_query_executor_total, mongodb_mongod_metrics_document_total, mongodb_mongod_metrics_get_last_error_wtime_total_milliseconds

  3. MongoDB InMemory Details does not recogonize “Service Name” and it shows as “None”, hence no graphs are working on it.

  4. Can I use “PMM Query Analytics” dashboard with mongo exporter?

1 Like

Could you perform the next command in Explore?
count by (engine, service_name) (mongodb_mongod_storage_engine)

1 Like

QAN is a part of PMM Server.

1 Like

Could you check if such metrics are collected by exporter?
Are there any related errors in logs?

1 Like

I am able to get data on this command.

Though it says, “engine is not available” for both inMemory & WiredTiger

I am not using Enterprise Mongo, so InMemory is not applicable I believe. I am using wiredTiger as storage engine.

1 Like

The metrics are with a different name in Prometheus and exporter
Could this be the issue?

Am I using correct dashboards with exporter?
Exporter - v0.20.5 Release v0.20.5 · percona/mongodb_exporter · GitHub
Dashboards - v2.18.0 Release v2.18.0 · percona/grafana-dashboards · GitHub

1 Like

Could you run exporter with flag --compatible-mode ?

1 Like

It looks like a bug. I will check and create a ticket.

2 Likes

Hi,

I am already running with flag --compatible-mode.


Regards
Prabhav

1 Like

This are the flags I am passing

–mongodb.uri=mongodb://mongodb_exporter:@router1,router2/?w=majority&readConcernLevel=majority --mongodb.direct-connect=false --discovering-mode --compatible-mode --disable.replicasetstatus

Can you please help?

1 Like

I have just noticed that no quotas are used in your uri string. But the sign & is used, so all further flags are cut.