Snapshots

Toma snapshots de gráficos utilizando la API.

GET https://api.ap1.datadoghq.com/api/v1/graph/snapshothttps://api.datadoghq.eu/api/v1/graph/snapshothttps://api.ddog-gov.com/api/v1/graph/snapshothttps://api.datadoghq.com/api/v1/graph/snapshothttps://api.us3.datadoghq.com/api/v1/graph/snapshothttps://api.us5.datadoghq.com/api/v1/graph/snapshot

Información general

Toma snapshots de gráficos. Nota: Cuando se crea un snapshot, tarda un tiempo en estar disponible.

Argumentos

Cadenas de consulta

Nombre

Tipo

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.

Expand All

Campo

Tipo

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.

{
  "graph_def": "string",
  "metric_query": "string",
  "snapshot_url": "https://app.datadoghq.com/s/f12345678/aaa-bbb-ccc"
}

Bad Request

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

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

Ejemplo de código

require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

end_ts = Time.now().to_i
start_ts = end_ts - (60 * 60)
dog.graph_snapshot("system.load.1{*}", start_ts, end_ts)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"

PREVIEWING: brett.blue/reorg-otel