Returns agents with support for pagination, sorting, and filtering.
Use page_number and page_size to navigate pages, filter to narrow by field values,
and tags to filter by agent tags.
This endpoint requires the hosts_read permission.
Arguments
Chaînes de requête
Nom
Type
Description
page_number
integer
Page number for pagination, starting at 0.
page_size
integer
Number of agents to return per page. Maximum value is 100. Defaults to 10.
filter
string
Filter string to narrow down agent results.
tags
string
Comma-separated list of tag keys to select which tags are included in each agent’s tags attribute. Does not filter which agents are returned.
sort_attribute
string
Agent attribute to sort results by. Must be a supported attribute name; unsupported values return a 400 error.
sort_descending
boolean
Set to true to sort results in descending order. Defaults to ascending.
Response containing a paginated list of Datadog Agents.
Expand All
Champ
Type
Description
data [required]
[object]
Array of agents matching the query criteria.
attributes [required]
object
Attributes of a Datadog Agent in the v2 list response.
agent_version
string
The Datadog Agent version.
api_key_name
string
The name of the API key used by the agent, if available and not redacted.
api_key_uuid
string
The UUID of the API key used by the agent.
cloud_provider
string
The cloud provider where the agent is running.
cluster_name
string
The Kubernetes cluster name, if the agent runs in a cluster.
datadog_data_center
string
The Datadog data center the agent reports to.
ecs_fargate_cluster_name
string
The ECS Fargate cluster name, if the agent runs in an ECS Fargate environment.
ecs_fargate_task_arn
string
The ECS Fargate task ARN, if the agent runs in an ECS Fargate environment.
enabled_products
[string]
Datadog products enabled on the agent.
env
[string]
Environments the agent is reporting from.
first_seen_at
int64
Unix timestamp when the agent was first seen.
fleet_policies
[string]
Identifiers of fleet policies applied to the agent.
hostname
string
The hostname of the agent.
instrumentation_error_counts
int64
Number of instrumentation errors on the agent. Absent from the response when the count is zero.
instrumentation_status
enum
The single-step instrumentation status of the Agent.
Allowed enum values: success,failure
integrations
[string]
Names of integrations configured on the agent.
ip_addresses
[string]
IP addresses of the agent host.
is_single_step_instrumentation_enabled
boolean
Whether single-step instrumentation is enabled on the agent.
last_restart_at
int64
Unix timestamp of the last agent restart.
os
string
The operating system of the host.
otel_collector_deployment_types
[string]
OpenTelemetry collector deployment types associated with the agent.
otel_collector_distributions
[string]
OpenTelemetry collector distributions associated with the agent.
otel_collector_versions
[string]
All OpenTelemetry collector versions associated with the agent.
otel_resource_attributes
[string]
OpenTelemetry resource attributes reported by the agent.
pod_name
string
The Kubernetes pod name, if the agent runs as a pod.
remote_agent_management
string
The remote agent management status.
remote_config_status
string
The remote configuration connection status of the agent.
services
[string]
Services running on the agent.
tags
[object]
Tags associated with the agent. Returned as an empty array when the agent has no tags.
key
string
The tag key.
value
string
The tag value.
team
string
The team associated with the agent.
id [required]
string
The unique agent key identifier.
type [required]
enum
The type of the agent resource.
Allowed enum values: agent
default: agent
meta
object
Metadata for the v2 list of agents, including pagination information.
page
object
Pagination details for the v2 list of agents.
total_count
int64
Total number of agents in the fleet, regardless of any filter.
total_filtered_count
int64
Total number of agents matching the current filter criteria.
{"data":[{"attributes":{"agent_version":"7.50.0","api_key_name":"Production API Key","api_key_uuid":"a1b2c3d4-e5f6-4321-a123-123456789abc","cloud_provider":"aws","cluster_name":"production-us-east-1","datadog_data_center":"us1","ecs_fargate_cluster_name":"my-ecs-cluster","ecs_fargate_task_arn":"arn:aws:ecs:us-east-1:123456789012:task/my-cluster/abc123","enabled_products":[],"env":[],"first_seen_at":1699900000,"fleet_policies":[],"hostname":"my-hostname","instrumentation_error_counts":3,"instrumentation_status":"success","integrations":[],"ip_addresses":[],"is_single_step_instrumentation_enabled":true,"last_restart_at":1699999999,"os":"linux","otel_collector_deployment_types":[],"otel_collector_distributions":[],"otel_collector_versions":[],"otel_resource_attributes":[],"pod_name":"datadog-agent-abc123","remote_agent_management":"enabled","remote_config_status":"connected","services":[],"tags":[{"key":"string","value":"string"}],"team":"platform"},"id":"my-agent-hostname","type":"agent"}],"meta":{"page":{"total_count":500,"total_filtered_count":42}}}
# List all Datadog Agents returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::FleetAutomationAPI.newpapi_instance.list_fleet_agents_v2()
// List all Datadog Agents returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewFleetAutomationApi(apiClient)resp,r,err:=api.ListFleetAgentsV2(ctx,*datadogV2.NewListFleetAgentsV2OptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `FleetAutomationApi.ListFleetAgentsV2`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `FleetAutomationApi.ListFleetAgentsV2`:\n%s\n",responseContent)}
/**
* List all Datadog Agents returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.FleetAutomationApi(configuration);apiInstance.listFleetAgentsV2().then((data: v2.FleetAgentsV2Response)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));