---
title: "Register a collector with Grafana Fleet Management | Grafana Labs"
description: "Learn how to add a Grafana Alloy collector to Fleet Management"
---

# Register a collector with Grafana Fleet Management

In this milestone, you’ll register a collector in Fleet Management by adding the `remotecfg` code block to the Grafana Alloy configuration file.

You can set attributes for a collector in both the `remotecfg` block of the configuration file and in the Fleet Management user interface. Attributes typically describe the collector’s purpose or environment, such as `role`, `environment`, `cluster`, or `team`. These attributes help you filter the collector inventory and assign specific configurations to collectors based on their characteristics.

Watch video -&gt;

To register a collector with Grafana Cloud Fleet Management, complete the following steps:

01. Navigate to **Connections &gt; Fleet Management**.
02. Click the **API** tab.
03. Make note of the following information:
    
    - In the first **Base URL** field, make note of the Fleet Management service URL.
      
      The Fleet Management service URL follows the convention `https://fleet-management-<CLUSTER_NAME>.grafana.net/`
    - In the **API Authentication** section, make note of the **Instance ID**.
04. Open the Grafana Alloy configuration file.
    
    The default configuration file location for Alloy is:
    
    - Linux: `/etc/alloy/config.alloy`
    - macOS: `$(brew --prefix)/etc/alloy/config.alloy`
    - Windows: `%ProgramFiles%\GrafanaLabs\Alloy\config.alloy`
05. Copy the following code block and paste it at the end of the `config.alloy` file.
    
    Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
    
    ```alloy
    remotecfg {
           url = "<SERVICE_URL>"
           basic_auth {
               username      = "<USERNAME>"
               password      = "<PASSWORD>"
           }
       
           id             = constants.hostname
           attributes     = {"cluster" = "dev", "namespace" = "otlp-dev"}
           poll_frequency = "5m"
       }
    ```
06. Update the following fields of the code block:
    
    Expand table
    
    | Code block field | Enter                                                  |
    |------------------|--------------------------------------------------------|
    | `url`            | The Fleet Management service URL                       |
    | `username`       | The instance ID                                        |
    | `password`       | The access token you created in the previous milestone |
07. If you installed Grafana Alloy on a Kubernetes platform and didn’t use the Kubernetes Monitoring Helm chart v2.1 or later, then enter:
    
    ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
    
    ```none
    attributes = {"cluster" = "dev", "namespace" = "otlp-dev", "platform" = "kubernetes"}
    ```
08. Save your changes to the Alloy configuration file..
09. Add the following environment variables to the Grafana Alloy service environment variables file:
    
    ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
    
    ```none
    GCLOUD_RW_API_KEY = "<Enter-access-policy-token>"
    ```
    
    For macOS only:
    
    ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
    
    ```none
    GCLOUD_FM_LOG_PATH = $PWD/alloy.log 
    ```
    
    Refer to [Configure Grafana Alloy on Kubernetes](/docs/grafana-cloud/send-data/alloy/configure/kubernetes/), [Configure Grafana Alloy on macOS](/docs/grafana-cloud/send-data/alloy/configure/macos/), or [Configure Grafana Alloy on Windows](/docs/grafana-cloud/send-data/alloy/configure/windows/), for more information on how to set environment variables on your operating system.
10. Save your changes to the environment variables file.
11. Restart the Grafana Alloy service.
12. Navigate to **Connections &gt; Fleet Management**.
    
    The collector you just registered should be listed.

In the next milestone, you’ll learn how to view the health status of a collector.
