Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: HAProxy agent check mode #1840

Open
joshuaboniface opened this issue Feb 9, 2021 · 1 comment
Open

Feature: HAProxy agent check mode #1840

joshuaboniface opened this issue Feb 9, 2021 · 1 comment

Comments

@joshuaboniface
Copy link

joshuaboniface commented Feb 9, 2021

About 2-and-a-half years ago I wrote a blog post detailing how I was able to use the HAProxy agent-check feature to avoid DOWN Patroni hosts, instead putting them into MAINT mode on a read/write backend when not primary. This is very useful if you are, for instance, monitoring for HAProxy DOWN hosts for alerting or such, as otherwise 2/3 (or more) of your read/write backends would always report DOWN.

The script I describe there has served me well, but it's very hacky. It would be nice to have this integrated into the existing Web API (port 8008). In short, it would be an endpoint at a separate port that would return either READY on a write-accepting replica, or MAINT on a write-denying secondary. The API already works mostly like this in terms of detecting up/down hosts with the 200/503 status codes, but the key point of the agent-check is that the remote side is actively specifying the maintenance mode state in textual form regardless of status code.

The HAProxy documentation for reference: https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#5.2-agent-check

@CyberDem0n
Copy link
Collaborator

Hi @joshuaboniface,

Indeed, the feature is interesting, but agent-check makes a TCP connection to the configured port and only reads data from there without sending anything. Hence, it is not possible to serve it via the existing REST API port.
Running it on a separate port requires starting yet another thread and creating yet another port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants