Created
July 5, 2016 01:48
-
-
Save gardner/7c9b8aa0bd03ccbd4f03ac3122e60f6c to your computer and use it in GitHub Desktop.
monitor url with curl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This creates a CSV file that can be uploaded to Google Docs where you can insert a chart to graph the values | |
LOG_FILE=/var/log/url_monitor.log | |
if [ ! -f $LOG_FILE ]; then # add CSV column headers | |
echo Date,Total Time,Redirect Time,DNS Lookup,Connect,App Connect,Pretransfer,starttransfer,Status Code > $LOG_FILE | |
fi | |
/usr/bin/curl -L -w "$(date),%{time_total},%{time_redirect},%{time_namelookup},%{time_connect},%{time_appconnect},%{time_pretransfer},%{time_starttransfer},%{http_code}\n" -o /dev/null -s "https://example.com/monitor" >> $LOG_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment