For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/es/api/latest/snapshots/take-graph-snapshots.md. A documentation index is available at /llms.txt.
Language
Datadog site

Tomar snapshots de gráficos

GEThttps://api.datadoghq.com/api/v1/graph/snapshothttps://api.us3.datadoghq.com/api/v1/graph/snapshothttps://api.us5.datadoghq.com/api/v1/graph/snapshothttps://api.datadoghq.eu/api/v1/graph/snapshothttps://api.ap1.datadoghq.com/api/v1/graph/snapshothttps://api.ap2.datadoghq.com/api/v1/graph/snapshothttps://api.uk1.datadoghq.com/api/v1/graph/snapshothttps://api.ddog-gov.com/api/v1/graph/snapshothttps://api.us2.ddog-gov.com/api/v1/graph/snapshot

Descripción general

Toma de gráficos. Los snapshots son imágenes PNG generadas reproduciendo un widget específico en una página web y capturándolo una vez que los datos están disponibles. Luego, la imagen se carga al almacenamiento en la nube.

Nota: Cuando se crea un snapshot, hay un cierto retraso antes de que esté disponible.

Argumentos

Cadenas de consulta

Nombre
Type
Descripción
metric_query
string

The metric query.

start [required]
integer

The POSIX timestamp of the start of the query in seconds.

end [required]
integer

The POSIX timestamp of the end of the query in seconds.

event_query
string

A query that adds event bands to the graph.

graph_def
string

A JSON document defining the graph. graph_def can be used instead of metric_query. The JSON document uses the grammar defined here and should be formatted to a single line then URL encoded.

title
string

A title for the graph. If no title is specified, the graph does not have a title.

height
integer

The height of the graph. If no height is specified, the graph's original height is used.

width
integer

The width of the graph. If no width is specified, the graph's original width is used.

Respuesta

OK

Object representing a graph snapshot.

Campo
Type
Descripción
graph_def
string

A JSON document defining the graph. graph_def can be used instead of metric_query. The JSON document uses the grammar defined here and should be formatted to a single line then URL encoded.

metric_query
string

The metric query. One of metric_query or graph_def is required.

snapshot_url
string

URL of your graph snapshot.

Ejemplo de código

Tomar snapshots de gráficos
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"