獲取http返回碼:
curl -w "%{http_code}\n" https://www.baidu.com -s -o /dev/null
-w 指定獲取的參數
-s 不顯示傳輸進度 比如這種 ##########100%
-o 輸出到哪里
監控網站響應時間:
curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\ntime_connect}\n" "https://www.baidu.com"
| 參數 |
含義 |
|
| time_namelookup |
DNS解析域名時間 |
|
| time_connect |
TCP連接的時間,三次握手的時間 |
|
| time_starttransfer |
從請求開始到第一個字節將要傳輸的時間 |
|
| time_total |
總時間 |
|
| speed_download |
下載速度,單位-字節每秒 |
|
| time_appconnect |
SSL|SSH等上層連接建立的時間 |
|
| time_pretransfer |
從請求開始到響應開始傳輸的時間 |
|
| time_redirect |
從開始到最后一個請求事務的時間 |
|
| time_namelookup |
DNS解析域名時間,把域名--->ipd的時間 |
