Two ways of Use: 1) Direct online acquisition of the machine, 2) analysis of the tcpdump collected offline Pcap file 1. Local Direct Online acquisition parameters:-P: Specify only the request to capture this TCP port-T: The time interval of the acquisition output, the default is 10-n: Specify the number of output printing, the default is 1, print only 1 times, if specified as 0 for an unlimited (ctr+c termination) Example one: Specify the MySQL port as 3306, time interval 1S, print the number of times is unlimited.
Tcprstat-l ' hostname-i '-p 3306-t 1-n 0
Timestampcountmaxminavgmedstddev95_max95_avg95_std99_max99_avg99_std
1461747596000000000000
1461747597000000000000
1461747598000000000000
14617475992292201562921362020020200
14617476005320865219736160367883628770176250349024191
146174760139808261096912926885542869063
14617476025159548061417061770617
1461747603000000000000
14617476041010125617829955628955628
14617476051011332657826906021906021
1461747606000000000000
1461747607000000000000
146174760849231608127814923814923
1461747609000000000000
Output field interpretation (only important) 1) Count: The number of requests completed within this interval, representing 1 seconds of processing completed MySQL requests 2) 95%_avg: Within this interval, the average response time of 95% of the request volume, the unit is subtle (1/10^6 seconds); The main reference to this column value, equivalent to the score minus 2.5% "maximum delay", 2.5% "minimum delay" so this value comparison can reflect the MySQL server query average response time value. The first line of this value: 328, which indicates that the 95% query average response time is 328 milliseconds 3) Max: All completed requests within this interval, response time maximum, per millisecond 4) min: all completed requests within this interval, minimum response time of 5) avg: The average of all completed requests, response time in this interval 2 analysis tcpdump collected Pcap file. is sometimes saved to a file by tcpdump capture data, using TCPRSTAT to perform RT analysis of this file, This is often the case where the data files are other machines, so use Tcprstat for the other two parameters:-L and-r-l: Specify the host IP to parse, if multiple can be separated by commas. -r: Specifies PACP files that are crawled using tcpdump. Example two: 1) uses tcpdump to crawl packets: Capture all 3306-port packets on the host (including the destination address is the other host ip:3306) Tcpdump -s 65535 -x -nn -q -tttt -i bond0 host ' Hostname -i ' and port 3306 -c All package source addresses on the 10000 -w /tmp/tcpdump.pcap capture host are either the host ip:3306 or the destination address is the host ip:3306 (only MySQL) tcpdump -s  65535 -X -NN -Q -TTTT -I BOND0 \ (src host ' hostname -i ' and src port 3306 \) or \ (DST host ' hostnAme -i ' and DST port 3306 \) -c 10000 -w /tmp/tcpdump.pcap 2) Use Tcprstat to analyze the packet files collected by tcpdump. tcprstat -l ' Hostname -i ' -p 3306 -t 1 -r /tmp/tcpdump.pcap
How Tcprstat is used