Measuring network traffic

Hi,

As a side project (mostly to get to know Cassandra) I'm building an application that gathers all sorts of statistics from different machines in my network. The machines are running a variety of Linux distros and FreeBSD. One of the statistics that I want to gather is the amount of network traffic that the machines generate. Basically I just want a byte counter that I can reset after each read.

I tried using [cmd=]netstat -nI alc0 -b[/cmd] which does display the data that I need, but as far as I can tell there is no way to reset the counters (netstat -z doesn't work for these stats.) Of course I could use the netstat counters and just keep in mind that they overflow at ~4e9, but I don't really like that solution.

I tried googling for solutions, but couldn't find any. There are a lot of tools in net-mgmt but as far as I can tell none of them give what I need.

Is there any tool that I've missed that can give me this information, or any other method that I can use to get it? Any help would be greatly appreciated.
 
Recent versions of FreeBSD have a built in SNMP daemon called bsnmpd(1). No extra ports are needed. For the SNMP client, you will need some toolset: net-snmp, rrdtool and mrtg being the most used.
 
For decent hardware you're better off dealing with netflow, but for devices that don't do netflow, poll them with SNMP.

You don't really want go to resetting interface counters, simply keep a running tally in your application.
 
2 cents

I like cacti and munin. Munin for simple setups, cacti for more robust user access. cacti is very similar to mrtg, but you can easily monitor system load, cpu, number of logged in users, ram, disk IO, swap, uptime (doh, sawtooth pattern!), disk space, wireless signal strength, etc.
 
Back
Top