サービスのチェック

サービスチェックエンドポイントを使用すると、モニターで使用するためにチェックステータスを投稿できます。 サービスチェックメッセージは 500 文字に制限されています。 500 文字を超えるメッセージでチェックが投稿された場合、最初の 500 文字のみが表示されます。 メッセージは、Critical または Warning のステータスのチェックに制限されます。

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

概要

サービスチェックのリストを提出します。

:

  • 有効な API キーが必要です。
  • サービスチェックは、過去 10 分まで送信可能です。

リクエスト

Body Data (required)

サービスチェックのリクエスト本文。

Expand All

フィールド

種類

説明

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"
    ]
  }
]

応答

Payload accepted

The payload accepted for intake.

Expand All

フィールド

種類

説明

status

string

The status of the intake payload.

{
  "status": "ok"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication Error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Request timeout

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Payload too large

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

/**
 * Submit a Service Check returns "Payload accepted" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.ServiceChecksApi(configuration);

const params: v1.ServiceChecksApiSubmitServiceCheckRequest = {
  body: [
    {
      check: "app.ok",
      hostName: "host",
      status: 0,
      tags: ["test:ExampleServiceCheck"],
    },
  ],
};

apiInstance
  .submitServiceCheck(params)
  .then((data: v1.IntakePayloadAccepted) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" tsc "example.ts"

PREVIEWING: daljeet/on-call-automations