Configure GCP Metrics
Complete the following steps to configure GCP Metrics as shown in the following diagram.
Select your platform
Select the platform from the drop-down menu.
Install Grafana Alloy
Grafana Alloy includes an embedded exporter to gather and send metrics to Grafana Cloud.
- If you have not already installed Alloy where you intend to run GCP Metrics, click Run Grafana Alloy.
- At the Alloy configuration screen, either create a token or use an existing token.
- To create a token, enter a token name, then click Create token. The token displays on the screen and is added to the command for running Alloy. Copy the command and paste it into the terminal.
- To use an existing token, paste it into the token field, then click Proceed to install integration.
- Copy the command and paste it into the terminal.
- Click Proceed to install integration.
Set up GCP service account
To export metrics from GCP, the Google Stackdriver Exporter is used. That exporter uses the Google Golang Client Library, which offers a variety of ways to provide credentials.
- Click Setup instructions.
- At the Set up GCP service account screen, use the content and links to set up the service account in Google Cloud.
- To learn how to provide credentials, refer to Google Application Default Credentials.
- The
roles/monitoring.viewer
IAM role contains the required permissions. Refer to the Access Control Guide for details. - For legacy Access scopes, you must use the
https://www.googleapis.com/auth/monitoring.read
scope.
- Click Close to return to the next step.
Configure Alloy
Set up Grafana Alloy to scrape resource metrics within your GCP projects.
Navigate to the configuration file for your Alloy instance.
Copy and append the following to your Alloy configuration file to work with the GCP metrics exporter embedded in Grafana Alloy.
Find the value for these properties in GCP and replace them with the appropriate values in your Alloy configuration file.
Add any additional filters to further refine the resources you want to collect metrics from.
Restart Grafana Alloy
Run the command appropriate for your platform to restart Grafana Alloy so your changes can take effect.
Test connection
Click Test connection to test that Grafana Alloy is collecting data and sending it to Grafana Cloud.
View your dashboards
GCP Metrics comes with prebuilt dashboards to get you up and running quickly.