9qh1_q
Last Updated: December 01, 2018
·
3.295K
· errordeveloper

Measure HTTP response times with cURL and store it on Cosm

Here is a nice and simple way of measuring HTTP response of a given web site and storing the results on Cosm database. You should get some nice graphs after running this for some time as a cron job.

#!/bin/bash

MY_SITE='https://google.com'
API_KEY='<Your Cosm API key>'
FEED_ID='<Your Cosm feed ID>' 

#EXTRA_FLAGS='--verbose --location'

response_test () {

  ## See curl(1) for description of the variables
  format='dns_lookup_time,%{time_namelookup}\nconnect_time,%{time_connect}\nssl_handshake_time,%{time_appconnect}\npretransfer_time,%{time_pretransfer}\nstart_transfer_time,%{time_starttransfer}\ntotal_time,%{time_total}\nuploaded_bytes,%{size_upload}\nupload_speed,%{speed_upload}\ndownloaded_bytes,%{size_download}\ndownload_speed,%{speed_download}'
  common='--silent'

  curl $1 $common --output /dev/null $EXTRA_FLAGS --write-out $format \
   | curl $common --data-binary @- \
     -X 'PUT' \
     -H 'Host: api.cosm.com' \
     -H "X-ApiKey: $3" \
     https://api.coms.com/v2/feeds/$2.csv
}

response_test $MY_SITE $FEED_ID $API_KEY

Of coure, you can improve this to actually send some payload to your site and not google.com!

1 Response
Add your response

31340

In order to know play fireboy and watergirl free online games as here we are having one of the best portal http://fireboywatergirl.me which will let you enjoy these games in the best quality at different amazing levels also you will be able to learn new thing by playing these games as these games are of latest technology games.

about 1 month ago ·
Filed Under