Advertisements
Download the nicstat tar file.
wget https://downloads.sourceforge.net/project/nicstat/nicstat-1.95.tar.gz
Untar the downloaded file.
tar xvzf nicstat-1.95.tar.gz
Go inside the extracted nicstat directory.
cd nicstat-1.95
Check the Readme file for the instructions.
cat README.txt
Compile
mv Makefile.Linux Makefile
make
If your system is 64bit, then you will get the following error.
[root@sysadmin nicstat-1.95]# make
gcc -O3 -m32 nicstat.c -o nicstat
In file included from /usr/include/features.h:385,
from /usr/include/stdio.h:28,
from nicstat.c:33:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
make: *** [nicstat] Error 1
[root@sysadmin nicstat-1.95]#
Then you need to install the following packages.
yum -y install glibc-devel.i686 glibc-devel
On some systems, even if you install glibc, the following error will come.
[root@main nicstat-1.95]# make
gcc -O3 -m32 nicstat.c -o nicstat
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
make: *** [nicstat] Error 1
[root@main nicstat-1.95]
You have to install the following packages to resolve this.
yum install libstdc++-devel.i686
Once all the required packages are installed, compile and install.
[root@sysadmin nicstat-1.95]# make
gcc -O3 -m32 nicstat.c -o nicstat
mv nicstat `./nicstat.sh --bin-name`
[root@sysadmin nicstat-1.95]# make install
gcc -O3 -m32 nicstat.c -o nicstat
sudo install -o root -g root -m 4511 `./nicstat.sh --bin-name` /usr/local/bin/nicstat
sudo install -o bin -g bin -m 555 enicstat /usr/local/bin
sudo install -o bin -g bin -m 444 nicstat.1 /usr/local/share/man/man1/nicstat.1
Now we can run the command.
[root@sysadmin nicstat-1.95]# nicstat
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
14:46:58 lo 0.00 0.00 0.00 0.00 80.58 80.58 0.00 0.00
14:46:58 eth0 13.27 0.83 13.95 8.32 974.1 102.3 0.12 0.00
To see the stats of a particular Ethernet interface
[root@sysadmin nicstat-1.95]# nicstat -i eth0
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
14:47:05 eth0 13.26 0.83 13.94 8.31 973.9 102.2 0.12 0.00
[root@sysadmin nicstat-1.95]#
Use -x extended output
[root@main nicstat-1.95]# nicstat -i eth2 -x
15:00:28 RdKB WrKB RdPkt WrPkt IErr OErr Coll NoCP Defer %Util
eth2 2078.2 2289.4 2413.0 1868.8 0.00 0.00 0.00 0.00 0.00 2.54
To get the summary
[root@main nicstat-1.95]# nicstat -i eth2 -s
Time Int rKB/s wKB/s
15:01:13 eth2 2078.175 2289.413
To repeat the summary in every 2 seconds for 5 times.
[root@main nicstat-1.95]# nicstat -i eth2 -s 2 5
Time Int rKB/s wKB/s
15:01:36 eth2 2078.173 2289.411
15:01:38 eth2 1088.889 1641.253
15:01:41 eth2 1065.228 1353.393
15:01:43 eth2 943.999 952.306
15:01:44 eth2 855.518 1361.279
To show TCP statistics
[root@main nicstat-1.95]# nicstat -t
15:09:12 InKB OutKB InSeg OutSeg Reset AttF %ReTX InConn OutCon Drops
TCP 0.00 0.00 1252.8 980.8 0.05 0.28 0.000 12.4 0.52 0.00
To show UDP statistics
[root@main nicstat-1.95]# nicstat -u
15:09:48 InDG OutDG InErr OutErr
UDP 0.59 0.59 0.00 0.00
No comments:
Post a Comment
Be nice. That's all.