Traffic NIC

Solaris: nicstat Command Show Network Interface Card Statics

The “nicstat” command it application to monitor Network Traffic and give you more static regarding traffic in Kilobytes per second, Average Packet Traffic Size, Packet Send and Received,

– You Can Download Directly from Sourcforge.net Project as link below with “wget” command

# wget http://nchc.dl.sourceforge.net/project/nicstat/nicstat-1.92.tar.gz

– Extract tar file

# tar xvf nicstat-1.92.tar.gz
# cd nicstat-1.92
# ls -l 
total 212
-rw-r--r--   1 509833   staff       4952 Oct 22  2012 ChangeLog.txt
-rwxr-xr-x   1 509833   staff        475 Oct 16  2012 dladm.sh
-rw-r--r--   1 509833   staff       1312 Oct 18  2012 enicstat
-rw-r--r--   1 509833   staff       8902 Oct 18  2012 LICENSE.txt
-rw-r--r--   1 509833   staff       1629 Sep  5  2012 Makefile.Linux
-rw-r--r--   1 509833   staff       1596 Oct 18  2012 Makefile.Solaris
-rw-r--r--   1 509833   staff       9423 Oct 22  2012 nicstat.1
-rw-r--r--   1 509833   staff      67376 Oct 22  2012 nicstat.c
-rwxr-xr-x   1 509833   staff       4134 Oct 16  2012 nicstat.sh
-rw-r--r--   1 509833   staff        834 Oct 22  2012 README.txt

– Compile the nicstat.c by gcc and using command

# /usr/bin/gcc nicstat.c -o nicstat -lkstat -lgen -lsocket -lrt

– After Compile finish it will create executable file “nicstat” at Current Directory

– You can start using “nicstat” Directly from you current Path or set “PATH” in your home User  by add Folder path to ~/.profile to export Line

– To have Extended Output you can using parameter with “nicstat” command

# nicstat -x
11:37:34      RdKB    WrKB   RdPkt   WrPkt   IErr  OErr  Coll  NoCP Defer  %Util
lo0           0.00    0.00    0.00    0.00   0.00  0.00  0.00  0.00  0.00   0.00
aggr0         0.01    0.00    0.01    0.00   0.00  0.00  0.00  0.00  0.00   0.00

– -s to have output for Read & Write Kilobytes per second

# nicstat -s
    Time      Int          rKB/s          wKB/s
11:38:19      lo0          0.000          0.000
11:38:19    aggr0          0.007          0.000

– To print Summary static and traffic for each 1 Second you can used “1” with “nicstat”

# nicstat 1
    Time      Int   rKB/s   wKB/s   rPk/s   wPk/s    rAvs    wAvs %Util    Sat
11:40:37      lo0    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
11:40:37    aggr0    0.01    0.00    0.01    0.00   537.9   97.96  0.00   0.00
    Time      Int   rKB/s   wKB/s   rPk/s   wPk/s    rAvs    wAvs %Util    Sat
11:40:38      lo0    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
11:40:38    aggr0    0.30    0.35    5.00    1.00   61.20   354.0  0.00   0.00
    Time      Int   rKB/s   wKB/s   rPk/s   wPk/s    rAvs    wAvs %Util    Sat
11:40:39      lo0    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
11:40:39    aggr0    0.30    0.39    5.00    2.00   61.20   198.0  0.00   0.00

– To have Output static in every 2 Second for 3 times use “nicstat 2 3”

# nicstat 2 3
    Time      Int   rKB/s   wKB/s   rPk/s   wPk/s    rAvs    wAvs %Util    Sat
11:42:22      lo0    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
11:42:22    aggr0    0.01    0.00    0.01    0.00   537.9   97.96  0.00   0.00
    Time      Int   rKB/s   wKB/s   rPk/s   wPk/s    rAvs    wAvs %Util    Sat
11:42:24      lo0    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
11:42:24    aggr0    2.56    0.17   28.50    0.50   91.89   354.0  0.00   0.00
    Time      Int   rKB/s   wKB/s   rPk/s   wPk/s    rAvs    wAvs %Util    Sat
11:42:26      lo0    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
11:42:26    aggr0    1.15    0.17   12.50    0.50   94.48   354.0  0.00   0.00