curl
can be handy tool to perform network analysis.
1
|
|
This will print the total time in seconds that the full operation lasted.
Used flags in this command:
-o
: This is used to write output to specified destination, as we are focused on just performance we are writing to/dev/null
so the stdout of curl will be ignored.-s
: Meant for silent, this will skip the debug table (in which you can see some stats as well).-w
: This commad defines what to display on stdout after a completed and successful operation. The desired output can be formatted using file or in-inline.
You can see entire curl doc (supported variables, etc) for -w
flag here
Custom formatting:
We can feed in the desired format using a file or in-inline, in-inline examples:
1 2 |
|
To read from a particular file you need to specify it as “@filename”, example:
1
|
|
I used this to log the info in json format, and here’s how my format.txt
looks like:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Sample output:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
For constant monitoring, create a cron job which runs this command every minute and push data to desired systems.