Autodiscovery Container Identifiers

Autodiscovery container identifiers, or ad_identifiers, allow you to apply an Autodiscovery configuration file template to a given container, either by using the container short image or with a custom Autodiscovery container identifier.

Note: For other configuration types—key-value stores, Docker labels, or Kubernetes pod annotations—the matching between an integration configuration template and the corresponding container is based on the <CONTAINER_IDENTIFIER> included in the key-value stores, labels, or annotations configuration.

Short image container identifiers

To apply the following Autodiscovery configuration template to a given container, use the container short image name as the <INTEGRATION_AUTODISCOVERY_IDENTIFIER>:

ad_identifiers:
  <INTEGRATION_AUTODISCOVERY_IDENTIFIER>

init_config:
  <INIT_CONFIG>

instances:
  <INSTANCES_CONFIG>

For example, the following Apache Autodiscovery configuration template can be used by the Agent:

ad_identifiers:
  - httpd
init_config:
instances:
  - apache_status_url: http://%%host%%/server-status?auto
logs:
  source: apache
  service: webapp

This matches ANY httpd container image on your host. Suppose you have one container running library/httpd:latest and another running <WHATEVER>/httpd:v2. The Agent applies the above template to both containers since you have to provide short names for container images, for example: httpd, NOT library/httpd:latest.

When using short image names as Autodiscovery container identifiers, the Agent cannot distinguish between identically named images from different sources or with different tags.

Adding tags from standard labels

Even if Autodiscovery configuration is defined within a custom configuration file, the standard labels for tagging env, service, and version can be used in conjunction.

See Unified Service Tagging for more information on how to configure these labels on your containers.

Multiple identifiers

Specify multiple image names by adding to the ad_identifiers list, for example:

ad_identifiers:
  - httpd
  - my-custom-httpd-image

Custom Autodiscovery container identifiers

To apply different Autodiscovery configuration templates to containers running the same image, use a custom value <INTEGRATION_AUTODISCOVERY_IDENTIFIER> and apply it with the com.datadoghq.ad.check.id label to identify your container. Using the following configuration file:

ad_identifiers:
  <INTEGRATION_AUTODISCOVERY_IDENTIFIER>

init_config:
  <INIT_CONFIG>

instances:
  <INSTANCES_CONFIG>

To enable it for a container:

Add the following label to apply this Autodiscovery configuration template to a specific container for docker.

com.datadoghq.ad.check.id: <INTEGRATION_AUTODISCOVERY_IDENTIFIER>

Note: The com.datadoghq.ad.check.id label takes precedence over the image/name.

Add the following annotation in Kubernetes to apply this Autodiscovery configuration where <CONTAINER_IDENTIFIER> is the container name within the pod.

ad.datadoghq.com/<CONTAINER_IDENTIFIER>.check.id: <INTEGRATION_AUTODISCOVERY_IDENTIFIER>

Note: This annotations is only application from version 6.25.0 and 7.25.0 onwards. The ad.datadoghq.com/<CONTAINER_IDENTIFIER>.check.id label takes precedence over the image/name.

Further Reading