Skip to content

This script would account your traffic used in different port

Notifications You must be signed in to change notification settings

plbin97/traffic-statistics-in-linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 

Repository files navigation

Traffic Statistics in Linux

This bash script would help you to get the traffic flowed in different port.

Environment requirement

This bash script required iptables in your system.

If you are using Cent OS 7, before use this, please execute "yum install network-tools"

How to use

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

About

This script would account your traffic used in different port

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages