Checks de los servicios

El endpoint del check de servicio permite publicar estados de checks para su uso con monitores. Los mensajes de checks de servicio están limitados a 500 caracteres. Si se publica un check con un mensaje que contiene más de 500 caracteres, sólo se muestran los primeros 500 caracteres. Los mensajes están limitados para checks con estado Crítico o Advertencia, se eliminan para checks con estado Ok.

  • Más información sobre monitores de checks de servicio]1.
  • Más información sobre monitores de checks de proceso]2.
  • Más información sobre monitores de red]3.
  • Más información sobre monitores de checks personalizados]4.
  • Más información sobre checks de servicio y códigos de estado]5.

POST https://api.ap1.datadoghq.com/api/v1/check_runhttps://api.datadoghq.eu/api/v1/check_runhttps://api.ddog-gov.com/api/v1/check_runhttps://api.datadoghq.com/api/v1/check_runhttps://api.us3.datadoghq.com/api/v1/check_runhttps://api.us5.datadoghq.com/api/v1/check_run

Información general

Envía una lista de checks de servicio.

Notas:

  • Se requiere una clave de API válida.
  • Los checks de servicio pueden enviarse hasta 10 minutos antes.

Solicitud

Body Data (required)

Cuerpo de una solicitud de check de servicio.

Expand All

Campo

Tipo

Descripción

check

string

The check.

host_name

string

The host name correlated with the check.

message

string

Message containing check status.

status

enum

The status of a service check. Set to 0 for OK, 1 for warning, 2 for critical, and 3 for unknown. Allowed enum values: 0,1,2,3

tags

[string]

Tags related to a check.

timestamp

int64

Time of check.

[
  {
    "check": "app.ok",
    "host_name": "host",
    "status": 0,
    "tags": [
      "test:ExampleServiceCheck"
    ]
  }
]

Respuesta

Payload accepted

The payload accepted for intake.

Expand All

Campo

Tipo

Descripción

status

string

The status of the intake payload.

{
  "status": "ok"
}

Bad Request

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

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

Authentication Error

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

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

Request timeout

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

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

Payload too large

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

// Submit a Service Check returns "Payload accepted" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_service_checks::ServiceChecksAPI;
use datadog_api_client::datadogV1::model::ServiceCheck;
use datadog_api_client::datadogV1::model::ServiceCheckStatus;

#[tokio::main]
async fn main() {
    let body = vec![ServiceCheck::new(
        "app.ok".to_string(),
        "host".to_string(),
        ServiceCheckStatus::OK,
        vec!["test:ExampleServiceCheck".to_string()],
    )];
    let configuration = datadog::Configuration::new();
    let api = ServiceChecksAPI::with_config(configuration);
    let resp = api.submit_service_check(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" cargo run

PREVIEWING: ashley.yip/dynamic-cost-allocation-docs