linux下使用httping测试web响应时间
安装httping
yum -y install httping
然后使用:
httping -options
-g url
-h hostname
-p port
-x host:port(如果是测squid,用-x,不要用-h;和curl的不一样,curl -H指定的是发送的hostname,这个-h是指定给DNS解析的hostname)
-c count
-t timeout
-s statuscode
-S 将时间分开成连接和传输两部分显示
-G GET(默认是HEAD)
-b 在使用了GET的前提下显示传输速度KB/s
-B 同-b,不过使用了压缩
-I useragent
-R referer
-C cookie=*
-l SSL
-U username
-P password
-n a,b 提供给nagios监控用的,当平均响应时间>=a时,返回1;>=b,返回2;默认为0
-N c 提供给nagios监控用的,一切正常返回0,否则只要有失败的就返回c
举例如下:
[root@server1 ~]# httping -g http://www.baidu.com -SGbs -c 10
PING www.baidu.com:80 (/):
connected to 220.181.112.244:80 (593 bytes), seq=0 time=375.32+ 5.69+ 6.21+ 19.39+ 0.01=406.62 ms 200 OK 4079KB/s
connected to 220.181.111.188:80 (593 bytes), seq=1 time=385.49+ 5.55+ 6.31+ 23.69+ 0.01=421.05 ms 200 OK 3316KB/s
connected to 220.181.112.244:80 (593 bytes), seq=2 time=368.88+ 5.37+ 5.68+ 13.65+ 0.01=393.58 ms 200 OK 5987KB/s
connected to 220.181.111.188:80 (593 bytes), seq=3 time=371.23+ 5.22+ 5.67+ 24.77+ 0.01=406.88 ms 200 OK 3106KB/s
connected to 220.181.111.188:80 (593 bytes), seq=4 time=378.27+ 5.29+ 5.68+ 14.14+ 0.01=403.38 ms 200 OK 6408KB/s
connected to 220.181.112.244:80 (593 bytes), seq=5 time=381.77+ 5.17+ 5.69+ 18.68+ 0.01=411.32 ms 200 OK 4208KB/s
connected to 220.181.111.188:80 (593 bytes), seq=6 time=386.37+ 5.08+ 5.71+ 21.32+ 0.02=418.48 ms 200 OK 4110KB/s
connected to 220.181.111.188:80 (593 bytes), seq=7 time=389.38+ 5.52+ 5.57+ 18.96+ 0.01=419.44 ms 200 OK 4217KB/s
connected to 220.181.111.188:80 (593 bytes), seq=8 time=403.63+ 5.29+ 5.64+ 24.81+ 0.01=439.37 ms 200 OK 3271KB/s
connected to 220.181.112.244:80 (593 bytes), seq=9 time=389.84+ 5.21+ 5.65+ 19.77+ 0.01=420.46 ms 200 OK 4597KB/s
--- http://www.baidu.com/ ping statistics ---
10 connects, 10 ok, 0.00% failed, time 14142ms
round-trip min/avg/max = 393.6/414.1/439.4 ms
Transfer speed: min/avg/max = 3106.659816/4330.607617/6408.417735 KB
本文出自 “运维之家(Q群:1991706)” 博客,请务必保留此出处http://304076020.blog.51cto.com/7503470/1562511
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。