Operating System - Tru64 Unix
1828216 Members
2384 Online
109975 Solutions
New Discussion

Re: How To Determine Interface Traffic Statistics

 
Steve Hyatt
New Member

How To Determine Interface Traffic Statistics

Hi.

I have a piece of software which periodically (every second or so) is
responsible for determining the total amount of network traffic (in
bytes) which are sent and received through all interfaces on a
machine.

I have routines which determine this data on various different systems
(Linux, IRIX, Solaris, Win32) but am unable to determine how to do
this on Tru64 (the way this is done is different across all
platforms).

My question is how can I determine this information? I am looking for
something like the following which could be called periodically to
retrieve total traffic and therefore the traffic delta's could be
easily computed:

int getTotalBytesSent (const char* interfaceName);

I am currently runnint Tru64 V5.1a patch kit 4.

Hints (or code snippets) greatly appreciated.

Steve
shyatt@bigbangwidth.com
3 REPLIES 3
Michael Schulte zur Sur
Honored Contributor

Re: How To Determine Interface Traffic Statistics

Hi Steve,

what about netstat -I"interface name" -s

Michael
Ralf Puchner
Honored Contributor

Re: How To Determine Interface Traffic Statistics

Attached you will find a snipped of code reading the counters. But this method is not Tru64 dependant! Other derivats also uses the SIOCRDCTRS method.

Help() { FirstReadManual(urgently); Go_to_it;; }
Ralf Puchner
Honored Contributor

Re: How To Determine Interface Traffic Statistics

BTW. there are other methods like reading /dev/kmem or /proc
Help() { FirstReadManual(urgently); Go_to_it;; }