# APM agent not communicating with APM-Server

**URL:** <https://discuss.elastic.co/t/apm-agent-not-communicating-with-apm-server/257104>\
**Category:** APM\
**Tags:** dotnet, server\
**Created:** [November 30, 2020, 5:22pm UTC](https://discuss.elastic.co/t/apm-agent-not-communicating-with-apm-server/257104 "2020-11-30T17:22:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeoffRx](https://avatars.discourse-cdn.com/v4/letter/g/ce73a5/32.png) [@GeoffRx](https://discuss.elastic.co/u/GeoffRx)\
**Post date:** [November 30, 2020, 5:22pm UTC](https://discuss.elastic.co/t/apm-agent-not-communicating-with-apm-server/257104/1 "2020-11-30T17:22:01Z")

</div>

APM agent cannot contact APM-Server. The servers with the APM agent hard coded in web.config (in .NET FullFramework) have been giving us the following error message in Event Viewer:

Timestamp: 11/30/2020 2:41:58 PM  
Message: {PayloadSenderV2} Failed sending events. Following events were not transferred successfully to the server ([http://localhost:8200/](http://localhost:8200/)):  
Elastic.Apm.Metrics.MetricSet

The following is a snippet of the web.config:

 ![ApmWebConfig](https://us1.discourse-cdn.com/elastic/original/3X/0/a/0adc8eb596e8fc063b63c5e2935fc5b09d7827b4.png)

Have been troubleshooting for communication between the APM-Server and the APM agent, but logs aren't giving us details. Was hoping someone had any ideas.

Thank you

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [November 30, 2020, 5:43pm UTC](https://discuss.elastic.co/t/apm-agent-not-communicating-with-apm-server/257104/2 "2020-11-30T17:43:55Z")

</div>

Hi @GeoffRx,

the error message says `http://localhost:8200/`, but your `web.config` shows a `ServerUrls` value with `https` - that's strange. I suspect the removed part of the value isn't `localhost`, so it seems the agent does not pick up the value.

Do you maybe see an error during startup regarding parsing the `ServerUrls` value? Or do you maybe have the same value configured as an environment variable as well?

---

<div class="post-metadata">

**Author:** ![GeoffRx](https://avatars.discourse-cdn.com/v4/letter/g/ce73a5/32.png) [@GeoffRx](https://discuss.elastic.co/u/GeoffRx)\
**Post date:** [November 30, 2020, 7:29pm UTC](https://discuss.elastic.co/t/apm-agent-not-communicating-with-apm-server/257104/3 "2020-11-30T19:29:05Z")

</div>

Hey @GregKalapos,

Thanks for the timely response. We did not see any logs regarding parsing the ServerUrls value. Fortunately, however, we have finally gotten the APM agent communicating with the APM Server. We had do disable SSL for now, just to see if it would indeed send data.

So we believe there is an issue with certificates and authentication. We generated the certs with the provided elasticsearch-certutil, but we're thinking we may have to obtain another cert that isn't self-signed. Another oddity is even though APM is now receiving data, we are still getting the same error message posted in my first post.

A bit of a dilemma but when we find the answer, I will update this post to share with others. Thanks again Greg,

Geoff

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [November 30, 2020, 7:43pm UTC](https://discuss.elastic.co/t/apm-agent-not-communicating-with-apm-server/257104/4 "2020-11-30T19:43:51Z")

</div>

Thanks for the update Geoff

> [@GeoffRx](#):
>
> Another oddity is even though APM is now receiving data, we are still getting the same error message posted in my first post.

This sounds very strange - definitely not normal behaviour. The agent by default tries to connect to `localhost:8200`, but if you set another `ServerUrls` value, then it should not do this. Let us know if you can find out something. If this persists and it's reproducible, then this sounds like a bug, so we'll look into it if there is more info.

---

<div class="post-metadata">

**Author:** ![GeoffRx](https://avatars.discourse-cdn.com/v4/letter/g/ce73a5/32.png) [@GeoffRx](https://discuss.elastic.co/u/GeoffRx)\
**Post date:** [December 2, 2020, 5:59pm UTC](https://discuss.elastic.co/t/apm-agent-not-communicating-with-apm-server/257104/5 "2020-12-02T17:59:02Z")

</div>

@GregKalapos,

Wanted to update you on this issue. We re-enabled SSL and commented out the secret token in the apm-server.yml. We are receiving data from the .NET APM Agent to the APM Server but are still receiving the following error message in Windows Event Viewer on all servers with the APM agent installed:

Message: {PayloadSenderV2} Failed sending events. Following events were not transferred successfully to the server ([http://localhost:8200/](http://localhost:8200/)):

However, the agent is sending the data we need and SSL is enabled, so, we are satisfied with the outcome. Just wanted to let you know in case there is indeed a bug or need for further investigation.

---

<div class="post-metadata">

**Author:** ![Alan\_Basinger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alan_basinger/32/77273_2.png) [@Alan\_Basinger](https://discuss.elastic.co/u/Alan_Basinger)\
**Post date:** [December 2, 2020, 6:03pm UTC](https://discuss.elastic.co/t/apm-agent-not-communicating-with-apm-server/257104/6 "2020-12-02T18:03:56Z")

</div>

I am seeing the same thing with Windows 10 endpoint now following the installation guide.

PS C:\Program Files\Elastic-Agent\> .\elastic-agent enroll [https://192.168.111.224:443](https://192.168.111.224:443) NnI3bS1uVUJWWWZFUlhqWjFmRDY6WnZDZ0ZhaUVUZkdjVVA4ajVyZTc4dw==  
The Elastic Agent is currently in BETA and should not be used in production

2020-12-02T11:58:07.966-0600 DEBUG kibana/client.go:170 Request method: POST, path: /api/fleet/agents/enroll  
Error: fail to enroll: fail to execute request to Kibana: Post "[https://192.168.111.224:443/api/fleet/agents/enroll?":](https://192.168.111.224:443/api/fleet/agents/enroll?%22:) x509: certificate signed by unknown authority  
PS C:\Program Files\Elastic-Agent\>

As you can see when trying to enroll the agent we are getting a x509 cert error. If I take out the HTTPS it will not throw this error

PS C:\Program Files\Elastic-Agent\> .\elastic-agent enroll [http://192.168.111.224:443](http://192.168.111.224:443) NnI3bS1uVUJWWWZFUlhqWjFmRDY6WnZDZ0ZhaUVUZkdjVVA4ajVyZTc4dw==  
The Elastic Agent is currently in BETA and should not be used in production

Error: Error: connection to Kibana is insecure, strongly recommended to use a secure connection (override with --insecure)  
PS C:\Program Files\Elastic-Agent\>

and we get this error when trying to register as a service.

.\install-service-elastic-agent.ps1 : The term '.\install-service-elastic-agent.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,  
verify that the path is correct and try again.  
At line:1 char:1

- .\install-service-elastic-agent.ps1
- 

```auto
  + CategoryInfo : ObjectNotFound: (.\install-service-elastic-agent.ps1:String) [], CommandNotFoundException
  + FullyQualifiedErrorId : CommandNotFoundException
```

---

<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:** [December 23, 2020, 2:04pm UTC](https://discuss.elastic.co/t/apm-agent-not-communicating-with-apm-server/257104/7 "2020-12-23T14:04:02Z")

</div>

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