Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Dec 1999 02:12:56 -0500 (EST)
From:      Mike Nowlin <mike@argos.org>
To:        Aldrin Leal <aldrin@americasnet.com>
Cc:        freebsd-net@FreeBSD.ORG
Subject:   Re: Math Help for IPFW :)
Message-ID:  <Pine.LNX.4.05.9912170204130.2534-100000@jason.argos.org>
In-Reply-To: <008d01bf47af$6414d900$0200a8c0@expert.com.br>

next in thread | previous in thread | raw e-mail | index | archive | help

>     How could i relate this count, the second one, for packets? For sure it
> means the number of packets processed. But how long is a packet? That's all
> i need to put the right number of kBPS/s they're doing. :)

The first problem is that packet size varies greatly -- it could be a
single byte (plus header/address information), or quite large, depending
on what the interface type/parameters are set for.

The best solution I found for this is SNMP, which is what most of the "big
boys" (PSI Net, for example) use.  I do something similar -- sample the 
"interfaces.ifTable.ifEntry.ifOutOctets" and
"interfaces.ifTable.ifEntry.ifInOctets" entries for each interface
periodically, and you can calculate the average bandwidth usage per
interface pretty easily:

(with two samples, taken x seconds apart)

Bandwidth = (sample1 - sample2) / x

Not perfect, but it works.  The closer in time the samples are, the more
accurate your result.  Using ucd-snmp, it's pretty easy to write a perl or
shell script that will do this for you on a routine basis, and send it to
some reporting method.

mike




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.05.9912170204130.2534-100000>