Skip to content

Commit

Permalink
[docker] A few improvements as per PR review
Browse files Browse the repository at this point in the history
See comments on #1908
  • Loading branch information
Remi Hakim committed Sep 16, 2015
1 parent 3d91a0a commit 37d70df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion checks.d/docker_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def init(self):


# Other options
self.collect_image_stats = _is_affirmative(instance.get('collect_images_stats', True))
self.collect_image_stats = _is_affirmative(instance.get('collect_images_stats', False))
self.collect_container_size = _is_affirmative(instance.get('collect_container_size', False))
self.collect_events = _is_affirmative(instance.get('collect_events', True))
self.collect_image_size = _is_affirmative(instance.get('collect_image_size', False))
Expand Down Expand Up @@ -638,6 +638,7 @@ def _crawl_container_pids(self, container_dict):
self.warning("Unable to find any pid directory in {0}. "
"If you are running the agent in a container, make sure to "
'share the volume properly: "/proc:/host/proc:ro". '
"See https://github.com/DataDog/docker-dd-agent/blob/master/README.md for more information. "
"Network metrics will be missing".format(proc_path))
self._disable_net_metrics = True
return container_dict
Expand Down
2 changes: 1 addition & 1 deletion conf.d/docker.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ instances:
# collect_all_metrics: false

# Collect images stats
# Number of available active images and intermediate images as gauges. Default: false.
# Number of available active images and intermediate images as gauges. Default: true.
#
collect_images_stats: false
4 changes: 2 additions & 2 deletions conf.d/docker_daemon.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ instances:

# Collect images stats
# Number of available active images and intermediate images as gauges.
# Defaults to true.
# Defaults to false.
#
collect_images_stats: false
# collect_images_stats: false

# Collect disk usage per image with docker.image.size and docker.image.virtual_size metrics.
# The check gets this size with the `docker images` command.
Expand Down
8 changes: 8 additions & 0 deletions tests/checks/integration/test_docker_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def test_basic_config_single(self):
"instances": [{
"url": "unix://var/run/docker.sock",
"collect_image_size": True,
"collect_images_stats": True,
},
],
}
Expand Down Expand Up @@ -133,6 +134,7 @@ def test_basic_config_twice(self):
"instances": [{
"url": "unix://var/run/docker.sock",
"tags": custom_tags,
"collect_images_stats": True,
},
],
}
Expand Down Expand Up @@ -184,6 +186,7 @@ def test_exclude_filter(self):
"instances": [{
"url": "unix://var/run/docker.sock",
"exclude": ["docker_image:nginx"],
"collect_images_stats": True,
"collect_image_size": True,
},
],
Expand Down Expand Up @@ -250,6 +253,7 @@ def test_include_filter(self):
"url": "unix://var/run/docker.sock",
"include": ["image_name:redis"],
"exclude": [".*"],
"collect_images_stats": True,
"collect_image_size": True,
},
],
Expand Down Expand Up @@ -327,6 +331,7 @@ def test_tags_options(self):
"url": "unix://var/run/docker.sock",
"performance_tags": ["container_command"],
"container_tags": ["container_command"],
"collect_images_stats": True,
"collect_image_size": True,
},
],
Expand Down Expand Up @@ -397,6 +402,7 @@ def test_labels_collection(self):
"url": "unix://var/run/docker.sock",
"collect_labels_as_tags": ["label1"],
"collect_image_size": True,
"collect_images_stats": True,
},
],
}
Expand All @@ -410,6 +416,7 @@ def test_events(self):
"init_config": {},
"instances": [{
"url": "unix://var/run/docker.sock",
"collect_images_stats": True,
},
],
}
Expand Down Expand Up @@ -460,6 +467,7 @@ def test_container_size(self):
"url": "unix://var/run/docker.sock",
"collect_container_size": True,
"collect_image_size": True,
"collect_images_stats": True,
},
],
}
Expand Down

0 comments on commit 37d70df

Please sign in to comment.