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:

  1. On the MongoDB integration page in Grafana Cloud, scroll to the Set up Grafana Alloy to use the MongoDB integration section.

  2. At the bottom of the snippet, click Copy to clipboard.

  3. Create or open your Grafana Alloy configuration file.

    The default configuration file location is /etc/alloy/config.alloy.

  4. Paste the integration snippet into the configuration file.

In your next milestone, you’ll prepare the specific MongoDB connection configuration.

Were you successful?

More to explore (optional)

At this point in your journey, you can explore the following paths:

Configure Grafana Alloy

Logs and relabeling basics in Grafana Alloy (tutorial)

MongoDB exporter configuration reference


page 5 of 10