Get detailed information about an agent

GET https://api.ap1.datadoghq.com/api/v2/fleet/agents/{agent_key}https://api.ap2.datadoghq.com/api/v2/fleet/agents/{agent_key}https://api.datadoghq.eu/api/v2/fleet/agents/{agent_key}https://api.ddog-gov.com/api/v2/fleet/agents/{agent_key}https://api.us2.ddog-gov.com/api/v2/fleet/agents/{agent_key}https://api.uk1.datadoghq.com/api/v2/fleet/agents/{agent_key}https://api.datadoghq.com/api/v2/fleet/agents/{agent_key}https://api.us3.datadoghq.com/api/v2/fleet/agents/{agent_key}https://api.us5.datadoghq.com/api/v2/fleet/agents/{agent_key}

개요

Retrieve detailed information about a specific Datadog Agent.

By default, only agent_infos is returned. Use the include query parameter to request additional data: integrations and/or configuration_files.

This endpoint requires the hosts_read permission.

인수

경로 파라미터

이름

유형

설명

agent_key [required]

string

The unique identifier (Agent key) for the Datadog Agent. Must be a 32-character lowercase hexadecimal string.

쿼리 문자열

이름

유형

설명

include

string

Comma-separated list of additional fields to include in the response. Valid values are integrations and configuration_files. Omitting this parameter returns only agent_infos. Unrecognized values are silently ignored rather than causing an error.

응답

OK

Response containing detailed information about a specific Datadog Agent.

Expand All

항목

유형

설명

data [required]

object

Detailed information about a specific Datadog Agent.

attributes [required]

object

Attributes for the v2 agent detail response.

agent_infos [required]

object

Detailed information about a Datadog Agent.

active_ha_agent

string

The currently active agent in the high-availability group.

agent_version

string

The Datadog Agent version.

api_key_name

string

The API key name (if available and not redacted).

api_key_uuid

string

The API key UUID.

cloud_provider

string

The cloud provider where the agent is running.

cluster_name

string

Kubernetes cluster name (if applicable).

config_id

string

The configuration identifier applied to the agent.

datadog_agent_key

string

The unique agent key identifier.

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

Timestamp when the agent was first seen.

ha_agent_hosts

[string]

Hosts participating in the agent's high-availability group.

ha_agent_state

string

The high-availability state of the agent.

hostname

string

The hostname of the agent.

hostname_aliases

[string]

Alternative hostname list for the agent.

install_method_installer_version

string

The version of the installer used.

install_method_tool

string

The tool used to install the agent.

ip_addresses

[string]

IP addresses of the agent.

is_single_step_instrumentation_enabled

boolean

Whether single-step instrumentation is enabled.

last_restart_at

int64

Timestamp of the last agent restart.

os

string

The operating system.

os_version

string

The operating system version.

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]

List of OpenTelemetry collector versions (if applicable).

otel_collectors

[object]

OpenTelemetry collectors associated with the agent (if applicable).

otel_resource_attributes

[string]

OpenTelemetry resource attributes reported by the agent.

pod_name

string

Kubernetes pod name (if applicable).

preferred_ha_active_agent

string

The preferred active agent in the high-availability group.

python_version

string

The Python version used by the agent.

region

[string]

Regions where the agent is running.

remote_agent_management

string

Remote agent management status.

remote_config_status

string

Remote configuration status.

services

[string]

Services running on the agent.

support_agent_upgrade

boolean

Whether the agent supports remote agent upgrade.

tags

[string]

Tags associated with the agent.

team

string

Team associated with the agent.

configuration_files

object

Configuration file details, present only when configuration_files is included in the include query parameter.

agent_configuration

object

Configuration information organized by layers.

compiled_configuration

string

The final compiled configuration.

env_configuration

string

Configuration from environment variables.

file_configuration

string

Configuration from files.

remote_configuration

string

Remote configuration settings.

runtime_configuration

string

Runtime configuration.

application_monitoring_configuration

object

Configuration information organized by layers.

compiled_configuration

string

The final compiled configuration.

env_configuration

string

Configuration from environment variables.

file_configuration

string

Configuration from files.

remote_configuration

string

Remote configuration settings.

runtime_configuration

string

Runtime configuration.

otel_collectors_configuration

[object]

Configuration for OpenTelemetry collectors associated with the agent. Present only when the agent has associated OpenTelemetry collectors.

