The official Docker images for Beats
are available from the Elastic Docker registry. To retrieve the images, simply
docker pull command:
docker pull docker.elastic.co/beats/metricbeat:5.4.0.
The images are currently under development and should be considered alpha-quality. We strongly recommend that you do not run these images in a production environment.
When executing Metricbeat in a container, there are some important things to be aware of if you want to monitor the host machine or other containers. Let’s walk-through some examples using Docker as our container orchestration tool.
Monitoring the Host Machineedit
This example highlights the changes required to make the system module work properly inside of a container. This enables Metricbeat to monitor the host machine from within the container.
Metricbeat’s system module collects much of its data through the Linux proc
filesystem, which is normally located at
If cgroup reporting is enabled for the
system process metricset, then you need
to mount the host’s cgroup mountpoints within the container. They need to be
mounted inside the directory specified by the
If you want to be able to monitor filesystems from the host by using the system filesystem metricset, then those filesystems need to be mounted inside of the container. They can be mounted at any location.
The system network metricset uses data from
Monitoring a Service in Another Containeredit
Next let’s look at an example of monitoring a containerized service from a Metricbeat container.
Linking the containers enables Metricbeat access the exposed ports of the
mysql container, and it makes the hostname
If you do not want to hardcode certain values into your Metricbeat
configuration, then you can pass them into the container either as environment
variables or as command line flags to Metricbeat (see the
The mysql module configuration would look like this: