---
title: "Set up a GEM tenant | Grafana Enterprise Metrics documentation"
description: "Set up a GEM tenant Create a Grafana Enterprise Metrics tenant: Navigate to Grafana Enterprise Metrics > Tenants. Click on Create new tenant. Choose a name for this very tenant. For demonstration purposes, use the name dev-tenant. Select the cluster. Click Create tenant. Create tenant Create an access policy Create a data source access policy and token, which are used by Grafana Enterprise itself to access the metrics in the tenant named dev-tenant:"
---

# Set up a GEM tenant

Create a Grafana Enterprise Metrics tenant:

1. Navigate to **Grafana Enterprise Metrics** &gt; **Tenants**.
2. Click on **Create new tenant**.
3. Choose a name for this very tenant. For demonstration purposes, use the name `dev-tenant`.
4. Select the cluster.
5. Click **Create tenant**.

[Create tenant](../create-tenant.png)

## Create an access policy

Create a data source access policy and token, which are used by Grafana Enterprise itself to access the metrics in the tenant named `dev-tenant`:

1. Navigate to **Grafana Enterprise Metrics** &gt; **Access policies**.
2. Click **Create new access policy**.
3. Choose a name for the policy. For demonstration purposes, use `dev-read-write-policy`.
4. Enable the scope **metrics:read** and **metrics:write**.
5. Select the tenant `dev-tenant`.
6. Click on **Create**.

[Create access policy](../create-ap.png)

1. From the newly created access policy, click **+ Add token**.
2. Name the token `dev-token`, and click on **Create**.
3. In the next window, copy the token.

If you’re using Prometheus, you can add the following example of a remote-write configuration:

YAML ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```yaml
remote_write:
  - url: http://enterprise-metrics/api/v1/push
    basic_auth:
      username: dev-tenant
      password: ZGV2LXJlYWQtd3JpdGVyLXBvbGljeS1kZW1vLXRva2VuOjY/ezduMTVhJDQvPGMvLzQ1SzgsJjFbMQ==
```

If you’re using Grafana Alloy, you can add the following example of a remote-write configuration:

![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```none
prometheus.remote_write "default" {
  endpoint {
    url = "http://enterprise-metrics/api/v1/push"
    basic_auth {
      username = "dev-tenant"
      password = "ZGV2LXJlYWQtd3JpdGVyLXBvbGljeS1kZW1vLXRva2VuOjY/ezduMTVhJDQvPGMvLzQ1SzgsJjFbMQ=="
      }
  }
}
```

## Setup remote-write to your tenant

To enable writes to your cluster, add the above remote-write configuration snippet to the configuration file of an existing Prometheus or Grafana Alloy collector.

If you do not have an existing metrics collector [you can get started with Grafana Alloy](/docs/alloy/latest/get-started/).

An example agent configuration would be:

YAML ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```yaml
server:
  log_level: info
  http_listen_port: 8081

prometheus:
  wal_directory: /tmp/agent
  global:
    scrape_interval: 5s
  configs:
    - name: default
      scrape_configs:
        - job_name: enterprise-metrics
          static_configs:
            - targets: ["localhost:8080"]
        - job_name: agent
          static_configs:
            - targets: ["localhost:8081"]

integrations:
  agent:
    enabled: true
  node_exporter:
    enabled: true
  prometheus_remote_write:
    - url: http://<gme-hostname>/api/v1/push
      basic_auth:
        username: dev-tenant
        password: ZGV2LXJlYWQtd3JpdGVyLXBvbGljeS1kZW1vLXRva2VuOjY/ezduMTVhJDQvPGMvLzQ1SzgsJjFbMQ==
```

## Setup your tenant as a Grafana datasource

Following that we can use this access policy and token to create a new datasource in Grafana:

1. Navigate to **Configuration ≫ Data Sources**.
2. Click on **Add new data source**.
3. Select **Prometheus**.
4. Set the URL to `http://<gme-host>/prometheus`.
5. Enable **Basic Auth** and use **User** `dev-tenant` and as **Password** the token from your clipboard.
6. Click **Save &amp; Test**.

[Create datasource](../create-datasource.png)

## Visualize your data

Once you have created a datasource you should now be able to visualize your metrics in the Grafana Explore page.

[Visualize data](../visualize-data.png)
