# Beat-xpack module doesn’t work on localhost 5066 port

**URL:** https://discuss.elastic.co/t/beat-xpack-module-doesn-t-work-on-localhost-5066-port/334909
**Category:** Beats
**Tags:** beats-module
**Created:** [June 1, 2023, 7:04am UTC](https://discuss.elastic.co/t/beat-xpack-module-doesn-t-work-on-localhost-5066-port/334909 "2023-06-01T07:04:45Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![PodarcisMuralis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/podarcismuralis/32/122606_2.png) [@PodarcisMuralis](https://discuss.elastic.co/u/PodarcisMuralis)
#### Post date: [June 1, 2023, 7:04am UTC](https://discuss.elastic.co/t/beat-xpack-module-doesn-t-work-on-localhost-5066-port/334909/1 "2023-06-01T07:04:45Z")

</div>

Hello,

I am trying to use Beat Module for monitoring Metricbeat on Kibana-Stack Monitoring. I am using this in metricbeat.yml

```auto
  - module: beat
    xpack.enabled: true
    period: 10s
    hosts: ["http://localhost:5066"]
    username: "xxx"
    password: "xxx"

http.enabled: true
http.host: localhost
http.port: 5066

```

But I get this error if I check the connection with ./metricbeat test modules beat

```auto
beat...
  state...
    error... ERROR error making http request: Get "http://localhost:5066/state": dial tcp [::1]:5066: connect: connection refused
  stats...
    error... ERROR error making http request: Get "http://localhost:5066/stats": dial tcp [::1]:5066: connect: connection refused

```

Edit 1: Other modules like Kibana, Elasticsearch and Logstash are working well.  
And interestingly if I use _ **./metricbeat test modules beat** _ I got the error but if I start metricbeat with _ **./metricbeat -e** _, " **Disable self monitoring**" appears nicely on Stack Monitoring.

Edit 2: If I remove http parts from metricbeat.yml, _ **./metricbeat test modules beat** _ gives the same error but I can not see "Disable self monitoring" on Stack Monitoring.

Do you have an idea?  
Thanks

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [June 1, 2023, 2:39pm UTC](https://discuss.elastic.co/t/beat-xpack-module-doesn-t-work-on-localhost-5066-port/334909/2 "2023-06-01T14:39:27Z")

</div>

What version of Beats / Elastic?

Easiest way to monitor beats is with internal monitoring ... normally what I use..

> **[Use internal collection to send monitoring data | Metricbeat Reference \[8.11\]...](https://www.elastic.co/guide/en/beats/metricbeat/current/monitoring-internal-collection.html)**

Is there a reason you are using the more complex method?

I suspect if you look in the logs or netstat metricbeat is unable to open the 5066 port

> [@PodarcisMuralis](#):
>
> Edit 1: Other modules like Kibana, Elasticsearch and Logstash are working well.  
> And interestingly if I use _ **./metricbeat test modules beat** _ I got the error but if I start metricbeat with _ **./metricbeat -e** _, " **Disable self monitoring**" appears nicely on Stack Monitoring.

Did you read about monitoring .... [Monitoring in a production environment | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/monitoring-production.html)

Specifically

```auto
GET _cluster/settings

PUT _cluster/settings
{
  "persistent": {
    "xpack.monitoring.collection.enabled": false
  }
}

```

> [@PodarcisMuralis](#):
>
> Edit 2: If I remove http parts from metricbeat.yml, _ **./metricbeat test modules beat** _ gives the same error but I can not see "Disable self monitoring" on Stack Monitoring.

That just tests and does not send data that makes sense because no data is sent... .

Monitoring can be a bit confusing...

I have found

**First and foremost, you also have to monitor the elasticsearch cluster if you want to show the beats in stack monitoring... Just Beat Monitoring will not show...**

a) For beat the internal Collection is easiest.

b) Setup Elasticsearch-xpack modules

Then you should get both the beat and elasticsearch on stack monitoring

in my metricbeat.yml this is all I added

```auto
# Set to true to enable the monitoring reporter.
monitoring.enabled: true

```

and then for me I just enabled the elasticsearch-xpack module

```auto
- module: elasticsearch
  xpack.enabled: true
  period: 10s
  hosts: ["http://localhost:9200"]
  #username: "user"
  #password: "secret"

```

Then ran metricbeat and here it is

 ![Screenshot 2023-06-01 at 7.57.49 AM](https://us1.discourse-cdn.com/elastic/original/3X/a/2/a2bdd8465881bbfe1280252445e17ba80ee834f1.png)

I highly recommend reading the docs

> **[Monitoring overview | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/monitoring-overview.html)**

---

<div class="post-metadata">

### Author: ![PodarcisMuralis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/podarcismuralis/32/122606_2.png) [@PodarcisMuralis](https://discuss.elastic.co/u/PodarcisMuralis)
#### Post date: [June 2, 2023, 7:15am UTC](https://discuss.elastic.co/t/beat-xpack-module-doesn-t-work-on-localhost-5066-port/334909/3 "2023-06-02T07:15:12Z")

</div>

Hi Stephen,

we actually wanted to disable Self-Monitoring. Because as I read on some sources Self Monitoring will be gone in future. We unified the system and monitoring everything with Metricbeat.

If you enter "Enter Setup Mode" there are 3 sentences:

- Monitored with Metricbeat
- Disableself Monitoring
- Monitor with Metricbeat

I used this

```auto
  - module: beat
    xpack.enabled: true
    period: 10s
    hosts: ["http://localhost:5066"]
    username: xxx"
    password: "xxx"

http.enabled: true
http.host: localhost
http.port: 5066

```

It worked but then it said automatically. In order to disable self monitoring change  
monitoring:  
enabled: false (it was true).

Then it worked for me. I have everywhere the same sentence.

- Monitored with Metricbeat

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [June 2, 2023, 1:07pm UTC](https://discuss.elastic.co/t/beat-xpack-module-doesn-t-work-on-localhost-5066-port/334909/4 "2023-06-02T13:07:44Z")

</div>

H @PodarcisMuralis

Yep, it can be confusing.

You're confusing self-monitoring which is slowly deprecating versus just the simple metricbeat internal monitoring two different things.

Self-monitoring is only in reference to elasticsearch has nothing to do with beats at all, and yes that is "deprected/ing"

Metricbeat internal monitoring is not going away as far as I understand and it's perfectly valid and I use it all the time.

You're welcome to use whatever method you like. I was just sharing what I consider to be the simple and supported path.

I did nothing more than when I showed you above.

The problem there can be some issues if you already enabled self-monitoring and then are going back to try to do monitoring with metricbeat

---

<div class="post-metadata">

### Author: ![PodarcisMuralis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/podarcismuralis/32/122606_2.png) [@PodarcisMuralis](https://discuss.elastic.co/u/PodarcisMuralis)
#### Post date: [June 2, 2023, 2:48pm UTC](https://discuss.elastic.co/t/beat-xpack-module-doesn-t-work-on-localhost-5066-port/334909/5 "2023-06-02T14:48:50Z")

</div>

Hi Stephen.

Thank you very much for your kind assistance. I really appreciate it.  
I have already set up this method. Monitoring Beats with Metricbeat.

I just changed to your method and saw that it says "Monitor with Metricbeat". I think there is no difference between them and you are right, I chose the hard way.

![image](https://us1.discourse-cdn.com/elastic/original/3X/0/5/05d4b8c2ffaa143d5cadc166b1cabdabf369fd7a.png)

Thanks again and have a nice weekend.

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [June 2, 2023, 4:13pm UTC](https://discuss.elastic.co/t/beat-xpack-module-doesn-t-work-on-localhost-5066-port/334909/6 "2023-06-02T16:13:28Z")

</div>

We learn most when we take the hard way .. but I could skip it a few times myself 🙂

Our docs / guidance could be a bit clearer.

---

<div class="post-metadata">

### Author: ![PodarcisMuralis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/podarcismuralis/32/122606_2.png) [@PodarcisMuralis](https://discuss.elastic.co/u/PodarcisMuralis)
#### Post date: [June 22, 2023, 11:41am UTC](https://discuss.elastic.co/t/beat-xpack-module-doesn-t-work-on-localhost-5066-port/334909/7 "2023-06-22T11:41:11Z")

</div>

The magic answer why I got this error is, to start metricbeat itself.  
**sudo systemctl start metricbeat.**  
Then you can test your metricbeat modules.  
**./metricbeat test modules beat**

---

<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: [July 20, 2023, 1:41pm UTC](https://discuss.elastic.co/t/beat-xpack-module-doesn-t-work-on-localhost-5066-port/334909/8 "2023-07-20T13:41:24Z")

</div>

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