Metricbeat System Module shows docker container metrics instead of host

I run Metricbeat in container and it seems Metricbeat collects system metrics from its container and not the host machine. On imported Kibana system dashboards there is only one host with the name equal to the container id and only one process that is metricbeat itself.
Here is my docker compose file for metricbeat:

        metricbeat:
          image: docker.elastic.co/beats/metricbeat:6.6.0
          user: root
          volumes:
            - "${MB_CONF_PATH}/metricbeat.docker.yml:/usr/share/metricbeat/metricbeat.yml:ro"
            - "/var/run/docker.sock:/var/run/docker.sock:ro"
            - "/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro"
            - "/proc:/hostfs/proc:ro"
            - "/:/hostfs:ro"  

And system module config:

   metricsets:
     - cpu          
     - load
     - memory    
     - process    
     - process_summary 
     - uptime 
  enabled: true
  period: 10s
  processes: ['.*']

  cpu.metrics:  ["percentages"]

  process.include_top_n:
    enabled: true
    by_cpu: 10
    by_memory: 10

It seems that only uptime metric is obtained from the host. So, what can be the case?

I assume you copied most of the config from here? https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html

It definitively sound strange that only the uptime should come from the host. Could you try to run just a docker container without compose with the flags described in the blog post and see what is happening?

Can you share 1-2 of the events?

The flag -system.hostfs=/hostfs solved the problem. Thanks

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