linux網路管理命令-httpstat
阿新 • • 發佈:2018-12-11
說明
httpstat 是一個 Python 指令碼,它以美妙妥善的方式反映了 curl 統計分析,它是一個單一指令碼,相容 Python 3 ,在使用者的系統上不需要安裝額外的軟體(依賴)。
從本質上來說它是一個 cURL 工具的封裝,意味著你可以在 URL 後使用幾個有效的 cURL 選項,但是不包括-w
、 -D
、 -o
、 -s
和 -S
選項,這些已經被 httpstat 使用了。
安裝:
wget -c https://raw.githubusercontent.com/reorx/httpstat/master/httpstat.py
or
pip install httpstat
引數詳解
python httpstat.py Usage: httpstat URL [CURL_OPTIONS] httpstat -h | --help httpstat --version Arguments: URL url to request, could be with or without `http(s)://` prefix Options: CURL_OPTIONS any curl supported options, except for -w -D -o -S -s, which are already used internally. -h --help show this screen. --version show version. Environments: HTTPSTAT_SHOW_BODY Set to `true` to show response body in the output, note that body length is limited to 1023 bytes, will be truncated if exceeds. Default is `false`. HTTPSTAT_SHOW_IP By default httpstat shows remote and local IP/port address. Set to `false` to disable this feature. Default is `true`. HTTPSTAT_SHOW_SPEED Set to `true` to show download and upload speed. Default is `false`. HTTPSTAT_SAVE_BODY By default httpstat stores body in a tmp file, set to `false` to disable this feature. Default is `true` HTTPSTAT_CURL_BIN Indicate the curl bin path to use. Default is `curl` from current shell $PATH. HTTPSTAT_DEBUG Set to `true` to see debugging logs. Default is `false`
案例
python httpstat.py https://blog.geekyu.cn Connected to 47.99.104.222:443 from 10.0.0.87:55948 HTTP/1.1 200 OK Server: nginx Date: Tue, 25 Sep 2018 08:31:34 GMT Content-Type: text/html Content-Length: 9852 Last-Modified: Fri, 21 Sep 2018 07:21:24 GMT Connection: keep-alive Vary: Accept-Encoding ETag: "5ba49bf4-267c" Accept-Ranges: bytes Body stored in: /tmp/tmpGu2f2A DNS Lookup TCP Connection TLS Handshake Server Processing Content Transfer [ 66ms | 48ms | 186ms | 37ms | 0ms ] | | | | | namelookup:66ms | | | | connect:114ms | | | pretransfer:300ms | | starttransfer:337ms | total:337ms
主要關注一下Server Processing ,如果該值過大,就要優化你網站伺服器來加速訪問速度。