# Metricbeat Error while enrolling: fail to execute the HTTP POST request: Post https://kibana

**URL:** <https://discuss.elastic.co/t/metricbeat-error-while-enrolling-fail-to-execute-the-http-post-request-post-https-kibana/162979>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [January 4, 2019, 3:18pm UTC](https://discuss.elastic.co/t/metricbeat-error-while-enrolling-fail-to-execute-the-http-post-request-post-https-kibana/162979 "2019-01-04T15:18:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Downey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_downey/32/35987_2.png) [@Ryan\_Downey](https://discuss.elastic.co/u/Ryan_Downey)\
**Post date:** [January 4, 2019, 3:18pm UTC](https://discuss.elastic.co/t/metricbeat-error-while-enrolling-fail-to-execute-the-http-post-request-post-https-kibana/162979/1 "2019-01-04T15:18:34Z")

</div>

Elasticsearch 6.5.1  
XPack enabled, TLS/SSL encryption enabled  
Setup: Metricbeat--\>Logstash--\>Elasticsearch\<--Kibana

I've been trying to enroll a metricbeat on a Windows Server 2016 box through the Central Managaement feature and I've had no luck getting it to register. Here are the troubleshooting steps that I've gone through so far.

1. Followed the thread here: [https://github.com/elastic/beats/issues/9385](https://github.com/elastic/beats/issues/9385)  
-Deleted data/json  
.-Established a new token after deletion of data/json, beat type: metricbeat platform: Windows  
-Made sure I prefixed the cmd with -e -v -d "\*"

```auto
PS C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64> .\metricbeat.exe -e -v -d "*" enroll https://abc.gov 4dcf5218c47740af8467729eaa93e25c
2019-01-04T09:49:54.576-0500 INFO instance/beat.go:592 Home path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64] Config path: [C:\Program Files\Metricbeat\m
etricbeat-6.5.3-windows-x86_64] Data path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64\data] Logs path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_6
4\logs]
2019-01-04T09:49:54.578-0500 DEBUG [beat] instance/beat.go:629 Beat metadata path: C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64\data\meta.json
2019-01-04T09:49:54.597-0500 INFO instance/beat.go:599 Beat UUID: 60ce4282-8666-480c-b088-c2208799c0ef
2019-01-04T09:49:54.597-0500 INFO kibana/client.go:118 Kibana url: https://abc.gov:5601
Error while enrolling: fail to execute the HTTP POST request: Post https://abc.gov:5601/api/beats/agent/60ce4282-8666-480c-b088-c2208799c0ef: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)**

```

1. Also added .management-beats to action.auto\_create\_index in our ES yaml to which I can see a management-beats index when I click on Include System Indicies

2. Tried to use some of the other options from here: [https://www.elastic.co/guide/en/beats/metricbeat/current/enroll-beats.html](https://www.elastic.co/guide/en/beats/metricbeat/current/enroll-beats.html)

```auto
PS C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64> .\metricbeat.exe -e -v -d "*" enroll https://abc.gov --username elastic --password stdin
2019-01-04T09:56:42.515-0500 INFO instance/beat.go:592 Home path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64] Config path: [C:\Program Files\Metricbeat\m
etricbeat-6.5.3-windows-x86_64] Data path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64\data] Logs path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_6
4\logs]
2019-01-04T09:56:42.517-0500 DEBUG [beat] instance/beat.go:629 Beat metadata path: C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64\data\meta.json
2019-01-04T09:56:42.523-0500 INFO instance/beat.go:599 Beat UUID: 60ce4282-8666-480c-b088-c2208799c0ef
Enter password:
2019-01-04T09:56:50.500-0500 INFO kibana/client.go:118 Kibana url: https://abc.gov:5601
Error creating a new enrollment token: fail to execute the HTTP POST request: Post https://abc.gov:5601/api/beats/enrollment_tokens: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

```

1. Tried a different version with no luck:

```auto
PS C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64> .\metricbeat.exe -e -v -d "*" enroll https://abcgov --username elastic --password password [--force]
2019-01-04T09:59:25.329-0500 INFO instance/beat.go:592 Home path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64] Config path: [C:\Program Files\Metricbeat\m
etricbeat-6.5.3-windows-x86_64] Data path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64\data] Logs path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_6
4\logs]
2019-01-04T09:59:25.330-0500 DEBUG [beat] instance/beat.go:629 Beat metadata path: C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64\data\meta.json
2019-01-04T09:59:25.336-0500 INFO instance/beat.go:599 Beat UUID: 60ce4282-8666-480c-b088-c2208799c0ef
2019-01-04T09:59:25.337-0500 INFO kibana/client.go:118 Kibana url: https://abc.gov:5601
Error while enrolling: fail to execute the HTTP POST request: Post https://abc.gov:5601/api/beats/agent/60ce4282-8666-480c-b088-c2208799c0ef: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
PS C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64>

```

1. Tried username and password verification

```auto
PS C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64> .\metricbeat.exe -e -v -d "*" enroll https://abc.gov --username kibana --password stdin
2019-01-04T10:13:14.221-0500 INFO instance/beat.go:592 Home path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64] Config path: [C:\Program Files\Metricbeat\m
etricbeat-6.5.3-windows-x86_64] Data path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64\data] Logs path: [C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_6
4\logs]
2019-01-04T10:13:14.223-0500 DEBUG [beat] instance/beat.go:629 Beat metadata path: C:\Program Files\Metricbeat\metricbeat-6.5.3-windows-x86_64\data\meta.json
2019-01-04T10:13:14.228-0500 INFO instance/beat.go:599 Beat UUID: 60ce4282-8666-480c-b088-c2208799c0ef
Enter password:
2019-01-04T10:13:20.911-0500 INFO kibana/client.go:118 Kibana url: https://abc.gov:5601
Error creating a new enrollment token: fail to execute the HTTP POST request: Post https://kibana-qa.svc.ny.gov:5601/api/beats/enrollment_tokens: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

```

1. I checked this thread and had no luck: [Central Management filebeat enrollment fail](https://discuss.elastic.co/t/central-management-filebeat-enrollment-fail/160412/4)  
\*\*\*Update: I went through the steps here and it still didn't seem to work: [http://www.sqlservermart.com/HowTo/Windows\_Import\_Certificate.aspx](http://www.sqlservermart.com/HowTo/Windows_Import_Certificate.aspx)  
I'm running into the same issue. By "add the CA to the OS trust store" I assume that if I'm working on a Windows Server 2016 that it needs to be added somewhere in the MS truststore. Any info on how to do that? I've been reading documentation online but its not getting me anywhere. Any help would be appreciated.

Any help would be appreciated. For our environment using Central Management would be really useful so we'd like to get it working.

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [January 7, 2019, 6:01pm UTC](https://discuss.elastic.co/t/metricbeat-error-while-enrolling-fail-to-execute-the-http-post-request-post-https-kibana/162979/2 "2019-01-07T18:01:20Z")

</div>

> [@Ryan\_Downey](#):
>
> net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

The above error look more like a firewall issue, can you reach kibana using curl from that machine?

---

<div class="post-metadata">

**Author:** ![Ryan\_Downey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_downey/32/35987_2.png) [@Ryan\_Downey](https://discuss.elastic.co/u/Ryan_Downey)\
**Post date:** [January 23, 2019, 2:27pm UTC](https://discuss.elastic.co/t/metricbeat-error-while-enrolling-fail-to-execute-the-http-post-request-post-https-kibana/162979/3 "2019-01-23T14:27:03Z")

</div>

Pier,

Sorry for my delay but I appreciate your response awhile back. I just got back around to troubleshooting this as some other projects took precedence over this one for the time being. I was able to work around this issue by pointing the autogenerated token link to a specific server within our Kibana cluster and remvoing the [kiban.gov](http://kiban.gov) part. Our setup like many has a VIP that directs data to one of the three Kibana servers in the pool. So we have [kibana-test.gov](http://kibana-test.gov) with [abc.gov](http://abc.gov), [def.gov](http://def.gov) and [ghi.gov](http://ghi.gov) servers and once I took out the [kibana-test.gov](http://kibana-test.gov) from the link and put in [abc.gov](http://abc.gov) with the username and password it worked. For this example, metricbeat on Windows Server 2016 pointing to RPM Linux Kibana, the below command worked.

```auto
 .\metricbeat.exe enroll -username elastic --password stdin --force http://abc.gov 14axxxxxxxxxxxxxxxxxxxxxxxxx

```

```auto
Saving a copy of current settings to metricbeat.yml.bak
Enrolled and ready to retrieve settings from Kibana

```

One of the other issues that popped up was that due to the fact that our Kibana servers sit behind the VIP I had to remove the https part and change it to http. The error message that I got with https was:

```auto
Error while enrolling: fail to execute the HTTP POST request: Post https://abc.gov:5601/api/beats/agent
/60ce4282-8666-480c-b088-c2208799c0ef: http: server gave HTTP response to HTTPS client

```

Overall removal of the link that Kibana generated and inputting a specific server within our DNS pool worked. Thanks for the help and hopefully this helps some others out as well. Enjoy the rest of your day.

---

<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:** [February 20, 2019, 2:27pm UTC](https://discuss.elastic.co/t/metricbeat-error-while-enrolling-fail-to-execute-the-http-post-request-post-https-kibana/162979/4 "2019-02-20T14:27:09Z")

</div>

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