I have a script that runs right before a daily reboot that captures the amount of MB transmitted up and pulled down since last reboot.
echo `date +"%m-%d-%y"``grep eth0 /proc/net/dev | awk '{print ","$2/1024/1024","$10/1024/1024}'`>>/home/nick/bandwidth.log
In looking at the raw output of /proc/net/dev, I know that this particular script will only yield the info on a Ethernet device. Is there any way to write a script that does something like this per port? I'd like to know, how much bandwidth is being consumed by the web pages being hosted on port 80 vs. the Minecraft server being hosted on port 25565.
Thanks in advance!