Test connection and verify metrics

In this milestone, you restart the Grafana Alloy service with the MongoDB configuration and verify that metrics are successfully flowing to Grafana Cloud.

Testing the connection ensures that Grafana Alloy can communicate with both your MongoDB instance and Grafana Cloud, confirming the complete observability pipeline.

To test the connection and verify metrics, complete the following steps:

  1. Save your Grafana Alloy configuration file.

    Ensure all changes are saved to /etc/alloy/config.alloy (Linux), $(brew --prefix)/etc/alloy/config.alloy (macOS), or your custom configuration location.

  2. Restart the Grafana Alloy service.

    On a Linux machine, run:

    Bash
    sudo systemctl restart alloy

    On macOS, run:

    Bash
    brew services restart grafana/grafana/alloy
  3. Check the service status to ensure Alloy is running properly.

    On a Linux machine, run:

    Bash
    sudo systemctl status alloy

    On macOS, run:

    Bash
    brew services info grafana/grafana/alloy

    The output should show active (running) status.

  4. In Grafana Cloud, click Test connection.

    It might take up to a few minutes for the system to verify the connection.

    You’ll know the connection is working when you see Integration is collecting data and sending it to Grafana Cloud.

  5. Verify metrics are appearing in Grafana Cloud.

    1. In Grafana Cloud navigate to Explore.
    2. Select your Prometheus data source.
    3. Query for MongoDB metrics using: mongodb_up

    If the connection is successful, you should see a value of 1 indicating MongoDB is reachable.

In your next milestone, you’ll install the pre-built MongoDB dashboards and alerts.

Were you successful?


page 7 of 10