Chinaunix首页 | 论坛 | 博客
  • 博客访问: 9262340
  • 博文数量: 1669
  • 博客积分: 16831
  • 博客等级: 上将
  • 技术积分: 12594
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-25 07:23
个人简介

柔中带刚,刚中带柔,淫荡中富含柔和,刚猛中荡漾风骚,无坚不摧,无孔不入!

文章分类

全部博文(1669)

文章存档

2023年(4)

2022年(1)

2021年(10)

2020年(24)

2019年(4)

2018年(19)

2017年(66)

2016年(60)

2015年(49)

2014年(201)

2013年(221)

2012年(638)

2011年(372)

分类:

2012-11-05 11:30:48

curl监控站点响应时间  

2012-11-04 21:34:04|  分类: rhel_监控 |  标签: |字号 

curl监控站点响应时间  

2012-05-02 16:40:02|  分类: shell|字号 

1、开启gzip请求
curl -I -H Accept-Encoding:gzip,defalte

2、监控网页的响应时间
curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" ""

3. 监控站点可用性
curl -o /dev/null -s -w %{http_code} ""

4、以http1.0协议请求(默认为http1.1)
curl -0 ..............


监控站点首页下载时间:

curl -o /dev/null -s -w ‘%{time_total}’

curl -o /dev/null -s -w ‘%{http_code}’

curl -o /dev/null -s -w %{http_code}:%{time_connect}:%{time_starttransfer}:%{time_total}

结果:2.547

-s 静默输出;没有-s的话就是下面的情况,这是在脚本等情况下不需要的信息。

[ec2-user@ip-10-122-250-19 ~]$ curl -o /dev/null  -w ‘%{time_total}’
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 67770    0 67770    0     0  19228      0 –:–:–  0:00:03 –:–:– 20705
结果:3.524

监控首页各项时间指标:

curl -o /dev/null -s -w ‘%{time_connect}:%{time_starttransfer}:%{time_total}’

结果:                                                0.244:                             1.044:                         2.672

时间指标解释 :

time_connect    建立到服务器的 TCP 连接所用的时间

time_starttransfer    在发出请求之后,Web 服务器返回数据的第一个字节所用的时间

time_total   完成请求所用的时间

在 发出请求之后,Web 服务器处理请求并开始发回数据所用的时间是

(time_starttransfer)1.044 - (time_connect)0.244 = 0.8 秒

客户机从服务器下载数据所用的时间是

(time_total)2.672 - (time_starttransfer)1.044 = 1.682 秒

指定特定主机IP地址访问网站

curl -x 61.135.169.105:80

curl -x 61.135.169.125:80 

 

curl用法大全

-x 指定访问IP与端口号

curl -x 192.168.1.1:80  

-I 仅仅取文件的http头部

curl   -I  -x 192.168.1.1:80  

用referer做的防盗链,就可以使用-e来设置

curl -e “http://www.qiecuo.org”    http:// -v  -I

-H去构造你想要的http头部

curl -H “X-Forward-For:8.8.8.8″  -v  -I

curl反馈时间,例如连接时间,下载时间等信息

curl -w %{time_connect}:%{time_starttransfer}:%{time_total} -s -o /dev/null

将一个文件保存到硬盘上,命名为file.html

curl -o file.html  /index.html

下载index.html文件, -O是大写的字母

curl -O /index.html

curl提交用户名和密码

curl http://name:passwd@
curl -u name:passwd

-b “cookie” 此参数用来构造一个携带cookie的请求

阅读(1092) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~