Giter Club home page Giter Club logo

httptest's Introduction

httptest 测试http/https get请求

命令行:

httptest  [ -d ] [ -4 ] [ -6 ] [ -p ] [ -i prefix ] [ -w wait_time ] [ -r check_string ] url

    -d               print debug message
    -4               force ipv4
    -6               force ipv6
    -p               print response content
    -i prefix        influxdb output
    -w wait_time     max conntion time
    -r check_string  check_string

注意,最多下载4MB字节。

程序退出值:

0 如果获取到200应答,并且返回的内容中有check_string
1 DNS查询错误
2 TCP连接建立错误
3 读应答错误
4 非200应答
5 提供了check_string, 但是应答中无check_string
8 命令行错误
9 https协商错误
10 url错误

stdout输出

退出值 DNS解析时间 TCP连接时间 第一次应答时间 传输时间 传输字节 传输速度 URL

第1个参数是整数,第2-5个参数单位是秒,第6个参数单位是字节,最后1个参数单位是 字节/秒

运行测试:

# ./httptest -w 2 https://www.sjtu.edu.cn/
0 0.0109 0.0093 0.0322 0.0375 74006 1972652 https://www.sjtu.edu.cn/
# ./httptest -w 2 https://www.pku.edu.cn/
0 0.0007 0.0257 0.0811 0.0780 63863 819229 https://www.pku.edu.cn/
# ./httptest -w 2 https://www.ustc.edu.cn/
0 0.0008 0.0003 0.0066 0.0008 27392 35163028 https://www.ustc.edu.cn/

直接送influxdb

如果提供了 -i prefix,直接输出influxdb友好,可以直接使用curl交给influxdb,如下所示:

while ture; do
	curl -i -XPOST "http://202.38.*.*:8086/write?db=db&u=user&p=password" --data-binary "$(./httptest -w 2 -i www,host=www.pku.edu.cn https://www.pku.edu.cn/)"
	curl -i -XPOST "http://202.38.*.*:8086/write?db=db&u=user&p=password" --data-binary "$(./httptest -w 2 -i www,host=www.ustc.edu.cn https://www.ustc.edu.cn/)"
	sleep 60
done

httptest's People

Contributors

bg6cq avatar findyy99 avatar kndylau avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.