# Collecting Elasticsearch monitoring data with Metricbeat in docker deployment

**URL:** <https://discuss.elastic.co/t/collecting-elasticsearch-monitoring-data-with-metricbeat-in-docker-deployment/293246>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-monitoring, docker\
**Created:** [December 31, 2021, 9:26am UTC](https://discuss.elastic.co/t/collecting-elasticsearch-monitoring-data-with-metricbeat-in-docker-deployment/293246 "2021-12-31T09:26:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Petr.Simik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/petr.simik/32/38082_2.png) [@Petr.Simik](https://discuss.elastic.co/u/Petr.Simik)\
**Post date:** [December 31, 2021, 9:26am UTC](https://discuss.elastic.co/t/collecting-elasticsearch-monitoring-data-with-metricbeat-in-docker-deployment/293246/1 "2021-12-31T09:26:43Z")

</div>

What is the best practice to switch from legacy to metricbeat monitoring for clusters deployed in docker.?  
How should I modify our docker compose file to incorporate metricbeat for internal Elasticsearch monitoring.  
Is there any guideline document which I can follow ?

My elastsicsearch setup looks like:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/6/260bf1c943c07b3546656f67f19ed82f1b4e257a.png)

should I put 1 or 3 metricbeat containers on each host to monitor particular elastic container?  
is this the way?

my docker compose is like:

```auto
version: "3.3"
services:
  es-elasticnode-11:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.13.3
    container_name: es-elasticnode-11
    restart: always
    environment:
      - node.name=es-elasticnode-11      
      - http.cors.enabled=true
      - http.cors.allow-origin=*      
      - "ES_JAVA_OPTS=-Xms15g -Xmx15g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - /mnt/ssd1/esdata1:/usr/share/elasticsearch/data
      - /data/elasticsearch_es-elasticnode-11.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      - /data/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12
    ports:
      - 9200:9200
      - 9300:9300
    deploy:
      resources:
        limits:
          cpus: "12"
    network_mode: host
  es-elasticnode-12:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.13.3
    container_name: es-elasticnode-12
    restart: always
    environment:
      - node.name=es-elasticnode-12      
      - http.cors.enabled=true
      - http.cors.allow-origin=*      
      - "ES_JAVA_OPTS=-Xms15g -Xmx15g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - /mnt/ssd2/esdata2:/usr/share/elasticsearch/data
      - /data/elasticsearch_es-elasticnode-12.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      - /data/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12
    ports:
      - 9201:9201
      - 9301:9301
    deploy:
      resources:
        limits:
          cpus: "12"
    network_mode: host
  es-elasticnode-13:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.13.3
    container_name: es-elasticnode-13
    restart: always
    environment:
      - node.name=es-elasticnode-13      
      - http.cors.enabled=true
      - http.cors.allow-origin=*      
      - "ES_JAVA_OPTS=-Xms15g -Xmx15g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - /mnt/ssd3/esdata3:/usr/share/elasticsearch/data
      - /data/elasticsearch_es-elasticnode-13.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      - /data/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12
    ports:
      - 9202:9202
      - 9302:9302
    deploy:
      resources:
        limits:
          cpus: "12"
    network_mode: host

```

thank you

> **[Install Elasticsearch with Docker | Elasticsearch Guide \[7.16\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html)**

> **[Collecting Elasticsearch monitoring data with Metricbeat | Elasticsearch...](https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-metricbeat.html)**

---

<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:** [January 28, 2022, 9:27am UTC](https://discuss.elastic.co/t/collecting-elasticsearch-monitoring-data-with-metricbeat-in-docker-deployment/293246/2 "2022-01-28T09:27:35Z")

</div>

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