# Metricbeat shows containers as host in APM UI

**URL:** <https://discuss.elastic.co/t/metricbeat-shows-containers-as-host-in-apm-ui/328154>\
**Category:** APM\
**Tags:** docker, java\
**Created:** [March 21, 2023, 10:01am UTC](https://discuss.elastic.co/t/metricbeat-shows-containers-as-host-in-apm-ui/328154 "2023-03-21T10:01:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![irivas95](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@irivas95](https://discuss.elastic.co/u/irivas95)\
**Post date:** [March 21, 2023, 10:01am UTC](https://discuss.elastic.co/t/metricbeat-shows-containers-as-host-in-apm-ui/328154/1 "2023-03-21T10:01:06Z")

</div>

hi,  
I am trying to monitor a microservices application deployed in docker with APM on elastic cloud.

When I start metricbeat with the system and docker modules enabled, it shows me the containers as if they were hosts.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/0/60a1de218ae7df07c63713a52343c6f8d38e428e.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/4/1432dff76ac5c7e61ae25ab57c3b1951be59d36a.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/c/dc25a48bff2fe841dbf7050c862f36daa646993d.png)

My metricbeat configurations are as follows:

metricbeat.yml

```auto
# =========================== Modules configuration ============================

metricbeat.config.modules:
  # Glob pattern for configuration loading
  path: ${path.config}/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: false

# ======================= Elasticsearch template setting =======================

setup.template.settings:
  index.number_of_shards: 1
  index.codec: best_compression
  #_source.enabled: false

# ================================= elastic cloud =================================

# You can find the `cloud.id` in the Elastic Cloud web UI.
cloud.id: "deploy_name:cloud_id"

# The cloud.auth setting overwrites the `output.elasticsearch.username` and
# `output.elasticsearch.password` settings. The format is `<user>:<pass>`.
cloud.auth: "user:password"

# ================================= Processors =================================

# Configure processors to enhance or manipulate events generated by the beat.

processors:
  - add_host_metadata: ~
  - add_cloud_metadata: ~
  - add_docker_metadata: ~
  - add_kubernetes_metadata: ~
  - add_fields:
      fields:
        application: sockshop

```

modules.d/docker.yml

```auto
- module: docker
  metricsets:
    - container
    - cpu
    - diskio
    - event
    - healthcheck
    - info
    - memory
    - network
    - network_summary
  period: 10s
  hosts: ["unix:///var/run/docker.sock"]

```

I would like them to appear as containers, so that when I click on investigate within a transaction it will take me to the metrics page of the container. does anyone know what I am doing wrong?

thanks in advance.

---

<div class="post-metadata">

**Author:** ![Jonas\_Kunz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonas_kunz/32/110740_2.png) [@Jonas\_Kunz](https://discuss.elastic.co/u/Jonas_Kunz)\
**Post date:** [March 21, 2023, 10:50am UTC](https://discuss.elastic.co/t/metricbeat-shows-containers-as-host-in-apm-ui/328154/2 "2023-03-21T10:50:04Z")

</div>

Hi @irivas95 ,

I'm suspecting that you are running into a current limitation of the APM Java agent where it is unable to discover that it is running inside a container. The agent cannot handle cgroupsv2 properly at the moment ([GH issue](https://github.com/elastic/apm-agent-java/issues/3035)).

Could you tell us what operating system and version you are using? It would be great if you could verify whether your system uses cgroupsV2, for example using the approach [explained here](https://unix.stackexchange.com/a/508826).

---

<div class="post-metadata">

**Author:** ![irivas95](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@irivas95](https://discuss.elastic.co/u/irivas95)\
**Post date:** [March 21, 2023, 10:59am UTC](https://discuss.elastic.co/t/metricbeat-shows-containers-as-host-in-apm-ui/328154/3 "2023-03-21T10:59:47Z")

</div>

thanks Jonas,

the operating system of the machine on which I have the containers deployed is **Debian 11 bullseye**.

if I launch the command:

```auto
grep cgroup /proc/filesystems

```

I see the following:

```auto
nodev cgroup
nodev cgroup2

```

so I understand that if you are using the cgroups that you mention.

---

<div class="post-metadata">

**Author:** ![Jonas\_Kunz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonas_kunz/32/110740_2.png) [@Jonas\_Kunz](https://discuss.elastic.co/u/Jonas_Kunz)\
**Post date:** [March 21, 2023, 11:13am UTC](https://discuss.elastic.co/t/metricbeat-shows-containers-as-host-in-apm-ui/328154/4 "2023-03-21T11:13:08Z")

</div>

I also checked the documentation of Debian 11, indeed the defaults where changed from cgroupsv1 to cgroupsv2.

So unfortunately I think there is not much we can do here except waiting until we add the cgroupsv2 support to the agent. You can follow the issue from my previous response to track our progress.

---

<div class="post-metadata">

**Author:** ![irivas95](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@irivas95](https://discuss.elastic.co/u/irivas95)\
**Post date:** [March 21, 2023, 11:19am UTC](https://discuss.elastic.co/t/metricbeat-shows-containers-as-host-in-apm-ui/328154/5 "2023-03-21T11:19:01Z")

</div>

Thanks for your help jonas,  
I will keep an eye on the progress with the issue.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 11, 2023, 7:19am UTC](https://discuss.elastic.co/t/metricbeat-shows-containers-as-host-in-apm-ui/328154/6 "2023-04-11T07:19:26Z")

</div>

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