Agent check with agent-send to a bash script


I’ve been using http checks with HAProxy with the option httpcheck send-state which is very useful to pass the backend/server names, the node name…

I’d like to move to an agent-check to better control the load-balancing but I have trouble understanding how I could pass some data from HAProxy to the agent.
I’ve seen that agent-send is a low-level working solution from HAProxy’s perspective.
I have a working agent written in bash, but I don’t understand how to read the data passed by agent-send.

Anyone have already done this ?