Skip to content

Commit 8eb8e1e

Browse files
committed
[docker_daemon] adding whitelist for docker health service checks.
1 parent 99bedbe commit 8eb8e1e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

checks.d/docker_daemon.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ def check(self, instance):
274274

275275
# Report docker healthcheck SC's where available
276276
if health_service_checks:
277-
self._send_container_healthcheck_sc(containers_by_id)
277+
health_scs_containers = instance.get('health_service_check_whitelist', [])
278+
self._send_container_healthcheck_sc(containers_by_id, health_scs_containers)
278279

279280
def _count_and_weigh_images(self):
280281
try:
@@ -521,8 +522,13 @@ def _report_container_size(self, containers_by_id):
521522
self, 'docker.container.size_rootfs', container['SizeRootFs'],
522523
tags=tags)
523524

524-
def _send_container_healthcheck_sc(self, containers_by_id):
525+
def _send_container_healthcheck_sc(self, containers_by_id, whitelist):
525526
for container in containers_by_id.itervalues():
527+
# O(n) nasty :( (pass dict or set?)
528+
# TODO: address tagging.
529+
if container.get('Image') not in whitelist:
530+
continue
531+
526532
health = container.get('health', {})
527533
tags = self._get_tags(container, CONTAINER)
528534
status = AgentCheck.UNKNOWN

0 commit comments

Comments
 (0)