Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.
mongodb_exporter_config
The mongodb_exporter_config
block configures the mongodb_exporter
integration, which is an embedded version of percona’s mongodb_exporter
.
In order for this integration to work properly, you have to connect each node of your mongoDB cluster to an agent instance. That’s because this exporter does not collect metrics from multiple nodes. Additionally, you need to define two custom label for your metrics using relabel_configs. The first one is service_name, which is how you identify this node in your cluster (example: ReplicaSet1-Node1). The second one is mongodb_cluster, which is the name of your mongodb cluster, and must be set the same value for all nodes composing the cluster (example: prod-cluster). Here`s an example:
relabel_configs:
- source_labels: [__address__]
target_label: service_name
replacement: 'replicaset1-node1'
- source_labels: [__address__]
target_label: mongodb_cluster
replacement: 'prod-cluster'
We strongly recommend that you configure a separate user for the Agent, and give it only the strictly mandatory security privileges necessary for monitoring your node, as per the official documentation.
Besides that, there’s not much to configure. Please refer to the full reference of options:
For tls_basic_auth_config_path
, check tls_config
for reference on the file format to be used.