collector_id

string

The unique identifier of the OpenTelemetry collector.

compiled_configuration

string

The final compiled configuration of the OpenTelemetry collector.

distribution

string

The distribution of the OpenTelemetry collector.

security_agent_configuration

object

Configuration information organized by layers.

compiled_configuration

string

The final compiled configuration.

env_configuration

string

Configuration from environment variables.

file_configuration

string

Configuration from files.

remote_configuration

string

Remote configuration settings.

runtime_configuration

string

Runtime configuration.

system_probe_configuration

object

Configuration information organized by layers.

compiled_configuration

string

The final compiled configuration.

env_configuration

string

Configuration from environment variables.

file_configuration

string

Configuration from files.

remote_configuration

string

Remote configuration settings.

runtime_configuration

string

Runtime configuration.

integrations

object

Integration details, present only when integrations is included in the include query parameter.

configuration_files

[object]

Configuration files for integrations.

agent_hash

string

Hash of the configuration file as seen by the agent.

file_content

string

The raw content of the configuration file.

file_path

string

Path to the configuration file.

filename

string

Name of the configuration file.

error_integrations

[object]

Integrations with errors.

data_type

string

Type of data collected, such as metrics or logs.

error_messages

[string]

Error messages if the integration has issues.

init_config

string

Initialization configuration (YAML format).

instance_config

string

Instance-specific configuration (YAML format).

is_custom_check

boolean

Whether this is a custom integration.

is_default

boolean

Whether this is a default integration instance.

is_init

boolean

Whether this integration configuration is an init config.

log_config

string

Log collection configuration (YAML format).

name

string

Name of the integration instance.

pod_count

int64

Number of pods running this integration. Absent from the response when the count is zero.

source_index

int64

Index in the configuration file.

source_path

string

Path to the configuration file.

type

string

Integration type.

missing_integrations

[object]

Detected but not configured integrations.

escaped_name

string

Escaped integration name.

prefix

string

Integration prefix identifier.

warning_integrations

[object]

Integrations with warnings.

data_type

string

Type of data collected, such as metrics or logs.

error_messages

[string]

Error messages if the integration has issues.

init_config

string

Initialization configuration (YAML format).

instance_config

string

Instance-specific configuration (YAML format).

is_custom_check

boolean

Whether this is a custom integration.

is_default

boolean

Whether this is a default integration instance.

is_init

boolean

Whether this integration configuration is an init config.

log_config

string

Log collection configuration (YAML format).

name

string

Name of the integration instance.

pod_count

int64

Number of pods running this integration. Absent from the response when the count is zero.

source_index

int64

Index in the configuration file.

source_path

string

Path to the configuration file.

type

string

Integration type.

working_integrations

[object]

Integrations that are working correctly.

data_type

string

Type of data collected, such as metrics or logs.

error_messages

[string]

Error messages if the integration has issues.

init_config

string

Initialization configuration (YAML format).

instance_config

string

Instance-specific configuration (YAML format).

is_custom_check

boolean

Whether this is a custom integration.

is_default

boolean

Whether this is a default integration instance.

is_init

boolean

Whether this integration configuration is an init config.

log_config

string

Log collection configuration (YAML format).

name

string

Name of the integration instance.

pod_count

int64

Number of pods running this integration. Absent from the response when the count is zero.

source_index

int64

Index in the configuration file.

source_path

string

Path to the configuration file.

type

string

Integration type.

id [required]

string

The unique agent key identifier.

type [required]

enum

The type of the agent resource. Allowed enum values: agent

default: agent

