# Metricbeat can't collect elasticsearch metrics

**URL:** <https://discuss.elastic.co/t/metricbeat-cant-collect-elasticsearch-metrics/281783>\
**Category:** Metrics\
**Tags:** elastic-stack-monitoring\
**Created:** [August 18, 2021, 7:59am UTC](https://discuss.elastic.co/t/metricbeat-cant-collect-elasticsearch-metrics/281783 "2021-08-18T07:59:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lisiyu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lisiyu/32/91545_2.png) [@lisiyu](https://discuss.elastic.co/u/lisiyu)\
**Post date:** [August 18, 2021, 7:59am UTC](https://discuss.elastic.co/t/metricbeat-cant-collect-elasticsearch-metrics/281783/1 "2021-08-18T07:59:00Z")

</div>

The elasticsearch module is enabled in metricbeat. But metricbeat index have no data for elastic metrics.

#### Version

- Metricbeat: 7.13.1
- Elasticsearch: 7.13.1
- Kibana: 7.13.1

#### Config

- Metricbeat:

```auto
......
    metricbeat.config.modules:
      # Mounted `metricbeat-daemonset-modules` configmap:
      path: /usr/share/metricbeat/modules.d/*.yml
      # Reload module configs as they change:
      reload.enabled: true
      setup.dashboards.enabled: true
      setup.kibana.host: "http://kibana-svc:80"
......
  elasticsearch.yml: |-
    - module: elasticsearch
      xpack.enabled: true
      period: 30s
      hosts: ["http://elastic-svc:9200"]
      metricsets:
        - node
        - node_stats
        - index
        - index_recovery
        - index_summary
        - shard

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/4/a4e874240a7b1fbe0ba1bb5fc667b2b5284c7c0c.png)

- Elasticsearch

```auto
bootstrap.memory_lock: true
node.name: ${HOSTNAME}

action.destructive_requires_name: true
indices.fielddata.cache.size: 1% # default is unbounded
cluster.name: es-cluster

# only data nodes should have ingest and http capabilities
node.master: false
node.data: false
node.ingest: false
xpack.security.enabled: false
xpack.monitoring.enabled: true
xpack.monitoring.collection.enabled: true
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/4/64329d4dfbcfde7edd8ff860d21c4c39465b7e1c.png)

- Kibana  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/9/e9cf2b3532c55adc697c0d72d87bcd58ddc142a7.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/5/f550e6c7ee1a3302e2a3cc0453c0d74efed36ef6.png)

---

<div class="post-metadata">

**Author:** ![afgomez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/afgomez/32/59274_2.png) [@afgomez](https://discuss.elastic.co/u/afgomez)\
**Post date:** [August 18, 2021, 9:00am UTC](https://discuss.elastic.co/t/metricbeat-cant-collect-elasticsearch-metrics/281783/2 "2021-08-18T09:00:50Z")

</div>

Hi @lisiyu,

Could you check if the `.monitoring-es*` indices exist and have data? In the the Kibana developer tools, run the following query.

```auto
GET /_cat/indices/.monitoring-es*?v

```

Secondly, in [the documentation](https://www.elastic.co/guide/en/beats/metricbeat/7.13/metricbeat-module-elasticsearch.html#_usage_for_elastic_stack_monitoring_2) mentions that the `elasticsearch` module should not have any `metricsets`. Can you try commenting that block in your `modules/elasticsearch.yml` file? Alternatively, try using the `elasticsearch-xpack` module instead of the `elasticsearch` module.

Let me know if any of this works.

---

<div class="post-metadata">

**Author:** ![lisiyu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lisiyu/32/91545_2.png) [@lisiyu](https://discuss.elastic.co/u/lisiyu)\
**Post date:** [August 18, 2021, 10:00am UTC](https://discuss.elastic.co/t/metricbeat-cant-collect-elasticsearch-metrics/281783/3 "2021-08-18T10:00:06Z")

</div>

hello @afgomez!  
I can see index of `.monitoring-es*`. But I can't discover it .

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

You mean like this?

```auto
  elasticsearch-xpack.yml: |-
    - module: elasticsearch-xpack
      xpack.enabled: true
      period: 30s
      hosts: ["http://elastic-svc:9200"]
      metricsets:
        - node
        - node_stats
        - index
        - index_recovery
        - index_summary
        - shard

```

---

<div class="post-metadata">

**Author:** ![afgomez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/afgomez/32/59274_2.png) [@afgomez](https://discuss.elastic.co/u/afgomez)\
**Post date:** [August 19, 2021, 10:55am UTC](https://discuss.elastic.co/t/metricbeat-cant-collect-elasticsearch-metrics/281783/4 "2021-08-19T10:55:24Z")

</div>

I'm sorry, I didn't understand correctly the first time what you wanted to achieve. The `elastic-stack-monitoring` tag threw me off track.

You want to get elasticsearch metrics inside the `metricbeat-*` indices, so you can see them in Discover, correct?

For that you need to remove the `x-pack.enabled: true` line from your `modules/elasticsearch.yml`.

What that setting does is tell Metricbeat to collect the data in `.monitoring-es*`. Those indices are used by the [Stack monitoring app](https://www.elastic.co/guide/en/kibana/current/xpack-monitoring.html) in kibana.

---

<div class="post-metadata">

**Author:** ![lisiyu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lisiyu/32/91545_2.png) [@lisiyu](https://discuss.elastic.co/u/lisiyu)\
**Post date:** [August 25, 2021, 6:36am UTC](https://discuss.elastic.co/t/metricbeat-cant-collect-elasticsearch-metrics/281783/5 "2021-08-25T06:36:08Z")

</div>

I removed `x-pack.enabled: true`. It working. Thank you .

---

<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:** [September 22, 2021, 6:36am UTC](https://discuss.elastic.co/t/metricbeat-cant-collect-elasticsearch-metrics/281783/6 "2021-09-22T06:36:57Z")

</div>

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