The service check endpoint allows you to post check statuses for use with monitors. Service check messages are limited to 500 characters. If a check is posted with a message containing more than 500 characters, only the first 500 characters are displayed.
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
Submit a list of Service Checks.
Note: A valid API key is required.
Service Check request body.
{
"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="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.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="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
rb "example.rb"