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