Home > linux > Linux Network Statistics

Linux Network Statistics

netstat – Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships

[x@mar nodes]$ netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      943/dovecot         
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      1017/nginx          
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      516/sshd            
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      975/sendmail        
tcp        0      0 0.0.0.0:443                 0.0.0.0:*                   LISTEN      1017/nginx          
tcp        0      0 0.0.0.0:993                 0.0.0.0:*                   LISTEN      943/dovecot         
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      999/php-fpm         
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      906/mysqld          
tcp        0      0 0.0.0.0:587                 0.0.0.0:*                   LISTEN      975/sendmail        
tcp        0      0 :::143                      :::*                        LISTEN      943/dovecot         
tcp        0      0 :::22                       :::*                        LISTEN      516/sshd            
tcp        0      0 :::993                      :::*                        LISTEN      943/dovecot

iftop – uses the pcap library to capture the packets moving in and out of the network adapter, and then sums up the size and count to find the total bandwidth under use
iptraf – colorful IP Lan monitor.
nethogs –  ‘net top’ tool that shows the bandwidth used by individual processes
bmon – shows the traffic load over all the network interfaces on the system
slurm – network load monitor that shows device statistics along with an ascii graph
tcptrack – similar to iftop, uses the pcap library to capture packets and calculate statistics like the bandwidth used in each connection
vnstat –  runs as daemon and keeps recording the size of data transfer all the time. Generates a report of the history of network usage

[root@mar ~]# vnstat
Database updated: Sun Dec 21 13:57:55 2014

   venet0 since 11/02/14

          rx:  6.71 GiB      tx:  59.29 GiB      total:  66.00 GiB

   monthly
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
       Nov '14      3.51 GiB |   30.03 GiB |   33.54 GiB |  108.55 kbit/s
       Dec '14      3.20 GiB |   29.26 GiB |   32.46 GiB |  153.10 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated      4.81 GiB |   44.07 GiB |   48.88 GiB |

   daily
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
      12/20/14    155.33 MiB |    2.92 GiB |    3.07 GiB |  298.10 kbit/s
      12/21/14     86.58 MiB |  545.20 MiB |  631.79 MiB |  102.95 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated       147 MiB |     937 MiB |    1.06 GiB |

Or just for the current traffic on a interface

[root@mar ~]# vnstat -l -i venet0
Monitoring venet0...    (press CTRL-C to stop)

   rx:        8 kbit/s     6 p/s          tx:       12 kbit/s     4 p/s^C


 venet0  /  traffic statistics

                           rx         |       tx
--------------------------------------+------------------
  bytes                        9 KiB  |          10 KiB
--------------------------------------+------------------
          max              16 kbit/s  |       12 kbit/s
      average            5.14 kbit/s  |     5.71 kbit/s
          min               0 kbit/s  |        0 kbit/s
--------------------------------------+------------------
  packets                         49  |              41
--------------------------------------+------------------
          max                  8 p/s  |           8 p/s
      average                  3 p/s  |           2 p/s
          min                  1 p/s  |           0 p/s
--------------------------------------+------------------
  time                    14 seconds

bwm-ng (Bandwidth Monitor Next Generation) – very simple real time network load monitor

[root@mar nodes]# bwm-ng -o curses2

cbm – simple bandwidth monitor that displays the traffic volume through network interfaces. No further options, just the traffic stats in realtime.
speedometer – simple tool that just draws out good looking graphs of incoming and outgoing traffic through a given interface

[root@mar nodes]# speedometer -r eth0 -t eth0

pktstat – displays all the active connections in real time, also displays the type of the connection, i.e. tcp/udp and details about http requests if involved

ifstat  neatly  prints out network interface statistics.
[root@mar nodes]# ifstat
#kernel
Interface        RX Pkts/Rate    TX Pkts/Rate    RX Data/Rate    TX Data/Rate  
                 RX Errs/Drop    TX Errs/Drop    RX Over/Rate    TX Coll/Rate  
lo                 1408K 0         1408K 0         1254M 0         1254M 0      
                       0 0             0 0             0 0             0 0      
enp4s0            41282K 0        27194K 0       319995K 0         2724M 0      
                       0 0             0 0             0 0             0 0
Advertisements
Categories: linux Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: