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.

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

  1. Navigate to Connections > Collector > Fleet Management.

  2. Click the API tab.

  3. 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.

  4. 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
  5. Copy the following code block and paste it at the end of the config.alloy file.

    alloy
    remotecfg {
           url = "<SERVICE_URL>"
           basic_auth {
               username      = "<USERNAME>"
               password      = "<PASSWORD>"
           }
       
           id             = constants.hostname
           attributes     = {"cluster" = "dev", "namespace" = "otlp-dev"}
           poll_frequency = "5m"
       }
  6. Update the following fields of the code block:

    Code block fieldEnter
    urlThe Fleet Management service URL
    usernameThe instance ID
    passwordThe access token you created in the previous milestone
  7. If you installed Grafana Alloy on a Kubernetes platform and didn’t use the Kubernetes Monitoring Helm chart v2.1 or later, then enter:

    attributes = {"cluster" = "dev", "namespace" = "otlp-dev", "platform" = "kubernetes"}
  8. Save your changes to the Alloy configuration file..

  9. Add the following environment variables to the Grafana Alloy service environment variables file:

    GCLOUD_RW_API_KEY = "<Enter-access-policy-token>"

    For macOS only:

    GCLOUD_FM_LOG_PATH = $PWD/alloy.log 

    Refer to Configure Grafana Alloy on Kubernetes, Configure Grafana Alloy on macOS, or Configure Grafana Alloy on 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 > Collector > 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.

Were you successful?

More to explore (optional)

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

Add remote attributes

Onboard collectors deployed in Kubernetes to Fleet Management


page 5 of 9