{
  "data": {
    "attributes": {
      "agent_infos": {
        "active_ha_agent": "string",
        "agent_version": "7.50.0",
        "api_key_name": "Production API Key",
        "api_key_uuid": "a1b2c3d4-e5f6-4321-a123-123456789abc",
        "cloud_provider": "aws",
        "cluster_name": "string",
        "config_id": "string",
        "datadog_agent_key": "a1b2c3d4e5f67890a1b2c3d4e5f67890",
        "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": "integer",
        "ha_agent_hosts": [],
        "ha_agent_state": "string",
        "hostname": "my-hostname",
        "hostname_aliases": [],
        "install_method_installer_version": "1.2.3",
        "install_method_tool": "chef",
        "ip_addresses": [],
        "is_single_step_instrumentation_enabled": false,
        "last_restart_at": "integer",
        "os": "linux",
        "os_version": "Ubuntu 20.04",
        "otel_collector_deployment_types": [],
        "otel_collector_distributions": [],
        "otel_collector_versions": [],
        "otel_collectors": [],
        "otel_resource_attributes": [],
        "pod_name": "string",
        "preferred_ha_active_agent": "string",
        "python_version": "3.9.5",
        "region": [],
        "remote_agent_management": "enabled",
        "remote_config_status": "connected",
        "services": [],
        "support_agent_upgrade": false,
        "tags": [],
        "team": "string"
      },
      "configuration_files": {
        "agent_configuration": {
          "compiled_configuration": "string",
          "env_configuration": "string",
          "file_configuration": "string",
          "remote_configuration": "string",
          "runtime_configuration": "string"
        },
        "application_monitoring_configuration": {
          "compiled_configuration": "string",
          "env_configuration": "string",
          "file_configuration": "string",
          "remote_configuration": "string",
          "runtime_configuration": "string"
        },
        "otel_collectors_configuration": [
          {
            "collector_id": "string",
            "compiled_configuration": "string",
            "distribution": "string"
          }
        ],
        "security_agent_configuration": {
          "compiled_configuration": "string",
          "env_configuration": "string",
          "file_configuration": "string",
          "remote_configuration": "string",
          "runtime_configuration": "string"
        },
        "system_probe_configuration": {
          "compiled_configuration": "string",
          "env_configuration": "string",
          "file_configuration": "string",
          "remote_configuration": "string",
          "runtime_configuration": "string"
        }
      },
      "integrations": {
        "configuration_files": [
          {
            "agent_hash": "string",
            "file_content": "string",
            "file_path": "/conf.d/postgres.d/postgres.yaml",
            "filename": "postgres.yaml"
          }
        ],
        "error_integrations": [
          {
            "data_type": "metrics",
            "error_messages": [],
            "init_config": "string",
            "instance_config": "string",
            "is_custom_check": false,
            "is_default": false,
            "is_init": false,
            "log_config": "string",
            "name": "string",
            "pod_count": "integer",
            "source_index": "integer",
            "source_path": "string",
            "type": "postgres"
          }
        ],
        "missing_integrations": [
          {
            "escaped_name": "postgresql",
            "prefix": "postgres"
          }
        ],
        "warning_integrations": [
          {
            "data_type": "metrics",
            "error_messages": [],
            "init_config": "string",
            "instance_config": "string",
            "is_custom_check": false,
            "is_default": false,
            "is_init": false,
            "log_config": "string",
            "name": "string",
            "pod_count": "integer",
            "source_index": "integer",
            "source_path": "string",
            "type": "postgres"
          }
        ],
        "working_integrations": [
          {
            "data_type": "metrics",
            "error_messages": [],
            "init_config": "string",
            "instance_config": "string",
            "is_custom_check": false,
            "is_default": false,
            "is_init": false,
            "log_config": "string",
            "name": "string",
            "pod_count": "integer",
            "source_index": "integer",
            "source_path": "string",
            "type": "postgres"
          }
        ]
      }
    },
    "id": "a1b2c3d4e5f67890a1b2c3d4e5f67890",
    "type": "agent"
  }
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

코드 사례

                  # Path parameters
export agent_key="a1b2c3d4e5f67890a1b2c3d4e5f67890"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.uk1.datadoghq.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/fleet/agents/${agent_key}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
# Get detailed information about an agent returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new
p api_instance.get_fleet_agent_detail_v2("a1b2c3d4e5f67890a1b2c3d4e5f67890")

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get detailed information about an agent returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewFleetAutomationApi(apiClient)
	resp, r, err := api.GetFleetAgentDetailV2(ctx, "a1b2c3d4e5f67890a1b2c3d4e5f67890", *datadogV2.NewGetFleetAgentDetailV2OptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `FleetAutomationApi.GetFleetAgentDetailV2`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `FleetAutomationApi.GetFleetAgentDetailV2`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
/**
 * Get detailed information about an agent returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.FleetAutomationApi(configuration);

const params: v2.FleetAutomationApiGetFleetAgentDetailV2Request = {
  agentKey: "a1b2c3d4e5f67890a1b2c3d4e5f67890",
};

apiInstance
  .getFleetAgentDetailV2(params)
  .then((data: v2.FleetAgentDetailV2Response) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"