Service Checks
New announcements from Dash: Incident Management, Continuous Profiler, and more! New announcements from Dash!

Service Checks

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.

Submit a Service Check

POST https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/check_run

Overview

Submit a list of Service Checks.

Note: A valid API key is required.

Request

Body Data (required)

Service Check request body.

Expand All

Field

Type

Description

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. Allowed enum values: 0,1,2,3

tags

[string]

Tags related to a check.

timestamp

int64

Time of check.

{
  "check": "app.ok",
  "host_name": "app.host1",
  "message": "app is running",
  "status": 0,
  "tags": [
    "environment:test"
  ],
  "timestamp": "integer"
}

Response

Payload accepted

The payload accepted for intake.

Expand All

Field

Type

Description

status

string

The status of the intake payload.

{
  "status": "ok"
}

Bad Request

Error response object.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Authentication Error

Error response object.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Request timeout

Error response object.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Payload too large

Error response object.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Code Example


                                        # Curl command
curl -X POST "https://api.datadoghq.com"https://api.datadoghq.eu/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)
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'])