---
title: "Test connection and verify metrics | Grafana Labs"
description: "Restart Grafana Alloy service and verify that MongoDB metrics are flowing to Grafana Cloud."
---

# 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 ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   sudo systemctl restart alloy
   ```
   
   On macOS, run:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   brew services restart grafana/grafana/alloy
   ```
3. Check the service status to ensure Alloy is running properly.
   
   On a Linux machine, run:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   sudo systemctl status alloy
   ```
   
   On macOS, run:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   brew services info grafana/grafana/alloy
   ```
   
   The output should show `active (running)` status.
4. In Grafana Cloud, click **Test connection**.
5. 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`.
6. 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.

* * *

### Troubleshooting

Explore the following troubleshooting topics if you need help:

- [Alloy isn’t running after a reboot](/docs/grafana-cloud/monitor-infrastructure/integrations/troubleshoot/install-troubleshoot-linux-alloy/#alloy-isnt-running-after-a-reboot)
- [No metrics were found for this integration](/docs/grafana-cloud/monitor-infrastructure/integrations/troubleshoot/install-troubleshoot-linux-alloy/#no-metrics-were-found-for-this-integration)
- [Alloy was not able to reach your application Prometheus metrics endpoint](/docs/grafana-cloud/monitor-infrastructure/integrations/troubleshoot/install-troubleshoot-linux-alloy/#alloy-was-not-able-to-reach-your-application-prometheus-metrics-endpoint)
