This page covers how to install and configure integrations for your Docker infrastructure by using a Datadog feature known as Autodiscovery. Autodiscovery enables you to use variables like %%host%% to dynamically populate your configuration settings.
The following Datadog integrations don't work with Autodiscovery because they require either process tree data or filesystem access: Ceph, Varnish, Postfix, Cassandra Nodetool, and Gunicorn.
To monitor integrations that are not compatible with Autodiscovery, you can use a Prometheus exporter in the pod to expose an HTTP endpoint, and then use the OpenMetrics integration (which supports Autodiscovery) to find the pod and query the endpoint.
Some integrations require setup steps, such as creating an access token or granting read permission to the Datadog Agent. Follow the instructions in the Setup section of your integration’s documentation.
To use an integration that is not packaged with the Datadog Agent, you must build a custom image that contains your desired integration. See Use Community Integrations for instructions.
Some commonly-used integrations come with default configuration for Autodiscovery. See Autodiscovery auto-configuration for details, including a list of auto-configured integrations and their corresponding default configuration files. If your integration is in this list, and the default configuration is sufficient for your use case, no further action is required.
Otherwise:
Choose a configuration method (Docker labels, a local file, or a key-value store) that suits your use case.
Reference the template format for your chosen method. Each format contains placeholders, such as <CONTAINER_IMAGE>.
You can store Autodiscovery templates as local files inside the mounted /conf.d directory. You must restart your Agent containers each time you change, add, or remove templates.
Create a conf.d/<INTEGRATION_NAME>.d/conf.yaml file on your host:
Mount your host conf.d/ folder to the containerized Agent’s conf.d folder.
You can source Autodiscovery templates from Consul, etcd, or ZooKeeper. You can configure your key-value store in the datadog.yaml configuration file (and subsequently mount this file inside the Agent container), or as environment variables in the Agent container.
Configure in datadog.yaml:
In datadog.yaml, set the <KEY_VALUE_STORE_IP> address and <KEY_VALUE_STORE_PORT> of your key-value store:
With the key-value store enabled as a template source, the Agent looks for templates under the key /datadog/check_configs. Autodiscovery expects a key-value hierarchy like this:
The name of your Datadog integration, such as etcd or redisdb.
<CONTAINER_IMAGE>
An identifier to match against the container image.
For example: if you supply redis as a container identifier, your Autodiscovery template is applied to all containers with image names that match redis. If you have one container running foo/redis:latest and bar/redis:v2, your Autodiscovery template is applied to both containers.
The ad_identifiers parameter takes a list, so you can supply multiple container identifiers. You can also use custom identifiers. See Custom Autodiscovery Identifiers.
<INIT_CONFIG>
The configuration parameters listed under init_config in your integration’s <INTEGRATION_NAME>.d/conf.yaml.example file. The init_config section is usually empty.
<INSTANCES_CONFIG>
The configuration parameters listed under instances in your integration’s <INTEGRATION_NAME>.d/conf.yaml.example file.
<LOGS_CONFIG>
The configuration parameters listed under logs in your integration’s <INTEGRATION_NAME>.d/conf.yaml.example file.
Redis is one the technologies for which Autodiscovery auto-configuration is available. The following examples demonstrate overriding this basic configuration with a custom configuration that supplies a password parameter.
Store your password as an environment variable named REDIS_PASSWORD; then:
Mount your host conf.d/ folder to the containerized Agent’s conf.d folder.
The following etcd commands create a Redis integration template with a custom password parameter:
etcdctl mkdir /datadog/check_configs/redis
etcdctl set /datadog/check_configs/redis/check_names '["redisdb"]'
etcdctl set /datadog/check_configs/redis/init_configs '[{}]'
etcdctl set /datadog/check_configs/redis/instances '[{"host": "%%host%%","port":"6379","password":"%%env_REDIS_PASSWORD%%"}]'
Notice that each of the three values is a list. Autodiscovery assembles list items into the integration configurations based on shared list indexes. In this case, it composes the first (and only) check configuration from check_names[0], init_configs[0] and instances[0].