Saturday, March 7, 2009

measuring your network throughput on Solaris

You can use nicstat utility to measure your network device utilization and throughput. The utility itself uses solaris kstat for network device statistics information. Statistics include network read and write in kilobytes, packets and device utilization.You can compile nicstat with gcc as shown below.

# gcc nicstat.c -o nicstat -lkstat -lgen -lsocket

Following image shows a sample output from nicstat utility.


3 comments:

carsten.peters@axa-tech.com said...

Hi,

this is exactly what I need, but unfortunately I do not get it compiled. It can't resolve the symbol "nanosleep".
But when I look at the manpage of nanosleep, it seems to be there.
I have already added some directories to the LD_LIBRARY_PATH, but it seems I did not get the right directory.

Any ideas?
Thanky you very much.

Carsten

Levent Serinol said...

Hi,
have you tried it with "-lrt" option ?

# gcc nicstat.c -o nicstat -lkstat -lgen -lsocket -lrt

btw. you can use sun's cc compile (cc)

wooks said...

Hi, I have compiled this tool on opensolaris instance running on amazons EC2 cloud. The interface name for this server is xnf0 - but it errors:
./nicstat -i xnf0 5
Time Int rKb/s wKb/s rPk/s wPk/s rAvs wAvs %Util Sat
ERROR4: No such interface found.

rgs