tcprstat工具安装与使用

               

author:skate
time:2013/01/11


tcprstat工具安装与使用

tcprstat是免费开源tcp分析工具,通过监控网络传输来统计分析请求的响应时间


使用方法:
tcprstat是安装在server端,统计分析本地网卡地址请求的响应时间,可以用于临时分析,也可定时任务做信息收集


下载
# wget http://github.com/downloads/Lowercases/tcprstat/tcprstat-static.v0.3.1.x86_64
# cp tcprstat-static.v0.3.1.x86_64 tcprstat
# chmod a+x tcprstat

tcprstat在bonding的网卡下有点问题

[root@localhost oradisk]# ifconfig
bond0     Link encap:Ethernet  HWaddr 90:B1:1C:20:C4:32 
          inet addr:172.16.100.87  Bcast:172.16.100.255  Mask:255.255.255.0
          inet6 addr: fe80::92b1:1cff:fe20:c432/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:1045751465 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1049414338 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:143835655125 (133.9 GiB)  TX bytes:405336708220 (377.4 GiB)

em1       Link encap:Ethernet  HWaddr 90:B1:1C:20:C4:32 
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:395396 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:28185234 (26.8 MiB)  TX bytes:4634 (4.5 KiB)
          Interrupt:35
......

# ./tcprstat -p 1588 -t 1 -n 0
pcap: SIOCGIFFLAGS: bonding_masters: No such device

 

指定确定ip地址可以避免上面的错误

[root@localhost oradisk]# ./tcprstat -p 1588 -t 1 -n 0 -l 172.16.100.87
timestamp       count   max     min     avg     med     stddev  95_max  95_avg  95_std  99_max  99_avg  99_std
1357885445      256     73120   67      746     245     4607    995     349     285     3107    399     405
1357885446      256     2610    84      365     255     317     846     330     266     906     351     281
1357885446    36      968     127     370     278     287     900     336     259     908     353     272

还可以通过如下的方式,不过是统计分析机器的所有ip地址
# ./tcprstat -p 1588 -t 1 -n 0 -l `/sbin/ifconfig | grep 'addr:[^ ]\+' -o | cut -f 2 -d : | xargs echo | sed -e 's/ /,/g'`

如下是一台生产数据库的响应时间
[root@skate01 oradisk]# ./tcprstat -p 1588 -t 1 -n 0 -l `/sbin/ifconfig | grep 'addr:[^ ]\+' -o | cut -f 2 -d : | xargs echo | sed -e 's/ /,/g'`
timestamp       count   max     min     avg     med     stddev  95_max  95_avg  95_std  99_max  99_avg  99_std
1357886048      5840    26133   54      240     163     500     664     184     101     1411    214     183
1357886049      6003    3405    57      227     164     242     660     182     96      1296    211     173
1357886050      6376    27322   29      269     168     689     724     194     117     1643    226     196
1357886051      6524    20489   58      225     167     330     613     182     92      1168    208     160
1357886052      6123    33313   52      231     165     497     627     181     94      1213    209     164
1357886053      6991    66977   55      221     167     822     525     176     80      1120    199     140
1357886054      5876    11483   57      234     162     427     610     177     89      1195    204     160
1357886055      6166    189134  30      526     187     3085    1265    245     202     6366    342     561
1357886056      5678    5913    52      210     161     218     553     172     81      1100    196     142

参考:http://www.percona.com/docs/wiki/tcprstat:start

---end---

           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

猜你喜欢

转载自blog.csdn.net/ffuygggh/article/details/86777079