[CentOS] NIC traffic monitoring, recording and reporting software?

Filipe Brandenburger filbranden at gmail.com
Wed Jul 15 20:22:51 UTC 2009


Hi,

On Wed, Jul 15, 2009 at 11:46, James B. Byrne<byrnejb at harte-lyne.ca> wrote:
> I have a remote CentOS-5.3 installation that shares traffic with
> another enterprise.  I want to record and measure the actual network
> traffic that comes into and goes out of that host's net i/f on a
> monthly basis for billing verification purposes.  Does CentOS have a
> software package to accomplish this?

Have a look at "netacct-mysql":
http://sourceforge.net/projects/netacct-mysql/

It uses pcap which puts your network card in promiscuous mode and send
all packets to the running daemon, which might be a little heavyweight
on the resources if your server uses a lot of network, but it appears
to be very flexible in terms of being able to split accounting for
different traffic going through the server.

If you want something simpler than that, you may:
1) Use "ifconfig" and save the amount of bytes received/transmitted,
then do that again some time from now and subtract the difference to
know how much you sent in that period. A simple script should be able
to do that. Beware that that counter may wrap though. Also, you might
lose the information if you reboot the server or restart the network.
2) Use "iptables" to set specific rules for what you want to account.
You don't have to use "allow" or "reject" or "drop", just write the
filter you want. Then use "iptables -v -L" which will show you the
number of packets and bytes that went through that rule. You can then
use "iptables -Z" to reset the counters for a new period.

HTH,
Filipe



More information about the CentOS mailing list