Running metricbeat in docker and monitoring the host system does not work with command from documentation

I wanted to start a metricbeat container with a custom metricbeat.yml to monitor the host it runs on.

I used this command from the documentation (https://www.elastic.co/guide/en/beats/metricbeat/6.1/running-on-docker.html#monitoring-host):

docker run \
--volume=/proc:/hostfs/proc:ro \
--volume=/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro \
--volume=/:/hostfs:ro \
--volume=/home/user/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml \
--net=host
docker.elastic.co/beats/metricbeat:6.1.3 -system.hostfs=/hostfs

There are multiple problems with this:

a) The container starts but there is no output on stdout or in docker logs.
Doing a docker top on that container shows that there is a metricbeat process

When I specify the option -e at the command, it works:

docker run \
--volume=/proc:/hostfs/proc:ro \
--volume=/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro \
--volume=/:/hostfs:ro \
--volume=/home/user/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml \
--net=host \
docker.elastic.co/beats/metricbeat:6.1.3 -e -system.hostfs=/hostfs

Is the -e missing in the documentation?

b) The command in the documentation has spaces at the end of some lines so copy-pasting the command runs single lines as commands which leads to errors. This should be changed

Yes, sounds like a doc bug. I was thinking that maybe the ENTRYPOINT script automatically added -e if it wasn't present, but it doesn't. Can you please open an issue or a PR for this is the elastic/beats repo.

That must be caused by the Asciidoc callouts. Mention this in the Github issue and I'll point the documentation experts to the issue.

Ok, I will open a PR.

This topic was automatically closed after 21 days. New replies are no longer allowed.