HAProxy json-rpc healthcheck - need help with my example
-
Hi:
I'm using a Netgate 6100I'm trying to get a health check to work on haproxy for my backend - it's accepted as valid but not getting the expected result back.
my backends run on port 8545 (this is what i'm forwarding to)
the same port has an rpc interface of which i can do the health check.locally on the server i can run this (and externally):
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://localhost:8545/ -H "Content-Type: application/json"
and it responds with
{"jsonrpc":"2.0","id":1,"result":false}
if the result is "false" it means it's "up" and ready to serve.
In my backend advanced passthru for the backed I have tried this, which is "accepted" as correct format however it shows my server is down (expected response back isn't correct).
option httpchk POST / HTTP/1.1 http-check send hdr Content-Type application/json body {"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1} http-check expect string false
How can I debug this or can anyone help ?
Thanks in advance
note: a normal basic health check works, however this only shows the service is running, not that it is in a "ready state".
-
Happy to pay the going rate for support for this.
-
@andyc23
I solved this by having this in the advanced pass through.
Hope it helps someone else:option httpchk POST / HTTP/1.1\r\nHost:\ haproxyservices\r\nContent-Type:\ application/json\r\nContent-Length:\ 76\r\n\r\n"{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}" http-check expect string false
I do get a warning though >
[WARNING] 185/013305 (92736) : parsing [/var/etc/haproxy/haproxy.cfg:132]: 'option httpchk' : hiding headers or body at the end of the version string is deprecated. Please, consider to use 'http-check send' directive instead.
not sure if important.
-
This post is deleted! -
@andyc23 said in HAProxy json-rpc healthcheck - need help with my example:
@andyc23
I solved this by having this in the advanced pass through.
Hope it helps someone else:option httpchk POST / HTTP/1.1\r\nHost:\ haproxyservices\r\nContent-Type:\ application/json\r\nContent-Length:\ 76\r\n\r\n"{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}" http-check expect string false
I do get a warning though >
[WARNING] 185/013305 (92736) : parsing [/var/etc/haproxy/haproxy.cfg:132]: 'option httpchk' : hiding headers or body at the end of the version string is deprecated. Please, consider to use 'http-check send' directive instead.
not sure if important.
Sorry for bumping this old thread.
I had everything working as above, but now, since i've updated haproxy -
i now get this issue:
[ALERT] (50668) : config : parsing [/var/etc/haproxy_test/haproxy.cfg:181] : 'option httpchk' : hiding headers or body at the end of the version string is unsupported.Use 'http-check send' directive instead..
i've tried:
http-check send meth POST uri / ver HTTP/1.1 hdr Host haproxyservices hdr Content-Type application/json hdr Content-Length 60 body "{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}"
http-check expect string falseanyone able to help me set the correct backend passthru?