# Metricbeat Elasticsearch Module not working

**URL:** https://discuss.elastic.co/t/metricbeat-elasticsearch-module-not-working/274020
**Category:** Elasticsearch
**Tags:** elastic-stack-monitoring
**Created:** [May 26, 2021, 7:26am UTC](https://discuss.elastic.co/t/metricbeat-elasticsearch-module-not-working/274020 "2021-05-26T07:26:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![anandd4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anandd4/32/50610_2.png) [@anandd4](https://discuss.elastic.co/u/anandd4)
#### Post date: [May 26, 2021, 7:26am UTC](https://discuss.elastic.co/t/metricbeat-elasticsearch-module-not-working/274020/1 "2021-05-26T07:26:57Z")

</div>

**Issue -**  
Trying to set up metricbeat to collect ES metric but upon testing the elasticsearch-xpack module, its not able to connect except for "node\_stats" metric and generating the error as shown below.

Can someone point in the right direction to help understand what might be causing this issue?

**Error -**

```auto
metricbeat test modules elasticsearch
elasticsearch...
  ccr...
    error... ERROR timeout waiting for an event
  cluster_stats...
    error... ERROR timeout waiting for an event
  enrich...
    error... ERROR timeout waiting for an event
  index...
    error... ERROR timeout waiting for an event
  index_recovery...
    error... ERROR timeout waiting for an event
  index_summary...
    error... ERROR timeout waiting for an event
  ml_job...
    error... ERROR timeout waiting for an event
  node_stats...OK
  shard...
    error... ERROR timeout waiting for an event

```

**Metricbeat ES module -**

```auto
- module: elasticsearch
  metricsets:
    - ccr
    - cluster_stats
    - enrich
    - index
    - index_recovery
    - index_summary
    - ml_job
    - node_stats
    - shard
  period: 10s
  hosts: ["http://localhost:9200"]
  username: "${mb_monitoring_agent}"
  password: "${mb_remote_agent_pwd}"
  xpack.enabled: true

```

**Metricbeat Config -**

```auto
metricbeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: false
setup.template.settings:
  index.number_of_shards: 2
  index.codec: best_compression
output.elasticsearch:
  hosts: ["https://elastic.monitor.com:443"]
  username: "${mb_monitoring_agent}"
  password: "${mb_remote_collection_pwd}"
  ssl.certificate_authorities: ["/etc/pki/tls/certs/rootCA.pem"]

```

**Metricbeat Test output -**

```auto
metricbeat test output
elasticsearch: https://elastic.monitor.com:443...
  parse url... OK
  connection...
    parse host... OK
    dns lookup... OK
    addresses: xxx.xxx.xxx.xxx
    dial up... OK
  TLS...
    security: server's certificate chain verification is enabled
    handshake... OK
    TLS version: TLSv1.2
    dial up... OK
  talk to server... OK
  version: 7.5.2

```

---

<div class="post-metadata">

### Author: ![anandd4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anandd4/32/50610_2.png) [@anandd4](https://discuss.elastic.co/u/anandd4)
#### Post date: [May 27, 2021, 3:54am UTC](https://discuss.elastic.co/t/metricbeat-elasticsearch-module-not-working/274020/2 "2021-05-27T03:54:44Z")

</div>

This issue stands resolved. It seems that some of the stats(index/ccr/cluster) are only collected by Master instance of ES cluster which is the reason ES module test was failing expect for nodes\_stats.

---

<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: [June 24, 2021, 3:55am UTC](https://discuss.elastic.co/t/metricbeat-elasticsearch-module-not-working/274020/3 "2021-06-24T03:55:23Z")

</div>

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