| name | fleet-management |
| license | Apache-2.0 |
| description | Manage a fleet of Grafana Alloy collectors with Fleet Management — author Alloy pipelines once, target them via attribute matchers (`env="production"`, regex `region=~"us-.*"`), push remotely via OpAMP without restarting collectors. Covers pipeline create / update / matcher RPCs, collector attribute API, `remotecfg` bootstrap block (standalone + Helm), pre-deploy `alloy fmt` validation, the local Alloy UI at port 12345 for component health, and post-deploy `REMOTE_CONFIG_STATUS_APPLIED` verification. Use when standing up a Cloud Alloy fleet, pushing a config change to 200 collectors, hunting why one collector shows `REMOTE_CONFIG_STATUS_FAILED`, validating River syntax before saving, or wiring `discovery.kubernetes` → `prometheus.remote_write` — even when the user says "configure Alloy", "remote config the collectors", "push pipeline", "OpAMP", "collector is unhealthy", or "manage agent config centrally" without naming Fleet Management. |
Grafana Fleet Management + Alloy Configuration
Docs: https://grafana.com/docs/grafana-cloud/send-data/fleet-management/
Remote pipeline distribution to Alloy collectors via OpAMP — author once, target with matchers, hot-apply (no restart).
Prerequisites
- Grafana Cloud stack with Fleet Management enabled
- API token with Fleet Management access (
Authorization: Bearer <STACK_ID>:<TOKEN>)
- Alloy ≥ 1.0 installed on the targets (standalone or via
grafana/alloy Helm chart)
alloy CLI locally for alloy fmt syntax validation
Concepts
- Collector — Alloy instance with unique ID + attributes
- Pipeline — named Alloy River config stored in Fleet Management
- Matcher — selector mapping a pipeline to collectors by attribute
- Attributes — key/value labels on a collector (
env, team, region)
Common Workflows
1. Author + validate + deploy a pipeline
cat > pipeline.alloy <<'EOF'
prometheus.scrape "default" {
targets = []
forward_to = [prometheus.remote_write.grafana_cloud.receiver]
scrape_interval = "60s"
}
prometheus.remote_write "grafana_cloud" {
endpoint {
url = "https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push"
basic_auth {
username = "<METRICS_USERNAME>"
password = env("GRAFANA_CLOUD_API_KEY")
}
}
}
EOF
alloy fmt pipeline.alloy
alloy validate pipeline.alloy
BASE=https://fleet-management-prod-us-east-0.grafana.net
TOKEN=<STACK_ID>:<API_TOKEN>
PAYLOAD=$(jq -n --rawfile c pipeline.alloy '{
name:"k8s-metrics", contents:$c,
matchers:[{name:"env",value:"production",type:"EQUAL"}]
}')
curl -s -X POST "$BASE/pipeline.v1.PipelineService/CreatePipeline" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "$PAYLOAD" | jq
curl -s -X POST "$BASE/collector.v1.CollectorService/ListCollectors" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{}' \
| jq '.collectors[] | select(.attributes[]?.value=="production")
| {name, remoteConfigStatus}'
2. Troubleshoot a REMOTE_CONFIG_STATUS_FAILED collector
curl -s -X POST "$BASE/collector.v1.CollectorService/ListCollectors" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{}' \
| jq '.collectors[] | select(.remoteConfigStatus=="REMOTE_CONFIG_STATUS_FAILED")
| {name, msg:.remoteConfigStatusMessage}'
alloy fmt pipeline.alloy
kubectl -n monitoring logs -l app.kubernetes.io/name=alloy --tail=100 | grep -iE 'remote|error'
Failure-message decoder table: references/api.md.
3. Onboard a new Alloy with the bootstrap block
The bootstrap remotecfg block is the only local config required:
remotecfg {
url = "https://<FLEET_MANAGEMENT_HOST>"
basic_auth { username = "<STACK_ID>"; password = env("GRAFANA_CLOUD_API_KEY") }
poll_frequency = "1m"
attributes = { "env" = env("ENVIRONMENT"), "team" = "platform" }
}
curl -s http://localhost:12345/api/v0/web/components \
| jq '.[] | select(.id=="remotecfg") | {id, health:.health.state}'
Full bootstrap (standalone + Helm) + Assistant tool list: references/bootstrap.md.
Resources