Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Last active March 14, 2023 23:50
Show Gist options
  • Select an option

  • Save kwilczynski/2293506 to your computer and use it in GitHub Desktop.

Select an option

Save kwilczynski/2293506 to your computer and use it in GitHub Desktop.
Use extra metrics output with cURL
fetch_with_curl() {
local url=$1
local timeout=${2:-10}
url="$url?q=$(date +'%s')"
curl -s -w "%{http_code} %{speed_download} %{size_download} %{time_namelookup} %{time_connect} %{time_total}\n" \
-H "Pragma: no-cache" -H "Cache-Control: no-cache" -H "Expires: 0" \
-o /dev/null --connect-timeout $timeout $url
}
while :; do echo $(date -R ; fetch_with_curl http://10.36.1.2:7500/dev61/usage | tee -a dev61 ) ; sleep 1 ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment