# Issue connecting to Elastic from Metricbeat

**URL:** <https://discuss.elastic.co/t/issue-connecting-to-elastic-from-metricbeat/327833>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [March 16, 2023, 9:08am UTC](https://discuss.elastic.co/t/issue-connecting-to-elastic-from-metricbeat/327833 "2023-03-16T09:08:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SANTHOSH\_R](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santhosh_r/32/118521_2.png) [@SANTHOSH\_R](https://discuss.elastic.co/u/SANTHOSH_R)\
**Post date:** [March 16, 2023, 9:08am UTC](https://discuss.elastic.co/t/issue-connecting-to-elastic-from-metricbeat/327833/1 "2023-03-16T09:08:40Z")

</div>

I am getting following error , when i tried to connect to elastic (which is in another server) from metricbeat server. What could be the issue ? Can you guys help on it . Thanks in Advance

PS C:\ELK\_PROD\Metricbeat\> .\metricbeat test output  
elasticsearch: [https://AOSMonitor.degag.corpintra.net:9200](https://AOSMonitor.degag.corpintra.net:9200)...  
parse url... OK  
connection...  
parse host... OK  
dns lookup... OK  
addresses: 53.36.18.220  
dial up... OK  
TLS...  
security: server's certificate chain verification is enabled  
handshake... OK  
TLS version: TLSv1.3  
dial up... OK  
talk to server... ERROR Get "[https://AOSMonitor.degag.corpintra.net:9200](https://AOSMonitor.degag.corpintra.net:9200)": Forbidden

---

<div class="post-metadata">

**Author:** ![jba](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jba/32/118482_2.png) [@jba](https://discuss.elastic.co/u/jba)\
**Post date:** [March 18, 2023, 7:09pm UTC](https://discuss.elastic.co/t/issue-connecting-to-elastic-from-metricbeat/327833/2 "2023-03-18T19:09:40Z")

</div>

Hmmm. Guessing from the output, it looks like the basics (name resolution of AOSMonitor using DNS) is working, which makes me suspect a firewall or proxy server somewhere not allowing you through. You could use your local web browser to try to connect to the Elasticsearch server with HTTPS, but make sure to try it with and without a proxy configuration in the browser, but I really prefer a command line tool for that kind of testing. Do PowerShell come with something that will talk HTTPS? Some type of GetUsingUrl command? If not, install some MinGW tools like `curl` and `wget` and thank me later. Cygwin will also do, but might be overkill.

---

<div class="post-metadata">

**Author:** ![SANTHOSH\_R](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santhosh_r/32/118521_2.png) [@SANTHOSH\_R](https://discuss.elastic.co/u/SANTHOSH_R)\
**Post date:** [March 23, 2023, 3:37am UTC](https://discuss.elastic.co/t/issue-connecting-to-elastic-from-metricbeat/327833/3 "2023-03-23T03:37:47Z")

</div>

> [@jba](#):
>
> You could use your local web browser to try to connect to the Elasticsearch server with HTTPS, but make sure to try it with and without a proxy configuration in the browser

Thanks for the reply..  
I tried from local browser with and without proxy , i could able to open the elasticsearch server .. Still not sure why the test output is giving Forbidden

On to it , Ping is working to the [AOSMonitor.degag.corpintra.net](http://AOSMonitor.degag.corpintra.net) from metricbeat server

Telnet is working [[AOSMonitor.degag.corpintra.net:9200](http://AOSMonitor.degag.corpintra.net:9200)] from metricbeat server .

tracert is getting resolved within 2 hops.

What other reason it could be for the reason for forbidden

---

<div class="post-metadata">

**Author:** ![SANTHOSH\_R](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santhosh_r/32/118521_2.png) [@SANTHOSH\_R](https://discuss.elastic.co/u/SANTHOSH_R)\
**Post date:** [March 24, 2023, 9:57am UTC](https://discuss.elastic.co/t/issue-connecting-to-elastic-from-metricbeat/327833/4 "2023-03-24T09:57:19Z")

</div>

From Browser i could able to connect to Elasticsearch with or without proxy , not sure why i am not able to connect from metric beat .. Test output is giving forbidden error..

---

<div class="post-metadata">

**Author:** ![jba](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jba/32/118482_2.png) [@jba](https://discuss.elastic.co/u/jba)\
**Post date:** [March 30, 2023, 8:07pm UTC](https://discuss.elastic.co/t/issue-connecting-to-elastic-from-metricbeat/327833/5 "2023-03-30T20:07:45Z")

</div>

HTTPS is using TCP (Transport Control Protocol?) as its underlying protocol. Ping is using something entirely different, something called ICMP - Internet Control Message Protocol, and firewalls and routers are usually a bit more relaxed about letting ICMP packet through. But it is good that ping'ing works because it proves (again) that DNS is working and that basic IP routing is working.

Telnet is also using TCP so that is a bit confusing that it works, but not the 'test output' checks. I assume you got (encrypted) garbage when you connected to the Elasticsearch server on port 9200 ? If it was encrypted garbage that is also good, because that shows that you have (as the 'test output' shows) encryption with SSL and/or TLS set up.

You might want to see if you have `openssl` installed. It can be used like Telnet to talk TCP, but it also under SSL/TLS encryption. Something like `openssl s_client -connect AOSMonitor.degag.corpintra.net:9200` should give you non-garbage.

_Ohh - I see you are refering to `tracert` meaning that you are probably on a Windows machine. Then I am afraid that `openssl` is not an option._

Are you allowed to disable SSL encryption on the Elasticsearch server? That would be a small step forward if you could disable SSL on both the Elasticsearch server and on the Metricbeat client, and see if that made the test output succeed.

---

<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:** [March 31, 2023, 5:32am UTC](https://discuss.elastic.co/t/issue-connecting-to-elastic-from-metricbeat/327833/6 "2023-03-31T05:32:09Z")

</div>

Hi @SANTHOSH_R Welcome to the community!

Forbidden typically means Authentication/ Authorization issue... I.e  
username / password or API Key issue.

What form of authentication are you using?

Can you curl elasticsearch with the exact same credentials from the metricbeat host?

---

<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:** [April 28, 2023, 7:32am UTC](https://discuss.elastic.co/t/issue-connecting-to-elastic-from-metricbeat/327833/7 "2023-04-28T07:32:14Z")

</div>

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