> For the complete documentation index, see [llms.txt](https://docs.groundcover.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.groundcover.com/collect-data/data-sources/google-cloud-monitoring/integrate-google-cloud-monitoring-grafana-datasource.md).

# Integrate Google Cloud Monitoring Grafana Datasource

To set up the Google Cloud Monitoring datasource in Grafana, you need to configure the necessary credentials and permissions. This involves creating a service account in GCP with appropriate permissions to access metrics and data.

{% hint style="info" %}
For more information see Grafana's Google Cloud Monitoring Datasource [documentation](https://grafana.com/docs/grafana/latest/datasources/google-cloud-monitoring/#configure-a-gcp-service-account)
{% endhint %}

### Setting up the service account

Grafana's Google Cloud Monitoring datasource requires a service account with the `Monitoring Viewer` role.

Create a new service account in the GCP console.

1. Choose a unique service name, such as `groundcover-monitoring`
2. Choose `JSON` as the key type
3. Assign the `Monitoring Viewer` role

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-7b4394226b84065072eff88dcc8a6328b7736bfb%2Fimage.png?alt=media" alt=""><figcaption><p>Source: <a href="https://grafana.com/docs/grafana/latest/datasources/google-cloud-monitoring/#configure-a-gcp-service-account">Grafana</a></p></figcaption></figure>

### Create a new service account key

After provisioning the service account above, you will need to create a key to allow the Grafana datasource to authenticate with it.

1. Access the newly provisioned service account through the `Service Accounts` page
2. Click on the `Keys` tab and choose `Add key` -> `Create new key`
3. Choose the `JSON` key type
4. Click `Create`

The key will be downloaded as a local `.json` file. You will need this file for the next step.

### Provisioning the datasource

{% hint style="info" %}
Self provisioning of data sources is only available as part of the enterprise plan. If you are on the team plan, contact the groundcover's team to provision the new datasource.
{% endhint %}

{% hint style="info" %}
The following steps require a user with admin privileges in the platform
{% endhint %}

In the Grafana `Data sources` page, add a new `Google Cloud Monitoring` datasource.

1. Name: Select a meaningful name to your choosing.
2. Authentication:
   1. Authentication type: Select `Google JWT File`
   2. JWT token: Either upload the file created previously or paste its contents directly using `Paste JWT token`

Click `Save & test` to verify the data source correctness.

### Use the datasource in groundcover

After provisioning you can now use new Google Cloud Monitoring datasource in groundcover's Grafana. Explore, built dashboards and create alerts based on any metric availalbe in the GCP monitoring stack.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.groundcover.com/collect-data/data-sources/google-cloud-monitoring/integrate-google-cloud-monitoring-grafana-datasource.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
