Reference
show stat
Get statistics that describe traffic flowing through the load balancer.
Description Jump to heading
The show stat
command returns the current values of all statistics metrics. You can format the data as:
- Comma-separated values (CSV)
- Typed
- JSON
CSV format Jump to heading
The command returns data in the CSV format by default. The field names make up the first line:
nix
echo "show stat" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "show stat" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
outputtext
# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,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,last_chk,last_agt,qtime,ctime,rtime,ttime,agent_status,agent_code,agent_duration,check_desc,agent_desc,check_rise,check_fall,check_health,agent_rise,agent_fall,agent_health,addr,cookie,mode,algo,conn_rate,conn_rate_max,conn_tot,intercepted,dcon,dses,wrew,connect,reuse,cache_lookups,cache_hits,srv_icur,src_ilim,qtime_max,ctime_max,rtime_max,ttime_max,eint,idle_conn_cur,safe_conn_cur,used_conn_cur,need_conn_est,fe_main,FRONTEND,,,0,3,5000,3,1735,869,0,0,0,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,2,,,,2,0,2,0,0,0,,0,2,4,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,http,,0,2,3,0,0,0,0,,,0,0,,,,,,,0,,,,,webservers,s1,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,100,1,0,0,0,12210,0,,1,3,1,,0,,2,0,,0,L4OK,,0,0,0,0,0,0,0,,,,0,0,0,,,,,-1,,,0,0,0,0,,,,Layer4 check passed,,2,3,4,,,,127.0.0.1:8080,,http,,,,,,,,0,0,0,,,0,,0,0,0,0,0,0,0,0,0,webservers,s2,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,100,1,0,0,0,12210,0,,1,3,2,,0,,2,0,,0,L4OK,,0,0,0,0,0,0,0,,,,0,0,0,,,,,-1,,,0,0,0,0,,,,Layer4 check passed,,2,3,4,,,,127.0.0.1:8081,,http,,,,,,,,0,0,0,,,0,,0,0,0,0,0,0,0,0,0,webservers,BACKEND,0,0,0,0,500,0,0,0,0,0,,0,0,0,0,UP,200,2,0,,0,12210,0,,1,3,0,,0,,1,0,,0,,,,0,0,0,0,0,0,,,,0,0,0,0,0,0,0,-1,,,0,0,0,0,,,,,,,,,,,,,,http,roundrobin,,,,,,,0,0,0,0,0,,,0,0,0,0,0,,,,,
outputtext
# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,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,last_chk,last_agt,qtime,ctime,rtime,ttime,agent_status,agent_code,agent_duration,check_desc,agent_desc,check_rise,check_fall,check_health,agent_rise,agent_fall,agent_health,addr,cookie,mode,algo,conn_rate,conn_rate_max,conn_tot,intercepted,dcon,dses,wrew,connect,reuse,cache_lookups,cache_hits,srv_icur,src_ilim,qtime_max,ctime_max,rtime_max,ttime_max,eint,idle_conn_cur,safe_conn_cur,used_conn_cur,need_conn_est,fe_main,FRONTEND,,,0,3,5000,3,1735,869,0,0,0,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,2,,,,2,0,2,0,0,0,,0,2,4,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,http,,0,2,3,0,0,0,0,,,0,0,,,,,,,0,,,,,webservers,s1,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,100,1,0,0,0,12210,0,,1,3,1,,0,,2,0,,0,L4OK,,0,0,0,0,0,0,0,,,,0,0,0,,,,,-1,,,0,0,0,0,,,,Layer4 check passed,,2,3,4,,,,127.0.0.1:8080,,http,,,,,,,,0,0,0,,,0,,0,0,0,0,0,0,0,0,0,webservers,s2,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,100,1,0,0,0,12210,0,,1,3,2,,0,,2,0,,0,L4OK,,0,0,0,0,0,0,0,,,,0,0,0,,,,,-1,,,0,0,0,0,,,,Layer4 check passed,,2,3,4,,,,127.0.0.1:8081,,http,,,,,,,,0,0,0,,,0,,0,0,0,0,0,0,0,0,0,webservers,BACKEND,0,0,0,0,500,0,0,0,0,0,,0,0,0,0,UP,200,2,0,,0,12210,0,,1,3,0,,0,,1,0,,0,,,,0,0,0,0,0,0,,,,0,0,0,0,0,0,0,-1,,,0,0,0,0,,,,,,,,,,,,,,http,roundrobin,,,,,,,0,0,0,0,0,,,0,0,0,0,0,,,,,
Each line represents a frontend
, listen
, backend
or server
from your configuration. To see a description of each field, run show stat
with the typed
format and the desc
parameter.
Typed format Jump to heading
Specify the typed
parameter to enable the typed format, wherein each metric is on its own line.
nix
echo "show stat typed" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "show stat typed" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
outputtext
F.2.0.0.pxname.1:KNS:str:fe_mainF.2.0.1.svname.1:KNS:str:FRONTENDF.2.0.4.scur.1:MGP:u32:0F.2.0.5.smax.1:MMP:u32:3F.2.0.6.slim.1:CLP:u32:5000F.2.0.7.stot.1:MCP:u64:3F.2.0.8.bin.1:MCP:u64:1735
outputtext
F.2.0.0.pxname.1:KNS:str:fe_mainF.2.0.1.svname.1:KNS:str:FRONTENDF.2.0.4.scur.1:MGP:u32:0F.2.0.5.smax.1:MMP:u32:3F.2.0.6.slim.1:CLP:u32:5000F.2.0.7.stot.1:MCP:u64:3F.2.0.8.bin.1:MCP:u64:1735
Each line begins with a dot-delimited value (e.g. F.2.0.0.pxname.1
) that has these fields:
- a letter that identifies the proxy type: an F (frontend), B (backend), L (listen), or S (server).
- a number that represents a unique ID for the proxy; This corresponds to the
iid
column in the CSV output. - a number that applies only to server lines and is zero otherwise; It represents the server’s unique ID and corresponds to the
sid
column in the CSV output. - a number that increments for each field in the same group.
- the name of the field (e.g.
pxname
). - the process number, starting at 1.
The rest of the values are separated by colons. They break down as follows:
- three letters that correspond to the field’s origin, nature, and scope of the variable:
Origin
can be M (metric), S (status), K (key), C (config), or P (product).Nature
can be G (gauge), L (limit), m (min), M (max), R (rate), C (counter), D (duration), A(age), T (time), N (name), O (output), or a (average).Scope
can be P (process), S (service), s (system), or C (cluster).
- the field’s type (e.g. str for string and
u32
for unsigned 32-bit integer); - the value itself.
As of version 2.1r1
, you can add the desc
parameter to the command to append a description of each line:
nix
echo "show stat typed desc" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "show stat typed desc" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
outputtext
F.2.0.0.pxname.1:KNS:str:fe_main:"Proxy name"F.2.0.1.svname.1:KNS:str:FRONTEND:"Server name"F.2.0.4.scur.1:MGP:u32:0:"Current number of sessions on the frontend, backend or server"F.2.0.5.smax.1:MMP:u32:3:"Highest value of scur encountered since process started"F.2.0.6.slim.1:CLP:u32:5000:"Frontend/listener/server's maxconn, backend's fullconn"F.2.0.7.stot.1:MCP:u64:3:"Total number of sessions since process started"F.2.0.8.bin.1:MCP:u64:1735:"Total number of request bytes since process started"
outputtext
F.2.0.0.pxname.1:KNS:str:fe_main:"Proxy name"F.2.0.1.svname.1:KNS:str:FRONTEND:"Server name"F.2.0.4.scur.1:MGP:u32:0:"Current number of sessions on the frontend, backend or server"F.2.0.5.smax.1:MMP:u32:3:"Highest value of scur encountered since process started"F.2.0.6.slim.1:CLP:u32:5000:"Frontend/listener/server's maxconn, backend's fullconn"F.2.0.7.stot.1:MCP:u64:3:"Total number of sessions since process started"F.2.0.8.bin.1:MCP:u64:1735:"Total number of request bytes since process started"
JSON format Jump to heading
Specify the json
parameter to enable the JSON format. To make it human-readable, pipe the result to a JSON formatting tool, such as Python’s json.tool
.
nix
echo "show stat json" | \sudo socat stdio tcp4-connect:127.0.0.1:9999 | python3 -m json.tool | less
nix
echo "show stat json" | \sudo socat stdio tcp4-connect:127.0.0.1:9999 | python3 -m json.tool | less
outputjson
[[{"objType": "Frontend","proxyId": 2,"id": 0,"field": {"pos": 0,"name": "pxname"},"processNum": 1,"tags": {"origin": "Key","nature": "Name","scope": "Service"},"value": {"type": "str","value": "fe_main"}},{"objType": "Frontend","proxyId": 2,"id": 0,"field": {"pos": 1,"name": "svname"},"processNum": 1,"tags": {"origin": "Key","nature": "Name","scope": "Service"},"value": {"type": "str","value": "FRONTEND"}},
outputjson
[[{"objType": "Frontend","proxyId": 2,"id": 0,"field": {"pos": 0,"name": "pxname"},"processNum": 1,"tags": {"origin": "Key","nature": "Name","scope": "Service"},"value": {"type": "str","value": "fe_main"}},{"objType": "Frontend","proxyId": 2,"id": 0,"field": {"pos": 1,"name": "svname"},"processNum": 1,"tags": {"origin": "Key","nature": "Name","scope": "Service"},"value": {"type": "str","value": "FRONTEND"}},
The format of the JSON document is described in a schema, which you can get by calling show schema json
.
Filtering Jump to heading
By default, show stat
returns metrics for all proxy sections in your configuration. However, you can add a filter to return only the data that you want to see.
As of version 2.3r1
, you can filter by domain and by server state.
Filter by domain Jump to heading
Use the domain
parameter to limit output to proxy metrics (proxy
) or to DNS resolver metrics (resolvers
). The default is proxy
.
nix
echo "show stat domain resolvers" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "show stat domain resolvers" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
outputtext
# id,pid,sent,send_error,valid,update,cname,cname_error,any_err,nx,timeout,refused,other,invalid,too_big,truncated,outdated,ns1,dnsprod,13691,31,3972,2,0,0,3972,0,0,0,0,0,0,0,0,10.0.2.3,default,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
outputtext
# id,pid,sent,send_error,valid,update,cname,cname_error,any_err,nx,timeout,refused,other,invalid,too_big,truncated,outdated,ns1,dnsprod,13691,31,3972,2,0,0,3972,0,0,0,0,0,0,0,0,10.0.2.3,default,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
Filter by server state Jump to heading
To report on servers based on their check status, specify either up
or no-maint
.
up
Report only on servers that are up or that are not checked. Servers that are down, unresolved, or in maintenance mode are omitted. This option is analogous to the \;up
option on HTTP stats.
no-maint
Omit disabled servers, that is, those that are enabled but down. This option is analogous to the \;no-maint
option on HTTP stats.
Filter by server Jump to heading
Specify three values:
- either the proxy name or its numeric
iid
value - a numeric type: 1 for frontends, 2 for backends, 4 for servers, and -1 for everything. Add these numbers to see multiple types at once.
- A server’s
sid
value or -1.
Below, we show all servers in the backend webservers
by specifying the section’s name followed by 4 for servers and then -1:
nix
echo "show stat webservers 4 -1" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "show stat webservers 4 -1" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
outputtext
# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,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,last_chk,last_agt,qtime,ctime,rtime,ttime,agent_status,agent_code,agent_duration,check_desc,agent_desc,check_rise,check_fall,check_health,agent_rise,agent_fall,agent_health,addr,cookie,mode,algo,conn_rate,conn_rate_max,conn_tot,intercepted,dcon,dses,wrew,connect,reuse,cache_lookups,cache_hits,srv_icur,src_ilim,qtime_max,ctime_max,rtime_max,ttime_max,eint,idle_conn_cur,safe_conn_cur,used_conn_cur,need_conn_est,webservers,server1,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,100,1,0,0,0,14207,0,,1,3,1,,0,,2,0,,0,L4OK,,0,0,0,0,0,0,0,,,,0,0,0,,,,,-1,,,0,0,0,0,,,,Layer4 check passed,,2,3,4,,,,127.0.0.1:8080,,http,,,,,,,,0,0,0,,,0,,0,0,0,0,0,0,0,0,0,webservers,server2,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,100,1,0,0,0,14207,0,,1,3,2,,0,,2,0,,0,L4OK,,0,0,0,0,0,0,0,,,,0,0,0,,,,,-1,,,0,0,0,0,,,,Layer4 check passed,,2,3,4,,,,127.0.0.1:8081,,http,,,,,,,,0,0,0,,,0,,0,0,0,0,0,0,0,0,0,
outputtext
# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,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,last_chk,last_agt,qtime,ctime,rtime,ttime,agent_status,agent_code,agent_duration,check_desc,agent_desc,check_rise,check_fall,check_health,agent_rise,agent_fall,agent_health,addr,cookie,mode,algo,conn_rate,conn_rate_max,conn_tot,intercepted,dcon,dses,wrew,connect,reuse,cache_lookups,cache_hits,srv_icur,src_ilim,qtime_max,ctime_max,rtime_max,ttime_max,eint,idle_conn_cur,safe_conn_cur,used_conn_cur,need_conn_est,webservers,server1,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,100,1,0,0,0,14207,0,,1,3,1,,0,,2,0,,0,L4OK,,0,0,0,0,0,0,0,,,,0,0,0,,,,,-1,,,0,0,0,0,,,,Layer4 check passed,,2,3,4,,,,127.0.0.1:8080,,http,,,,,,,,0,0,0,,,0,,0,0,0,0,0,0,0,0,0,webservers,server2,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,100,1,0,0,0,14207,0,,1,3,2,,0,,2,0,,0,L4OK,,0,0,0,0,0,0,0,,,,0,0,0,,,,,-1,,,0,0,0,0,,,,Layer4 check passed,,2,3,4,,,,127.0.0.1:8081,,http,,,,,,,,0,0,0,,,0,,0,0,0,0,0,0,0,0,0,
Examples Jump to heading
In the example below, we get the current values for statistics in the standard CSV format. Then, we pipe the results to the cut
and column
commands to display only the proxy and server name, the number of retries, the status, the number of 4xx and 5xx HTTP error responses, the request rate, and the average response time.
nix
echo "show stat" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "show stat" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
outputtext
# pxname svname wretr status hrsp_4xx hrsp_5xx req_rate rtimewebservers s1 0 UP 0 0 0webservers s2 0 UP 0 0 0
outputtext
# pxname svname wretr status hrsp_4xx hrsp_5xx req_rate rtimewebservers s1 0 UP 0 0 0webservers s2 0 UP 0 0 0
Add the watch
command to update these numbers every two seconds:
nix
watch 'echo "show stat" | \sudo socat stdio tcp4-connect:127.0.0.1:9999 | cut -d "," -f 1-2,16,18,43,44,47,61 | column -s, -t'
nix
watch 'echo "show stat" | \sudo socat stdio tcp4-connect:127.0.0.1:9999 | cut -d "," -f 1-2,16,18,43,44,47,61 | column -s, -t'
See also Jump to heading
Do you have any suggestions on how we can improve the content of this page?