1-- get some information about the test being run from an external file
2-- so we can modify ourselves.
3local config = dofile("/tmp/proxyustats.lua")
4
5local idx = 1
6
7function mcp_config_pools(old)
8    mcp.backend_read_timeout(4)
9    mcp.backend_connect_timeout(5)
10    local pfx, f, l = string.match(config, "(%S+)%s*(%S+)%s*(%S+)")
11    if pfx == "mask1" then
12        mcp.add_stat(1, "maska")
13        mcp.add_stat(2, "maskb")
14    elseif pfx == "mask2" then
15        mcp.add_stat(1, "")
16        mcp.add_stat(2, "maskb")
17    else
18        local first = tonumber(f)
19        local last = tonumber(l)
20        while first <= last do
21            mcp.add_stat(first, pfx .. first)
22            first = first + 1
23        end
24    end
25
26    return {}
27end
28
29function route_fn(zones)
30    return function(r)
31        local key = r:key()
32        mcp.stat(math.abs(tonumber(key)), tonumber(key))
33        return "HD\r\n"
34    end
35end
36
37function mcp_config_routes(zones)
38    mcp.attach(mcp.CMD_MG, route_fn(zones))
39end
40