diff options
author | Willy Tarreau <w@1wt.eu> | 2014-06-16 16:40:14 +0200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2014-06-16 18:20:26 +0200 |
commit | a28df3e19aedef068a3daf581e4afb98d20de15c (patch) | |
tree | 002cbd254ab01e8b84160af6209e834877acd516 | |
parent | a3310dc66c03fe5f54b2058c87b6497f239c1ff4 (diff) | |
download | haproxy-a28df3e19aedef068a3daf581e4afb98d20de15c.tar.gz |
MEDIUM: stats: report the last check and last agent's output on the CSV status
Now that we can quote unsafe string, it becomes possible to dump the health
check responses on the CSV page as well. The two new fields are "last_chk"
and "last_agt".
-rw-r--r-- | doc/configuration.txt | 2 | ||||
-rw-r--r-- | src/dumpstats.c | 18 |
2 files changed, 13 insertions, 7 deletions
diff --git a/doc/configuration.txt b/doc/configuration.txt index 7b50803e0..36a19b8ba 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -13009,6 +13009,8 @@ use hard-coded column positions. 53. comp_byp: number of bytes that bypassed the HTTP compressor (CPU/BW limit) 54. comp_rsp: number of HTTP responses that were compressed 55. lastsess: number of seconds since last session assigned to server/backend + 56. last_chk: last health check contents or textual error + 57. last_agt: last agent check contents or textual error 9.2. Unix Socket commands diff --git a/src/dumpstats.c b/src/dumpstats.c index 7c2170149..1711ac77b 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -489,7 +489,7 @@ static void stats_dump_csv_header() "hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail," "req_rate,req_rate_max,req_tot," "cli_abrt,srv_abrt," - "comp_in,comp_out,comp_byp,comp_rsp,lastsess," + "comp_in,comp_out,comp_byp,comp_rsp,lastsess,last_chk,last_agt," "\n"); } @@ -2743,8 +2743,8 @@ static int stats_dump_fe_stats(struct stream_interface *si, struct proxy *px) chunk_appendf(&trash, "%lld,", px->fe_counters.p.http.comp_rsp); - /* lastsess */ - chunk_appendf(&trash, ","); + /* lastsess, last_chk, last_agt, */ + chunk_appendf(&trash, ",,,"); /* finish with EOL */ chunk_appendf(&trash, "\n"); @@ -2867,8 +2867,8 @@ static int stats_dump_li_stats(struct stream_interface *si, struct proxy *px, st ",," /* compression: in, out, bypassed, comp_rsp */ ",,,," - /* lastsess */ - "," + /* lastsess, last_chk, last_agt, */ + ",,," "\n", px->id, l->name, l->nbconn, l->counters->conn_max, @@ -3293,6 +3293,10 @@ static int stats_dump_sv_stats(struct stream_interface *si, struct proxy *px, in /* lastsess */ chunk_appendf(&trash, "%d,", srv_lastsession(sv)); + /* capture of last check and agent statuses */ + chunk_appendf(&trash, "%s,", ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) ? cstr(sv->check.desc) : ""); + chunk_appendf(&trash, "%s,", ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) ? cstr(sv->agent.desc) : ""); + /* finish with EOL */ chunk_appendf(&trash, "\n"); } @@ -3523,8 +3527,8 @@ static int stats_dump_be_stats(struct stream_interface *si, struct proxy *px, in /* compression: comp_rsp */ chunk_appendf(&trash, "%lld,", px->be_counters.p.http.comp_rsp); - /* lastsess */ - chunk_appendf(&trash, "%d,", be_lastsession(px)); + /* lastsess, last_chk, last_agt, */ + chunk_appendf(&trash, "%d,,,", be_lastsession(px)); /* finish with EOL */ chunk_appendf(&trash, "\n"); |