Custom Check

A custom check is a mechanism for adding your own collection logic to the Datadog Agent, defined as a pair of a Python file placed in checks.d and a YAML file with the same name in conf.d. Use it when you want to collect values that no off-the-shelf integration provides, on the Agent's cycle.

Overview

A custom check is your own collection logic, defined as a pair of a Python file placed in the Datadog Agent's checks.d directory and a YAML file with the same name placed in conf.d. In the check() of a class that inherits from AgentCheck, you write logic such as running a command, reading a file, or calling an internal tool's API, and send the values obtained as metrics or service checks. It is a concept you care about when you want to collect from a target that no off-the-shelf integration supports, on the same cycle as the Agent, and when you want to keep everything on the Agent side without putting code into the application.

Add work to the Agent with a pair of a Python file and a YAML file

A custom check is a mechanism for building your own collection logic into the Datadog Agent, and it consists of a pair of 2 files. A configuration YAML placed in the conf.d directory (with 2 sections, init_config and instances) and a Python file placed in the checks.d directory. The file names of the two must match, excluding the extension. The official recommendation is to give the name a custom_ prefix, to avoid colliding with an off-the-shelf integration of the same name. To run on newer versions of the Agent, it must be written to be Python 3 compatible (as of September 2026, Source: Writing a Custom Agent Check). Where conf.d lives on each OS is left to the datadog.yaml entry. Zero-length files are ignored (Source: Agent Configuration Files).

Inherit from AgentCheck and write it in check()

Define a single class that inherits from AgentCheck, write the logic in check(self, instance), and send values with methods such as self.gauge. On Agent 6.6.0 and later, the base class is imported from datadog_checks.base (as of September 2026, Source: Writing a Custom Agent Check). To send a status, you can emit a Service Check with self.service_check(name, status) (Source: Service Check Submission: Agent Check). The minimal form is as follows.

class HelloCheck(AgentCheck):
  def check(self, instance):
    self.gauge('hello.world', 1)

min_collection_interval is a lower bound, not a guarantee

The interval is set in the YAML. Writing min_collection_interval in seconds in each item under instances changes the collection interval. The default is 15 seconds, and the rule is to place it at the instance level (as of September 2026, Source: Writing a Custom Agent Check). As the name says, this is a minimum interval; writing 30 does not promise collection every 30 seconds. The Agent's collector attempts to run every 30 seconds, but it may queue behind other enabled integrations and checks, and can be delayed. Running heavy logic at a short interval delays the other checks too, so for checks that run external commands it is safer to take a longer interval, measure the execution time, and then tighten it. For running commands, the official documentation asks you to use get_subprocess_output(), which the Agent provides, rather than subprocess.

Confirm it works with datadog-agent check

Once the files are in place, before restarting the Agent, run sudo -u dd-agent -- datadog-agent check <CHECK_NAME>. Use this command to confirm the check runs, and once it passes, restart the Agent. If the example metric hello.world appears in the Metric Summary, it is on the periodic collection. When it does not work, the first thing to look at is file permissions. The check's files must be readable and executable by the user the Agent runs as (as of September 2026, Source: Writing a Custom Agent Check). The commands for installing and restarting the Agent are summarized in Installing the Agent on Linux. If you skip the check and just restart, a check that has stopped on an exception fails quietly without sending anything, and you end up guessing from the Datadog UI why no values are arriving.

The choice when it is neither an integration nor DogStatsD

A custom check sits close to a last resort. If an off-the-shelf Integration exists for the target, use that; if the value originates inside the application, use DogStatsD. Only values that cannot be obtained without the Agent going to fetch them periodically (external commands or files, an internal tool's API) become custom checks. For how the metrics you send are counted, see the Custom Metrics entry.

The 3 ways to have the Agent collect values
ApproachSuited situationWhere you write code
Off-the-shelf integrationMonitor supported middleware or services.None. Only the YAML in conf.d.
DogStatsD (sent from the app)Send values that originate inside the application's processing.The application's code.
Custom checkCollect values the Agent must go and fetch periodically.The Python in checks.d and the YAML in conf.d.
Source: the positioning in Writing a Custom Agent Check, organized alongside the 2 existing approaches (as of September 2026).
Share