From owner-freebsd-net Thu Dec 16 23:13: 8 1999 Delivered-To: freebsd-net@freebsd.org Received: from jason.argos.org (a1-3b058.neo.rr.com [24.93.181.58]) by hub.freebsd.org (Postfix) with ESMTP id BA40314DB9 for ; Thu, 16 Dec 1999 23:13:05 -0800 (PST) (envelope-from mike@argos.org) Received: from localhost (mike@localhost) by jason.argos.org (8.9.1/8.9.1) with ESMTP id CAA02631; Fri, 17 Dec 1999 02:12:56 -0500 Date: Fri, 17 Dec 1999 02:12:56 -0500 (EST) From: Mike Nowlin To: Aldrin Leal Cc: freebsd-net@FreeBSD.ORG Subject: Re: Math Help for IPFW :) In-Reply-To: <008d01bf47af$6414d900$0200a8c0@expert.com.br> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > 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