サービスチェックエンドポイントを使用すると、モニターで使用するためにチェックステータスを投稿できます。 サービスチェックメッセージは 500 文字に制限されています。500 文字を超えるメッセージでチェックが投稿された場合、最初の 500 文字のみが表示されます。
POST https://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_run
サービスチェックのリストを送信します。
注: 有効な API キーが必要です。
サービスチェックのリクエスト本文。
{
"check": "app.ok",
"host_name": "app.host1",
"message": "app is running",
"status": 0,
"tags": [
"environment:test"
],
"timestamp": "integer"
}
Payload accepted
The payload accepted for intake.
{
"status": "ok"
}
Bad Request
Error response object.
{
"errors": [
"Bad Request"
]
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
Request timeout
Error response object.
{
"errors": [
"Bad Request"
]
}
Payload too large
Error response object.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/check_run?api_key=${DD_CLIENT_API_KEY}" \
-H "Content-Type: application/json" \
-d @- << EOF
{
"check": "app.ok",
"host_name": "app.host1",
"status": 0,
"tags": [
"environment:test"
]
}
EOF
from datadog import initialize, api
from datadog.api.constants import CheckStatus
options = {'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'}
initialize(**options)
check = 'app.ok'
host = 'app1'
status = CheckStatus.OK # equals 0
tags = ['env:test']
api.ServiceCheck.check(check=check, host_name=host, status=status, message='Response: 200 OK', tags=tags)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
python "example.py"
require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
dog = Dogapi::Client.new(api_key, app_key)
# submitting a check doesn't require an app_key
dog = Dogapi::Client.new(api_key)
dog.service_check('app.is_ok', 'app1', 0, :message => 'Response: 200 OK', :tags => ['env:test'])
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
rb "example.rb"