我已经配置了docker-daemon,并且还添加了修改后的auto_conf。我应该如何传递%% host %%变量?
sudo docker run -d --name dd-agent \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /proc/:/host/proc/:ro \
-v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
-e API_KEY=XXXXXXXXXXXXXXX \
-e SD_BACKEND=docker \
-e SD_CONFIG_BACKEND=etcd \
-e SD_BACKEND_HOST=XX.XXX.XX.XX \
-e SD_BACKEND_PORT=XXXX \
datadog/docker-dd-agent:latest
更改了etcd.yaml
docker_images:
- image1
init_config:
instances:
- url: "http://XX.XXX.XX.XX:XXXX"
但是当我尝试做的时候
sudo docker exec -it dd-agent /etc/init.d/datadog-agent configcheck
2017-08-07 19:18:37,637 | WARNING | dd.collector | utils.service_discovery.abstract_sd_backend(abstract_sd_backend.py:66) | Failed to interpolate variable %%host%% for the url parameter. Dropping this configuration.
收集器日志显示
NotFound: 404 Client Error: Not Found ("No such image: sha256:6d13e6f1665c7abcd9edeba651a1f883ab68dbb73153d6cc55145add585373fc")
2017-08-08 17:16:11 UTC | ERROR | dd.collector | utils.dockerutil(dockerutil.py:548) | Exception getting docker image name
Traceback (most recent call last):
File "/opt/datadog-agent/agent/utils/dockerutil.py", line 533, in image_name_extractor
image_spec = self.client.inspect_image(image)
File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/docker/utils/decorators.py", line 21, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/docker/api/image.py", line 136, in inspect_image
self._get(self._url("/images/{0}/json", image)), True
File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/docker/client.py", line 178, in _result
self._raise_for_status(response)
File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/docker/client.py", line 173, in _raise_for_status
raise errors.NotFound(e, response, explanation=explanation)
答案 0 :(得分:1)
%%host%%
模板变量?
如果这是您感兴趣的内容,我认为您希望将其添加到etcd.yaml
行url
上,如{{1}所示3}}像这样:
docker_images:
- etcd
init_config:
instances:
- url: "http://%%host%%:%%port_0%%"