Use iftop to collect network bandwidth usage (#6560)
* Use iftop to collect network bandwidth usage * fix shellcheck * more shellchecks * review comments
This commit is contained in:
committed by
Michael Vines
parent
be74801236
commit
e174af7838
16
scripts/iftop.sh
Executable file
16
scripts/iftop.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/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
|
Reference in New Issue
Block a user