Configure Grafana Alloy to use the MongoDB integration
In this milestone, you configure the MongoDB integration in Grafana Alloy. This configuration uses the built-in MongoDB exporter to collect database metrics and forward them to Grafana Cloud.
The MongoDB exporter component connects to your MongoDB instance and exposes metrics in Prometheus format for collection by Grafana Alloy.
The configuration includes three main components:
- MongoDB exporter: Connects to MongoDB and collects metrics
- Discovery relabel: Adds custom labels for organization and filtering
- Prometheus scrape: Collects metrics and forwards them to Grafana Cloud
To configure the MongoDB integration, complete the following steps:
On the MongoDB integration page in Grafana Cloud, scroll to the Set up Grafana Alloy to use the MongoDB integration section.
At the bottom of the snippet, click Copy to clipboard.
Create or open your Grafana Alloy configuration file.
The default configuration file location is
/etc/alloy/config.alloy.Paste the integration snippet into the configuration file.
In your next milestone, you’ll prepare the specific MongoDB connection configuration.
Please tell us what didn't work:
At this point in your journey, you can explore the following paths:
