Loading...
Loading...
Install, configure, and manage Grafana Alloy collector fleets using Fleet Management and remote configuration pipelines. Use when the user asks to configure Alloy, manage collector pipelines, deploy remote configurations, troubleshoot collector health, work with OpAMP, set up pipeline matchers, or manage collector attributes. Triggers on phrases like "configure Alloy", "fleet management", "remote configuration", "collector pipeline", "OpAMP", "pipeline matcher", "collector attributes", "deploy pipeline", "collector is unhealthy", or "Alloy pipeline YAML".
npx skill4agent add grafana/skills fleet-managementenv=productionBASE=https://fleet-management-prod-us-east-0.grafana.net
TOKEN=<STACK_ID>:<API_TOKEN>
# List all registered collectors and their health status
curl -s -X POST "$BASE/collector.v1.CollectorService/ListCollectors" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}' | jq '.collectors[] | {id, name, remoteConfigStatus}'
# List all pipelines
curl -s -X POST "$BASE/pipeline.v1.PipelineService/ListPipelines" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}'REMOTE_CONFIG_STATUS_APPLIEDREMOTE_CONFIG_STATUS_FAILEDremoteConfigStatusMessage// Basic metrics pipeline: scrape Prometheus metrics and forward to Grafana Cloud
prometheus.scrape "default" {
targets = discovery.relabel.filtered.output
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")
}
}
}| Category | Example components |
|---|---|
| Discovery | |
| Metrics | |
| Logs | |
| Traces | |
| Profiles | |
| Transformation | |
# Create a pipeline via API (contents is plain text Alloy config, not base64)
curl -s -X POST "$BASE/pipeline.v1.PipelineService/CreatePipeline" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "k8s-metrics",
"contents": "prometheus.scrape \"default\" {\n targets = []\n forward_to = []\n}",
"matchers": [
{"name": "env", "value": "production", "type": "EQUAL"}
]
}'{
"matchers": [
"env=\"production\"",
"team=\"platform\""
]
}env=productionteam=platform| Operator | Example | Meaning |
|---|---|---|
| | Exact match |
| | Not equal |
| | Regex match |
| | Regex not match |
# Matchers are set in CreatePipeline or UpdatePipeline
curl -s -X POST "$BASE/pipeline.v1.PipelineService/UpdatePipeline" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "<PIPELINE_ID>",
"matchers": [
{"name": "env", "value": "production", "type": "EQUAL"},
{"name": "team", "value": "platform", "type": "EQUAL"}
]
}'typeEQUALNOT_EQUALREGEXNOT_REGEXcurl -s -X POST "$BASE/collector.v1.CollectorService/UpdateCollector" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "<COLLECTOR_ID>",
"attributes": [
{"name": "env", "value": "production"},
{"name": "team", "value": "platform"},
{"name": "region", "value": "us-east-1"}
]
}'platformarchalloy_versionremotecfg// bootstrap.alloy -- the only local config file Alloy needs
remotecfg {
url = "https://<FLEET_MANAGEMENT_HOST>"
basic_auth {
username = "<STACK_ID>"
password = env("GRAFANA_CLOUD_API_KEY")
}
poll_frequency = "1m"
// Attributes for this collector instance
attributes = {
"env" = env("ENVIRONMENT"),
"team" = "platform",
"region" = env("AWS_REGION"),
}
}# values.yaml for grafana/alloy Helm chart
alloy:
configMap:
content: |
remotecfg {
url = "https://<FLEET_MANAGEMENT_HOST>"
basic_auth {
username = "<STACK_ID>"
password = env("GRAFANA_CLOUD_API_KEY")
}
poll_frequency = "1m"
attributes = {
"env" = "production",
"cluster" = env("CLUSTER_NAME"),
}
}
extraEnv:
- name: GRAFANA_CLOUD_API_KEY
valueFrom:
secretKeyRef:
name: grafana-cloud-credentials
key: api-key# List collectors with FAILED status
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") | {id, name, remoteConfigStatusMessage}'| Status message | Root cause | Fix |
|---|---|---|
| Invalid Alloy River syntax | Fix the pipeline YAML; validate before deploying |
| Alloy version too old for a component | Upgrade Alloy or use an older API |
| Base64 encoding error | Re-encode the config correctly |
| Wrong API token | Rotate and re-apply the token |
| Collector can't reach Fleet Management | Check network/firewall rules |
# Kubernetes
kubectl logs -n monitoring -l app.kubernetes.io/name=alloy --tail=50 | grep -i "remote\|error"
# Systemd
journalctl -u alloy --since "1h ago" | grep -i "remote\|error"http://<COLLECTOR_HOST>:12345fleetManagementReadfleetManagementWritealloyConfigValidation