For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/ko/api/latest/hosts/get-all-hosts-for-your-organization.md. A documentation index is available at /llms.txt.
Language
Datadog site

조직의 모든 호스트 가져오기

GEThttps://api.datadoghq.com/api/v1/hostshttps://api.us3.datadoghq.com/api/v1/hostshttps://api.us5.datadoghq.com/api/v1/hostshttps://api.datadoghq.eu/api/v1/hostshttps://api.ap1.datadoghq.com/api/v1/hostshttps://api.ap2.datadoghq.com/api/v1/hostshttps://api.uk1.datadoghq.com/api/v1/hostshttps://api.ddog-gov.com/api/v1/hostshttps://api.us2.ddog-gov.com/api/v1/hosts

개요

이 엔드포인트를 사용하면 이름, 별칭 또는 태그별로 호스트를 검색할 수 있습니다. 기본적으로 지난 3시간 이내에 활성화된 호스트가 포함됩니다. 보존 기간은 7일입니다. 결과는 페이지별로 표시되며 한 번에 최대 1000개의 결과가 표시됩니다. 참고: 호스트가 Amazon EC2 인스턴스인 경우 응답에서 id가 aws_id로 대체됩니다. 참고: 이 엔드포인트에서 반환된 데이터를 보안 검사로 보강하려면 새로운 api/v2/security/scanned-assets-metadata 엔드포인트를 참조하세요.

This endpoint requires the hosts_read permission.

OAuth apps require the hosts_read authorization scope to access this endpoint.

인수

쿼리 문자열

이름
유형
설명
filter
string

String to filter search results.

sort_field
string

Sort hosts by this field.

sort_dir
string

Direction of sort. Options include asc and desc.

start
integer

Specify the starting point for the host search results. For example, if you set count to 100 and the first 100 results have already been returned, you can set start to 101 to get the next 100 results.

count
integer

Number of hosts to return. Max 1000.

from
integer

Number of seconds since UNIX epoch from which you want to search your hosts.

include_muted_hosts_data
boolean

Include information on the muted status of hosts and when the mute expires.

include_hosts_metadata
boolean

Include additional metadata about the hosts (agent_version, machine, platform, processor, etc.).

응답

OK

Response with Host information from Datadog.

항목
유형
설명
host_list
[object]

Array of hosts.

total_matching
int64

Number of host matching the query.

total_returned
int64

Number of host returned.

코드 예시

조직의 모든 호스트 가져오기
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v1/hosts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v1/hosts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v1/hosts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v1/hosts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v1/hosts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v1/hosts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v1/hosts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v1/hosts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v1/hosts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"