# Elasticsearch doesn't create Metricbeat index

**URL:** <https://discuss.elastic.co/t/elasticsearch-doesnt-create-metricbeat-index/200444>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [September 20, 2019, 2:29pm UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-create-metricbeat-index/200444 "2019-09-20T14:29:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndg](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@ndg](https://discuss.elastic.co/u/ndg)\
**Post date:** [September 20, 2019, 2:29pm UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-create-metricbeat-index/200444/1 "2019-09-20T14:29:16Z")

</div>

So, i am making a POC Swarm with 1 manager and 2 workers and both workers are in Drain state so i am only deploying services in the manager. I am trying to build a ELK stack from the ground up fully with docker containers so i can understand how every service works and interacts with each other. I managed to create the elasticsearch service and connect it to the Kibana service and bring some basic data (apparently Kibana creates data to monitor itself because some Kibana indexes were created), but i am having issues with Metricbeat because even when is up and getting metrics from the server (i am collecting metrics from the server and not the container) it doesn't create any index. Here are my service creation:

Elasticsearch

> docker service create   
> --name es-master   
> -p 9200:9200   
> --network elk\_stack   
> --env cluster.name=elk\_cluster\_dev   
> --env node.name=es01   
> --env discovery.type=single-node   
> --replicas 1   
> [docker.elastic.co/elasticsearch/elasticsearch:7.3.2](http://docker.elastic.co/elasticsearch/elasticsearch:7.3.2)

Kibana

> docker service create   
> --name kibana   
> -p 5601:5601   
> --mount type=bind,src=/home/repositories/ELK/kibana.yml,dst="${KIBANA\_HOME}"/config/kibana.yml   
> --network elk\_stack   
> --env elasticsearch.hosts=[http://es-master:9200](http://es-master:9200)   
> --replicas 1   
> [docker.elastic.co/kibana/kibana:7.3.2](http://docker.elastic.co/kibana/kibana:7.3.2)

Metricbeat

> docker service create   
> --name metricbeat   
> --mount type=bind,src=/home/repositories/ELK/metricbeat.yml,dst=/usr/share/metricbeat/metricbeat.yml   
> --mount type=bind,src=/home/repositories/ELK/modules.d/,dst=/usr/share/metricbeat/modules.d/   
> --mount type=bind,src=/proc,dst=/hostfs/proc,readonly   
> --mount type=bind,src=/sys/fs/cgroup,dst=/hostfs/sys/fs/cgroup,readonly   
> --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock   
> --mount type=bind,src=/,dst=/hostfs,readonly   
> --network elk\_stack   
> --mode global   
> [docker.elastic.co/beats/metricbeat:7.3.2](http://docker.elastic.co/beats/metricbeat:7.3.2)

Configuration files

Kibana.yml

> server.name: kibana  
> server.host: "0"  
> elasticsearch.hosts: ["[http://es-master:9200](http://es-master:9200)" ]  
> xpack.monitoring.ui.container.elasticsearch.enabled: true

metricbeat.yml

> metricbeat.config.modules:  
> path: ${path.config}/modules.d/\*.yml  
> reload.period: 10s  
> reload.enabled: false
> 
> setup.dashboards.enabled: true
> 
> output.elasticsearch:  
> hosts: ["es-master:9200"]
> 
> setup.kibana:  
> host: "[http://kibana:5601](http://kibana:5601)"

modules.d/docker.yml

> metricbeat.modules:
> 
> - module: docker  
> metricsets:
> - "container"
> - "cpu"
> - "diskio"
> - "event"
> - "healthcheck"
> - "info"  
> #- "image"
> - "memory"
> - "network"  
> hosts: ["unix:///var/run/docker.sock"]  
> period: 10s  
> enabled: true

Elasticsearch Index list (executed inside the metricbeat container)

> docker exec -it e8071e22983c bash  
> bash-4.2$ curl -XGET 'es-master:9200/\_cat/indices?v&pretty'  
> health status index uuid pri rep docs.count docs.deleted store.size pri.store.size  
> yellow open .kibana Ot8A4987QaizJz\_dZNdpIw 1 1 1 0 6.7kb 6.7kb

Do you what can be happening? I wil read some ELK stacks that are lying around in github uploaded by other admin, but i will appreciate any help that you can give me.

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [September 24, 2019, 9:56pm UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-create-metricbeat-index/200444/2 "2019-09-24T21:56:36Z")

</div>

hmm do you see any error in metricbeat log?  
Have you tried to run the setup command for Metricbeat? [https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html](https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html)

```auto
docker.elastic.co/beats/metricbeat:7.3.2 \
setup -E setup.kibana.host=kibana:5601 \
-E output.elasticsearch.hosts=["elasticsearch:9200"]

```

If metricbeat is running and sending metrics to ES, kibana should have an index for it.

---

<div class="post-metadata">

**Author:** ![ndg](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@ndg](https://discuss.elastic.co/u/ndg)\
**Post date:** [September 25, 2019, 12:49pm UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-create-metricbeat-index/200444/3 "2019-09-25T12:49:57Z")

</div>

I actually made 2 additions to the service creation and it worked  
Basically i added the --user=root and the -E output.elasticsearch.hosts=["elasticsearch:9200"] and the end. I forgot to post it here for others to see

> docker service create   
> --name metricbeat   
> --user=root   
> --mount type=bind,src=/home/repositories/ELK/metricbeat/metricbeat.docker.yml,dst=/usr/share/metricbeat/metricbeat.yml   
> --mount type=bind,src=/home/repositories/ELK/modules.d/,dst=/usr/share/metricbeat/modules.d/   
> --mount type=bind,src=/proc,dst=/hostfs/proc,readonly   
> --mount type=bind,src=/sys/fs/cgroup,dst=/hostfs/sys/fs/cgroup,readonly   
> --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock   
> --mount type=bind,src=/,dst=/hostfs,readonly   
> --network elk\_stack   
> --mode global   
> [docker.elastic.co/beats/metricbeat:7.3.2](http://docker.elastic.co/beats/metricbeat:7.3.2) -e   
> -E output.elasticsearch.hosts=["es-master:9200"]

Also, my new config file is like this

> metricbeat.config:  
> modules:  
> path: ${path.config}/modules.d/\*.yml  
> # Reload module configs as they change:  
> reload.enabled: false
> 
> metricbeat.autodiscover:  
> providers:  
> - type: docker  
> hints.enabled: true
> 
> metricbeat.modules:
> 
> - module: docker  
> metricsets:
> - "container"
> - "cpu"
> - "diskio"
> - "healthcheck"
> - "info"  
> #- "image"
> - "memory"
> - "network"  
> hosts: ["unix:///var/run/docker.sock"]  
> period: 10s  
> enabled: true
> 
> processors:
> 
> - add\_cloud\_metadata: ~
> 
> setup.dashboards.enabled: true
> 
> output.elasticsearch:  
> hosts: ["es-master:9200"]
> 
> setup.kibana:  
> host: "[http://kibana:5601](http://kibana:5601)"  
> I think that the autodiscover also did the trick

---

<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:** [October 23, 2019, 12:50pm UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-create-metricbeat-index/200444/4 "2019-10-23T12:50:05Z")

</div>

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