Skip to content

Commit 7c738eb

Browse files
author
charlyF
committed
add option to ignore docker cloud containers
1 parent 39028ad commit 7c738eb

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

docker_daemon/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG - docker_daemon
22

3+
1.9.0 / Unreleased
4+
==================
5+
### Changes
6+
7+
* [IMPROVEMENT] Add the `ignore_docker_cloud_containers` option to ignore Docker Cloud agent's containers.
8+
* [BUGFIX] Ignore the excluded containers in the containers.{running|stopped} metrics.
9+
310
1.8.0 / Unreleased
411
==================
512
### Changes

docker_daemon/conf.yaml.example

+4-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ instances:
149149
# To customize this default behavior, override exclude.
150150
# If you do so, default exclusion patterns won't apply anymore and will need to be added explicitly.
151151

152-
152+
# Use `ignore_docker_cloud_containers` if you are running the agent in Docker Cloud
153+
# and you want the Docker check to ignore the containers used for the Docker cloud agent.
154+
# The agent will ignore the docker images starting with `dockercloud/*` (i.e.: dockercloud/network-daemon).
155+
# ignore_docker_cloud_containers: true
153156

154157
## Tagging
155158
##

docker_daemon/datadog_checks/docker_daemon/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
DockerDaemon = docker_daemon.DockerDaemon
44

5-
__version__ = "1.8.0"
5+
__version__ = "1.9.0"
66

77
__all__ = ['docker_daemon']

docker_daemon/datadog_checks/docker_daemon/docker_daemon.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -394,17 +394,17 @@ def _get_and_count_containers(self, custom_cgroups=False, healthchecks=False):
394394
for container in containers:
395395
container_name = DockerUtil.container_name_extractor(container)[0]
396396

397+
# Check if the container is included/excluded via its tags
398+
if self._is_container_excluded(container):
399+
self.log.debug("Container {0} is excluded".format(container_name))
400+
continue
401+
397402
container_status_tags = self._get_tags(container, CONTAINER)
398403

399404
all_containers_count[tuple(sorted(container_status_tags))] += 1
400405
if self._is_container_running(container):
401406
running_containers_count[tuple(sorted(container_status_tags))] += 1
402407

403-
# Check if the container is included/excluded via its tags
404-
if self._is_container_excluded(container):
405-
self.log.debug("Container {0} is excluded".format(container_name))
406-
continue
407-
408408
containers_by_id[container['Id']] = container
409409

410410
# grab pid via API if custom cgroups - otherwise we won't find process when

docker_daemon/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"linux",
1212
"mac_os"
1313
],
14-
"version": "1.8.0",
14+
"version": "1.9.0",
1515
"public_title": "Datadog-Docker Integration",
1616
"categories":["containers"],
1717
"type":"check",

0 commit comments

Comments
 (0)