For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/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}"