All examples make use of Datadog’s Autodiscovery feature, which allows you to define configuration templates for Agent Checks on designated sets of containers. For more information about Autodiscovery, see Getting Started with Containers: Autodiscovery.
Redis integration for all Redis containers
In this example scenario, you have a containerized environment in which you want to set up and configure the Datadog-Redis integration for all containers that match the name redis. You have one container named redis and another named my-custom-redis, and you want to configure the Redis integration for both containers.
The Redis integration comes with default auto-configuration, but you want to additionally specify a password parameter and configure log collection.
Hypothetically, if you were to configure this integration on a host, you could reference redisdb.d/conf.yaml.example for parameters and create a conf.yaml file that contains the following:
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].
As a result, the Agent contains a redisdb.yaml file with the above configuration in the conf.d directory.
Note: The Redis integration comes with default auto-configuration, which takes precedence over configuration set in the Datadog Operator manifest. Because of this, the provided example manifest uses the DD_IGNORE_AUTOCONF variable to disable auto-configuration.
As a result, the Agent contains a redisdb.yaml file with the above configuration in the conf.d directory.
Note: The Redis integration comes with default auto-configuration, which takes precedence over configuration set in Helm values. Because of this, the provided example uses datadog.ignoreAutoConfig to disable auto-configuration.
%%host%% is dynamically populated with the container’s IP.
%%env_REDIS_PASSWORD%% references an environment variable named REDIS_PASSWORD as seen by the Agent process.
Apache integration and HTTP Check on Apache containers
In this example scenario, you have a containerized environment in which you want to set up and configure the Datadog-Apache integration for all containers that match the name apache. You also want to set up an HTTP Check for testing two endpoints, /website_1 and /website_2
etcdctl set /datadog/check_configs/apache/check_names '["apache", "http_check"]'
etcdctl set /datadog/check_configs/apache/init_configs '[{}, {}]'
etcdctl set /datadog/check_configs/apache/instances '[[{"apache_status_url": "http://%%host%%/server-status?auto", "min_collection_interval": 30}],[{"name": "<WEBSITE_1>", "url": "http://%%host%%/website_1", timeout: 1},{"name": "<WEBSITE_2>", "url": "http://%%host%%/website_2", timeout: 1}]]'
Note: The order of each list matters. The Agent can only generate the HTTP check configuration correctly if all parts of its configuration have the same index across the three lists.
Note: The Apache integration comes with default auto-configuration, which takes precedence over configuration set in the Datadog Operator manifest. Because of this, the provided example manifest uses the DD_IGNORE_AUTOCONF variable to disable auto-configuration.
Note: The Apache integration comes with default auto-configuration, which takes precedence over configuration set in Helm values. Because of this, the provided example uses datadog.ignoreAutoConfig to disable auto-configuration.