On Tue, Jun 21, 2016 at 07:14:49PM +0200, Dariusz Suchojad wrote: > On 21/06/16 19:02, Willy Tarreau wrote: > > Coudln't you instead pass the admin request to an agent in charge for > > doing all of this stuff ? It would seem safer and more durable to me. > > Indeed this is what is going on right now, the agent mediates all access > to HAProxy and covers all needs. It's just that it is a component that > could be possibly done away with. > > You know how it is, one creates an agent but then it needs user > documentation since it requires a TCP socket and there is proper > testing, TLS material rotation required etc. so maintenance costs are > increased, slightly but still.
Yes I clearly see what you mean. > I have supplementary question. > > I'm not familiar with HAProxy internals but I picture that there is a > core process that deals with requests and that this main process has an > API for its own use, i.e. a set of structures and functions that > actually handle requests. It's a bit more complex than that but yes that's roughly the idea. > So, when program control is redirected to Lua, does Lua receive a handle > to that main server object? There's no such server object here. What happens is that some low-level operations can be written in Lua and called form the main processing. For example you can create HTTP actions in Lua which are then called as part of the various HTTP rules. > The point being, I could possibly just call > HAProxy's own functions, for instance to return statistics to Lua which > would reformat them into the output format required. The Lua has access to a part of haproxy's internals. Thierry has done a great job on this. You definitely want to look at doc/lua.txt and doc/lua-api/index.rst, they are very complete. Lua for example has access to the stats data so Thierry was able to reimplement the stats page and a stats aggregator in full Lua. Don't ask me who it's done, it's far beyond my skills but you have some information here : http://www.arpalert.org/haproxy-scripts.html Hoping this helps, Willy

