Hi all,

I'd be very pleased if someone can give a try to this patch and give me some
feedbacks. I started to write it more than a month ago and couldn't find time
to finalize it. Now it is :-)

Willy, I've refactored the session structure to reduce the memory footprint of
this command, let me know if it's ok for you.

I successfully used it on a small server for about a month without any issue
(in a slightly different version). But as each configuration can bring its own
bugs, I wish it can be tested on various ones before being merged.

I'll try to work on the documentation by the end of the week. Here is a short
description of how to use it :

Syntax :
show conds [clear] [<proxy id> [<cond id> [<suite id> [<term id>]]]]

Those ids follow haproxy internals, where :
- "term" : can be compared to an acl in the configuration (named or anonymous)
- "suite" : a suite is a list of terms separed by "AND" operators, each "OR"
  begins a new suite.
- "cond" : is the whole condition (if or unless)

Example :
acl missing_cl hdr_cnt(Content-length) eq 0
block if HTTP_URL_STAR !METH_OPTIONS || METH_POST missing_cl
         |---term1---| |---term2---|    |-term1-| |--term2-|
         |---------suite1----------|    |------suite2------|
      |-----------------------cond1------------------------|

Usage :
"show conds" :
  will display every statistics.

"show conds 1" :
  will only display the statistics of the proxy #1.

"show conds 1 1" :
  will only display the first condition of the proxy #1, with the detailed
  statistics of each terms.

"show conds 1 1 2" :
  will only display the terms of the second suite.

"show conds 1 1 0" :
  This is a special case to only display the condition statistics, without its
  terms details.

"show conds 1 1 2 2" :
  Used to extract only a specific term.

By preceeding those ids by the keyword "clear", the counters that matched are
reset to 0 after being displayed.

The output is in CSV format.
Using the previous example, this will give something like :
pct,pass,fail,path,detail
,,,1-0-0-0,[PROXY test (#1) h5.cfg]
0.00,0,0,1-1-0-0,[IF line 6]
0.00,0,0,1-1-1-1,HTTP_URL_STAR
0.00,0,0,1-1-1-2,!METH_OPTIONS
,,,1-1-2-0,[OR]
0.00,0,0,1-1-2-1,METH_POST
0.00,0,0,1-1-2-2,missing_cl

(and for readability)
pct   pass  fail  path     detail
                  1-0-0-0  [PROXY test (#1) h5.cfg]
0.00  0     0     1-1-0-0  [IF line 6]
0.00  0     0     1-1-1-1  HTTP_URL_STAR
0.00  0     0     1-1-1-2  !METH_OPTIONS
                  1-1-2-0  [OR]
0.00  0     0     1-1-2-1  METH_POST
0.00  0     0     1-1-2-2  missing_cl

I hope it's clear enough for a first approach ;-)

-- 
Cyril Bonté

Reply via email to