Files
solana/scripts/iftop.sh
Pankaj Garg e174af7838 Use iftop to collect network bandwidth usage (#6560)
* Use iftop to collect network bandwidth usage

* fix shellcheck

* more shellchecks

* review comments
2019-10-26 00:06:46 -07:00

17 lines
432 B
Bash
Executable File

#!/usr/bin/env bash
#
# Reports network bandwidth usage
#
set -e
[[ $(uname) == Linux ]] || exit 0
cd "$(dirname "$0")"
sudo iftop -i "$(ifconfig | grep mtu | grep -iv loopback | grep -i running | awk 'BEGIN { FS = ":" } ; {print $1}')" -nNbBP -t \
| awk '{ if ($3 ~ "=>") { print $2, $7 } else if ($2 ~ "<=") { print $1, $6 }} ' \
| awk 'NR%2{printf "%s ",$0;next;}1' \
| awk '{ print $1, "<=>", $3, ":", $2, $4 }'
exit 1