Skip to content

Instantly share code, notes, and snippets.

@naddeoa
Last active Jan 5, 2022
Embed
What would you like to do?
mtr script to gather information about your laggy network connection so you can try to convince your ISP there actually is a problem
#!/bin/bash
# When you're done, make a copy of this spreadsheet and paste report-filtered.csv into it to
# use the pivot tables to graph it out. The date column auto populates. Press ctrl+c to kill the script.
# https://docs.google.com/spreadsheets/d/117cP-euvlTeEcQ261R89BnGHLuszvWlF37Uyw8hgCHU/edit?usp=sharing
handler()
{
echo
}
# Ignore SIGINT in this script. Just use it to kill the watch command and then let
# the script fall through to format the results.
trap handler SIGINT
watch -n 0 'mtr --report --report-cycles 15 --csv google.com >> report-raw.csv'
head -n 1 report.csv > report-filtered.csv
# Filter our the header lines with grep or they'll appear throughout the csv. I just hard coded
# one header line in the google sheet at the top.
cat report-raw.csv | grep -v Mtr >> report.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment