This bash script would help you to get the traffic flowed in different port.
This bash script required iptables in your system.
If you are using Cent OS 7, before use this, please execute "yum install network-tools"
Before you use, please add execute premission :
chmod +x traffic_accounting.sh
If you wana to get the traffic flowed in port 80, you should start the traffic statistics with:
./traffic_accounting.sh add 80
After this command is executed, the system would start to collect the traffic statistics for port 80
You can add more if you want
The unit is byte
After, you can get the inbound traffic in byte unit by executing:
./traffic_accounting.sh get 80 in
You can get the outbound traffic in byte unit by executing:
./traffic_accounting.sh get 80 out
If you wana to reset for all ports' traffic statistics, you have to executing:
./traffic_accounting.sh clean
So sorry that there is no way to reset for a specific port. I am tring to do this