Coder Social home page Coder Social logo

mycurl's Introduction

Often times when investigating slow website response or intermittent website downtime it's difficult to have a quick view of what exactly is causing these issues. With curl being an amazing tool to investigate such issues it does lack the native tracking and calculation of data over time.

That said it is possible to extract this information with curl, however it is normally not easily readable and especially with intermittent issues not easily tracked and calculated over time.

Having this information readily available often assists with quickly identifying root cause whilst troubleshooting intermittent issues in (mainly) web-server(s). Simply running a curl request repeatedly isn't always fruitful as the previous information is lost. Even when saving this information in a file it generally takes some time as the data isn't easily analyzed over time and lacks tracking/computation of the output across all curl requests ran.

Due to this I wrote a bash script to assist me with quickly and easily extracting the above info and called it mycurl (mimicking the very epic mtr (my traceroute) name as it also tracks and averages output over time). Here is a rough summary of what mycurl will provide.

Live info (for each curl) included in mycurl output:

  • Date/time
  • Source/Destination IP/port pair
  • HTTP version
  • Redirect/Effective URL
  • Response code
  • TCP/SSL handshake time
  • Time Taken Pre-File Transfer
  • Time Taken Till Response First Byte
  • Download Size (Payload)
  • Upload Size (Payload)
  • Average Download bytes/s
  • Average Upload bytes/s
  • Total Request Time

Latency time info tracking (for all curl requests over script runtime - runcount is also tracked and incrimented) included in mycurl output:

Average/Best/Worst tracked for all curls ran over time including:

  • DNS lookup time
  • TCP/SSL handshake time
  • Pre-file transfer time
  • Time taken till response first byte
  • Download/Upload size
  • Average bytes/s
  • Total Request Time And tracking of HTTP Reponse Status Codes, incrementing live as responses are received. - This is helpful should unwanted responses codes be intermittent.

When troubleshooting slow website response issues it's nice to have a live view of what is impacting the response time to be slow - especially on average as this data sometimes points to a different root cause.

Find out how to use native curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document. mycurl leverages curl and simply loops it while changing the displayed output and sending it to a local file. Therefore it is safe to say that having curl installed is a prerequisite.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl.3 man page to learn how!

Contact

Currently there are no other contributors to the project however if you have problems, questions, ideas or suggestions, please contact me at [email protected] .

Git

To download the very latest source off the Git server do this:

git clone https://github.com/wiehahne/mycurl

With the script cloned you can either execute it by running './mycurl' or configure an [alias] (http://www.linfo.org/alias.html) or move it to your bin directory.

mycurl usage

./mycurl (url) (sleeptimer in seconds) (outputfile)

In order to execute a quick run by simply specifying "curl url" there is a default sleep timer of 2 seconds and output file of './mycurl_output.log'

./mycurl (url)

Known issues

Currently with the way mycurl updates the screen live and rewrites all text to do so it normally breaks when:

  1. Adjusting the terminal window size (sometimes works)
  2. Running a terminal window size smaller than the printed output.

Although irritating sometimes are easily worked around. Please refrain from adjusting your terminal window size and/or running mycurl in a terminal window too small to output all the required text. Text output has been kept to a minimum to ensure all screen sizes are supported.

I haven't had time to focus on fixing this however if you want to give it a bash feel free to hack at it and let me know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.