This script will create and update the rrd-database-file for each mac found in /proc/net/arp. If a host is not online no update will be performed. This will save some cpu-cycles. traff_graph stores the rrd-db, the created pictures/graphs and the index.html for viewing the graphs in /tmp/rrd. This means, after a reboot all informations are lost and you will start at 0.

Now you can test traff_graph. Make sure you have only a single traffic-chain/host in your iptable rules. You can list this with

iptables -L traffic -vx

Now run traff_graph. This will need a while… get a coffee Add traff_graph to your crontab and run it every 5 minutes. Be careful not to monitor too many hosts since rrdtool graph needs a lot of time. For viewing the graphs add a symlink in /www which points to /tmp/rrd:

cd /www
ln -s /tmp/rrd/ traffic

and the stuff should be be available via

http://192.168.0.1/traffic/

To use crond to have the script run every 5 minutes, add this to your /etc/crontabs/root file: