I only see metricbeat container as host


I am using metricbeat inside a container and want this beat to monitor the host and all other neighboring containers.
Unfortunately I can only see my metricbeat docker as host in most of the dashboards views.

But when looking at the views showing cpu and memrory consumption per process I can see processes from other docker containers.

Looking at the discover view I see data from all my containers.

My metricbeat configuration looks like this.
#------------------------------- System Module -------------------------------

  • module: system
    metricsets: ["load","core","diskio","filesystem","memory","network","process","socket"]
    enabled: true
    period: 10s
    processes: ['.*']
    cgroups: true

    Enable collection of cgroup metrics from processes on Linux.

    process.cgroups.enabled: true

#------------------------------- Docker Module -------------------------------

  • module: docker
    metricsets: ["container", "cpu", "diskio", "info", "memory", "network"]
    hosts: ["unix:///var/run/docker.sock"]
    enabled: true
    period: 10s

I start my metricbeat container with the following command:
docker run -d --rm --volume=/proc:/hostfs/proc:ro --volume=/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro --volume=/:/hostfs:ro --volume=/var/run/docker.sock:/var/run/docker.sock:ro --net=host --hostname=metricbeat --name=metricbeat --dns= metricbeat

Is my configuration wrong or am I not supposed to be able to see more information about the containers with current dashboards?

Br Mathias

Hi @mathias, thank you for sharing your setup!

It's a common docker behavior to set the container name as hostname inside it, it's handy sometimes, but you can override that :slight_smile:

You can take benefit from environment var in beats conf file and do something like:

In metricbeat.yml:

name: ${NODE_NAME}

In your docker run command:

docker run -d ... -e "NODE_NAME=$(hostname)"  ... metricbeat

This way you have a common way to pass host's hostname to your beats! Let me know if it works for you and fits your needs

Best regards

Thanks for your response Carlos,

Unfortunately nothing changed.
I can only see the metricbeat as hostname for CPU load.

This is probably natural since I have this configuration:
metricsets: ["container", "cpu", "diskio", "info", "memory", "network"]

I do not include "load" since it is not supported.

Br Mathias

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.