# Add APM agent health check

**URL:** <https://discuss.elastic.co/t/add-apm-agent-health-check/284889>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [September 22, 2021, 2:44pm UTC](https://discuss.elastic.co/t/add-apm-agent-health-check/284889 "2021-09-22T14:44:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BehroozBahrameh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/behroozbahrameh/32/94932_2.png) [@BehroozBahrameh](https://discuss.elastic.co/u/BehroozBahrameh)\
**Post date:** [September 22, 2021, 2:44pm UTC](https://discuss.elastic.co/t/add-apm-agent-health-check/284889/1 "2021-09-22T14:44:08Z")

</div>

There is a possibility to lose the tracking data because of the misconfiguration on the application side or changes on ELK setup or network issue or ...  
I wondered if there is any way to get connection status from the APM agent and put it as a part of the health check indicators to be informed about connectivity issues.  
Health check response by this integration can be something like below:

```auto
{
	"status": "Healthy",
	"results": {
		"DB": {
			"status": "Healthy",
			"description": null,
			"data": {}
		},
		"ELASTIC-APM": {
			"status": "Healthy",
			"description": "APM agent is connected.",
			"data": {}
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [September 27, 2021, 2:23pm UTC](https://discuss.elastic.co/t/add-apm-agent-health-check/284889/2 "2021-09-27T14:23:10Z")

</div>

Have you considered manually doing a simple HTTP health check for the APM Server URL?

---

<div class="post-metadata">

**Author:** ![BehroozBahrameh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/behroozbahrameh/32/94932_2.png) [@BehroozBahrameh](https://discuss.elastic.co/u/BehroozBahrameh)\
**Post date:** [September 27, 2021, 3:50pm UTC](https://discuss.elastic.co/t/add-apm-agent-health-check/284889/3 "2021-09-27T15:50:31Z")

</div>

Could you please elaborate a bit more? What do you mean by a simple manual HTTP health check for the APM server URL? Do you mean calling the APM server health endpoint through the main application ([Server Information API | APM Server Reference [7.15] | Elastic](https://www.elastic.co/guide/en/apm/server/current/server-info.html))? This endpoint is not available on our setup.

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [September 28, 2021, 6:08am UTC](https://discuss.elastic.co/t/add-apm-agent-health-check/284889/4 "2021-09-28T06:08:14Z")

</div>

> [@BehroozBahrameh](#):
>
> Do you mean calling the APM server health endpoint through the main application

Yes, that's what I meant.

> [@BehroozBahrameh](#):
>
> This endpoint is not available on our setup.

Why is this endpoint not available? What would you want the health check to indicate then?

---

<div class="post-metadata">

**Author:** ![nugusbayevkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nugusbayevkk/32/126683_2.png) [@nugusbayevkk](https://discuss.elastic.co/u/nugusbayevkk)\
**Post date:** [September 28, 2021, 7:12am UTC](https://discuss.elastic.co/t/add-apm-agent-health-check/284889/5 "2021-09-28T07:12:56Z")

</div>

Hi @felixbarny

How I understand @BehroozBahrameh,  
He wants see available of agents in Kibana interface.

With current data model - we can see any data related to agents if transaction, span, error, or metrics are sent by agent.  
But there may be situations, for example, when there are no transactions in the applications and the sending of metrics is disabled.

And agents will not send any data.

This introduces users into a misunderstandings: there are some network partitions or there are no transactions at all.

The solution is to send a new type of event: healthcheck. The data that will be stored, for example, in the `apm-healthcheck-xxx` index.

As a workaround, users can create gauges like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/0/c025920a61db2e41d972a13d28586c42b8a39ab2.png)  
custom gauge configuration:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/6/369fc921f45d513549bea2eb36cee40107bfc6cf.png)

---

<div class="post-metadata">

**Author:** ![BehroozBahrameh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/behroozbahrameh/32/94932_2.png) [@BehroozBahrameh](https://discuss.elastic.co/u/BehroozBahrameh)\
**Post date:** [September 28, 2021, 1:14pm UTC](https://discuss.elastic.co/t/add-apm-agent-health-check/284889/6 "2021-09-28T13:14:56Z")

</div>

It was my bad. We have two different ports, 8200 and 8201. I used 8201 for APM, and it doesn't have the health check endpoint, but 8200 has. So I've checked, and I can use 8200 for APM as well, so I will probably go for your approach and use Agent.Config.ServerUrl for the health checking.  
Thank you for your hint

---

<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:** [October 19, 2021, 9:15am UTC](https://discuss.elastic.co/t/add-apm-agent-health-check/284889/7 "2021-10-19T09:15:34Z")

</div>

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