linux network management command httpstat


httpstat is a python script, which reflects curl statistical analysis in a wonderful and proper way. It is a single script, compatible with Python 3, and does not need to install additional software (dependency) on the user's system.
In essence, it is an encapsulation of cURL tool, which means you can use several valid cURL options after the URL, but excluding - w, - D, - o, - s and - s options, which have been used by httpstat.


wget -c
pip install httpstat

Parameter detailed explanation

Usage: httpstat URL [CURL_OPTIONS]
       httpstat -h | --help
       httpstat --version

  URL     url to request, could be with or without `http(s)://` prefix

  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.

  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`


Connected to from

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            |

Focus on Server Processing. If the value is too large, optimize your website server to speed up the access speed.

Keywords: curl Python pip shell

Added by Twentyoneth on Wed, 25 Dec 2019 19:07:08 +0200