# Utilising healthcheck endpoint running on the same machine as HAProxy?

**URL:** https://discourse.haproxy.org/t/utilising-healthcheck-endpoint-running-on-the-same-machine-as-haproxy/7685
**Category:** Help!
**Created:** [May 25, 2022, 3:43pm UTC](https://discourse.haproxy.org/t/utilising-healthcheck-endpoint-running-on-the-same-machine-as-haproxy/7685 "2022-05-25T15:43:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sonicmouse](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sonicmouse](https://discourse.haproxy.org/u/sonicmouse)
#### Post date: [May 25, 2022, 3:43pm UTC](https://discourse.haproxy.org/t/utilising-healthcheck-endpoint-running-on-the-same-machine-as-haproxy/7685/1 "2022-05-25T15:43:43Z")

</div>

Hey everyone,

TL;DR: Is it possible to make use of a /health endpoint that is running locally on the HAProxy box, when doing health checks for a back-end? I know that we can specify a health-checking endpoint running on the remote server, e.g.:

```auto
backend myserver
option httpchk
http-check send meth GET uri /health
http-check expect status 200
http-check expect string GOOD

```

But, would it be possible to use a /health endpoint that is not running on that backend server in the health evaluation process, but instead locally (or somewhere completely different)? i.e.:

```auto
backend myserver
option httpchk
http-check send meth GET uri **localhost:8001** /health
http-check expect status 200
http-check expect string GOOD

```

I wrote a pretty involved health-checker that I meant to have running on each HAProxy box, that itself would continuously monitor, and steer backend-resources, under the assumption that I could make use of a /health endpoint elsewhere than running on the backend in question. I would prefer not to do a whole redesign and run the services on the backends themselves, so I’d greatly appreciate any and all input here.

Cheers

---

<div class="post-metadata">

### Author: ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)
#### Post date: [May 25, 2022, 4:03pm UTC](https://discourse.haproxy.org/t/utilising-healthcheck-endpoint-running-on-the-same-machine-as-haproxy/7685/2 "2022-05-25T16:03:27Z")

</div>

In this case I suggest you switch from regular health checks to agent-checks.

[https://cbonte.github.io/haproxy-dconv/2.4/configuration.html#5.2-agent-check](https://cbonte.github.io/haproxy-dconv/2.4/configuration.html#5.2-agent-check)

---

<div class="post-metadata">

### Author: ![sonicmouse](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sonicmouse](https://discourse.haproxy.org/u/sonicmouse)
#### Post date: [May 25, 2022, 4:14pm UTC](https://discourse.haproxy.org/t/utilising-healthcheck-endpoint-running-on-the-same-machine-as-haproxy/7685/3 "2022-05-25T16:14:18Z")

</div>

Interesting, I wasn’t aware of this functionality. Are agent-checks available with standard HAProxy, too, or HAPEE only?

Furthermore, do agent-checks exclude regular health-checks - i.e., can I use both an agent-check, and a standard health checker (expecting 200, status GOOD e.g.)?

I am actually using HAProxy as more of a failover machine, rather than a load-balancer. I want to switch backends depending on some logic that I’m performing on the same machine, and hence my problem here.

Thank you!

---

<div class="post-metadata">

### Author: ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)
#### Post date: [May 25, 2022, 4:17pm UTC](https://discourse.haproxy.org/t/utilising-healthcheck-endpoint-running-on-the-same-machine-as-haproxy/7685/4 "2022-05-25T16:17:42Z")

</div>

Opensource Haproxy. I don’t know anything about HAPEE.

You can do both or only agent-checks, whatever you prefer. I suggest you read the documentation that I linked above.
