Hello,
I try to use Metricbeat with the autodiscover feature for docker, with following config
Metricbeat.yml:
output.elasticsearch:
hosts: ["elasticsearch:9200"]
setup.template.name: "metricbeat"
setup.template.settings:
index.number_of_shards: 1
index.number_of_replicas: 0
metricbeat.modules:
- module: system
metricbeat.autodiscover:
providers:
- type: docker
hints.enabled: true
Metricbeat is not able to parse docker event. See below what happend when I restarted kibana on docker:
2019-01-14T10:35:24.441Z DEBUG [autodiscover] autodiscover/autodiscover.go:204 Got a stop event: map[stop:true host:172.20.0.3 port:5601 docker:{"container":{"id":"003a4b7b7f24a0633a486785c79aa3d1f7e2627f4f55b3694b5bc3d534fa2a89","image":"docker.elastic.co/kibana/kibana:6.5.4","labels":{"co":{"elastic":{"logs/module":"kibana","metrics/module":"kibana"}},"license":"Elastic License","org":{"label-schema":{"build-date":"20181205","license":"GPLv2","name":"kibana","schema-version":"1.0","url":"https://www.elastic.co/products/kibana","vcs-url":"https://github.com/elastic/kibana-docker","vendor":"Elastic","version":"6.5.4"}}},"name":"kibana"}} meta:{"docker":{"container":{"id":"003a4b7b7f24a0633a486785c79aa3d1f7e2627f4f55b3694b5bc3d534fa2a89","image":"docker.elastic.co/kibana/kibana:6.5.4","labels":{"co":{"elastic":{"logs/module":"kibana","metrics/module":"kibana"}},"license":"Elastic License","org":{"label-schema":{"build-date":"20181205","license":"GPLv2","name":"kibana","schema-version":"1.0","url":"https://www.elastic.co/products/kibana","vcs-url":"https://github.com/elastic/kibana-docker","vendor":"Elastic","version":"6.5.4"}}},"name":"kibana"}}} config:[0xc420bcbc80]], generated configs: [0xc420bcbc80]
2019-01-14T10:35:24.441Z DEBUG [autodiscover] autodiscover/autodiscover.go:214 Config &{{<nil> } <nil> 0xc4205bf120} is not running
2019-01-14T10:35:24.971Z DEBUG [autodiscover] autodiscover/autodiscover.go:162 Got a start event: map[start:true host:172.20.0.3 port:5601 docker:{"container":{"id":"003a4b7b7f24a0633a486785c79aa3d1f7e2627f4f55b3694b5bc3d534fa2a89","image":"docker.elastic.co/kibana/kibana:6.5.4","labels":{"co":{"elastic":{"logs/module":"kibana","metrics/module":"kibana"}},"license":"Elastic License","org":{"label-schema":{"build-date":"20181205","license":"GPLv2","name":"kibana","schema-version":"1.0","url":"https://www.elastic.co/products/kibana","vcs-url":"https://github.com/elastic/kibana-docker","vendor":"Elastic","version":"6.5.4"}}},"name":"kibana"}} meta:{"docker":{"container":{"id":"003a4b7b7f24a0633a486785c79aa3d1f7e2627f4f55b3694b5bc3d534fa2a89","image":"docker.elastic.co/kibana/kibana:6.5.4","labels":{"co":{"elastic":{"logs/module":"kibana","metrics/module":"kibana"}},"license":"Elastic License","org":{"label-schema":{"build-date":"20181205","license":"GPLv2","name":"kibana","schema-version":"1.0","url":"https://www.elastic.co/products/kibana","vcs-url":"https://github.com/elastic/kibana-docker","vendor":"Elastic","version":"6.5.4"}}},"name":"kibana"}}} config:[0xc420b2a750]], generated configs: [0xc420b2a750]
2019-01-14T10:35:24.971Z DEBUG [autodiscover] autodiscover/autodiscover.go:235 Got a meta field in the event
2019-01-14T10:35:24.971Z DEBUG [autodiscover] autodiscover/autodiscover.go:174 Check failed for config &{{<nil> } <nil> 0xc4205d2ba0}: 1 error: host parsing failed for kibana-status: error parsing URL: empty host, won't start runner
Metricbeat is not able to parse the host, however, the host field is there in the start event.
Metricbeat itself is runnnig on docker as well, with this command:
docker run --name metricbeat \
-d --rm \
--network=myBridgeNetwork \
--mount type=bind,source=/proc,target=/hostfs/proc,readonly \
--mount type=bind,source=/sys/fs/cgroup,target=/hostfs/sys/fs/cgroup,readonly \
--mount type=bind,source=/,target=/hostfs,readonly \
--mount type=bind,source=/var/lib/docker/containers,target=/var/lib/docker/containers,readonly \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,readonly \
--mount type=bind,source=/root/metricbeat/metricbeat.yml,target=/usr/share/metricbeat/metricbeat.yml,readonly \
--user=root \
docker.elastic.co/beats/metricbeat:6.5.4 -e -d "autodiscover" -system.hostfs=/hostfs
Am I missing something ?