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

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Register a collector with Grafana Fleet Management

In this milestone, you 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 and the Fleet Management user interface. Attributes describe the collector’s purpose or environment, such as `role`, `environment`, `cluster`, or `team`.

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

01. Click the **API** tab.
02. Make note of the Fleet Management service **Base URL**.
03. Make note of the **Instance ID**.
04. Open the Grafana Alloy configuration file on the machine where Alloy runs.
05. Copy the following `remotecfg` 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. Set `url` to the Fleet Management service URL, `username` to the instance ID, and `password` to the access token you created in the previous milestone.
07. Save your changes to the Alloy configuration file.
08. Add `GCLOUD_RW_API_KEY = "<Enter-access-policy-token>"` to the Grafana Alloy service environment variables file. For macOS, also set `GCLOUD_FM_LOG_PATH = $PWD/alloy.log`.
09. Save your changes to the environment variables file and restart the Grafana Alloy service.
10. Return to the **Inventory** tab and confirm that the collector you registered is listed.

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

* * *

### More to explore (optional)

At this point in your journey, you can explore the following paths:

- [Add remote attributes](/docs/grafana-cloud/send-data/fleet-management/set-up/onboard-collectors/standalone-installations/#add-remote-attributes)
- [Onboard collectors deployed in Kubernetes to Fleet Management](/docs/grafana-cloud/send-data/fleet-management/set-up/onboard-collectors/kubernetes/)

* * *

### Troubleshooting

Explore the following troubleshooting topics if you need help:

- [Collector isn’t in Inventory](/docs/grafana-cloud/send-data/fleet-management/set-up/onboard-collectors/onboard-troubleshooting/#collector-isnt-in-inventory)
- [Collector was deleted from Inventory](/docs/grafana-cloud/send-data/fleet-management/set-up/onboard-collectors/onboard-troubleshooting/#collector-was-deleted-from-inventory)
