# Elastic agents are failing to connect with elastic apm server

**URL:** <https://discuss.elastic.co/t/elastic-agents-are-failing-to-connect-with-elastic-apm-server/325380>\
**Category:** APM\
**Tags:** java, server\
**Created:** [February 13, 2023, 11:47am UTC](https://discuss.elastic.co/t/elastic-agents-are-failing-to-connect-with-elastic-apm-server/325380 "2023-02-13T11:47:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahul\_sirugudi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_sirugudi/32/94019_2.png) [@rahul\_sirugudi](https://discuss.elastic.co/u/rahul_sirugudi)\
**Post date:** [February 13, 2023, 11:47am UTC](https://discuss.elastic.co/t/elastic-agents-are-failing-to-connect-with-elastic-apm-server/325380/1 "2023-02-13T11:47:39Z")

</div>

I Have configured Elastic APM on filebeat server. In Java\_OPTS configured jar file. How ever i am seeing 2 errors when the agent is trying to make POST calls.

```auto
Feb 13 06:15:37 ip-10-0-1-5.us-west-2.compute.internal server[14039]: 2023-02-13 06:15:37,676 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.AbstractIntakeApiHandler - Error trying to connect to APM Server at http://10.0.1.180:8200/intake/v2/events. Although not necessarily related to SSL, some related SSL configurations corresponding the current connection are logged at INFO level.

FEb 13 06:15:37 ip-10-0-1-5.us-west-2.compute.internal server[14039]: 2023-02-13 06:15:37,677 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type TRANSACTION with this error: Connection refused (Connection refused)

```

How ever i am able to connect from agent node, on 8200 port it is giving me 200 codes.

```auto
curl -v http://10.0.1.180:8200/
* Trying 10.0.1.180:8200...
* Connected to 10.0.1.180 (10.0.1.180) port 8200 (#0)
> GET / HTTP/1.1
> Host: 10.0.1.180:8200
> User-Agent: curl/7.79.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: application/json
< X-Content-Type-Options: nosniff
< Date: Mon, 13 Feb 2023 11:46:56 GMT
< Content-Length: 125
< 
{
  "build_date": "2021-07-29T19:55:24Z",
  "build_sha": "af26b5a744b6af9bcccb04fade6435241ab91f43",
  "version": "7.14.0"
}
* Connection #0 to host 10.0.1.180 left intact

```

---

<div class="post-metadata">

**Author:** ![Jack\_Shirazi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jack_shirazi/32/91641_2.png) [@Jack\_Shirazi](https://discuss.elastic.co/u/Jack_Shirazi)\
**Post date:** [February 13, 2023, 12:16pm UTC](https://discuss.elastic.co/t/elastic-agents-are-failing-to-connect-with-elastic-apm-server/325380/2 "2023-02-13T12:16:06Z")

</div>

Have you done that curl from the same host that is running the agent?

---

<div class="post-metadata">

**Author:** ![rahul\_sirugudi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_sirugudi/32/94019_2.png) [@rahul\_sirugudi](https://discuss.elastic.co/u/rahul_sirugudi)\
**Post date:** [February 13, 2023, 12:16pm UTC](https://discuss.elastic.co/t/elastic-agents-are-failing-to-connect-with-elastic-apm-server/325380/3 "2023-02-13T12:16:46Z")

</div>

yes.. from the same host.

---

<div class="post-metadata">

**Author:** ![Jack\_Shirazi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jack_shirazi/32/91641_2.png) [@Jack\_Shirazi](https://discuss.elastic.co/u/Jack_Shirazi)\
**Post date:** [February 13, 2023, 12:18pm UTC](https://discuss.elastic.co/t/elastic-agents-are-failing-to-connect-with-elastic-apm-server/325380/4 "2023-02-13T12:18:00Z")

</div>

Is the jvm running directly on the host or in a container on that host?

---

<div class="post-metadata">

**Author:** ![rahul\_sirugudi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_sirugudi/32/94019_2.png) [@rahul\_sirugudi](https://discuss.elastic.co/u/rahul_sirugudi)\
**Post date:** [February 13, 2023, 12:25pm UTC](https://discuss.elastic.co/t/elastic-agents-are-failing-to-connect-with-elastic-apm-server/325380/5 "2023-02-13T12:25:26Z")

</div>

I am running on the AWS beanstalk EC2 instance, it is directly running on the host.

---

<div class="post-metadata">

**Author:** ![Jack\_Shirazi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jack_shirazi/32/91641_2.png) [@Jack\_Shirazi](https://discuss.elastic.co/u/Jack_Shirazi)\
**Post date:** [February 13, 2023, 1:03pm UTC](https://discuss.elastic.co/t/elastic-agents-are-failing-to-connect-with-elastic-apm-server/325380/6 "2023-02-13T13:03:45Z")

</div>

What is the agent version and configuration, is there a proxy in the comms there, can you run the agent in DEBUG and look for errors, are you only seeing those two lines or does this error repeat, there should be regular comms attempts from the agent not just once

---

<div class="post-metadata">

**Author:** ![rahul\_sirugudi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_sirugudi/32/94019_2.png) [@rahul\_sirugudi](https://discuss.elastic.co/u/rahul_sirugudi)\
**Post date:** [February 13, 2023, 4:12pm UTC](https://discuss.elastic.co/t/elastic-agents-are-failing-to-connect-with-elastic-apm-server/325380/7 "2023-02-13T16:12:46Z")

</div>

It's really strange!!!  
Actually i have 2 setup running 1 in QA running as standalone mode (This is where i am seeing the above issue).

In prod set up i am using cluster mode there my application able to connect with APM interface as soon as i hit the url.

This is resolved.

---

<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:** [March 6, 2023, 12:13pm UTC](https://discuss.elastic.co/t/elastic-agents-are-failing-to-connect-with-elastic-apm-server/325380/8 "2023-03-06T12:13:22Z")

</div>

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