Bandwidth usage graphs using rrdtool and OpenBSD's pf.
traf.c (4KB)
graphs.php (1KB)
traf uses very little CPU time to update the RRD and graphs are generated on demand by a PHP script.
You need rrdtool installed before you can compile traf:
You'll need to set up your paths and permissions, and get traf running in the background with enough privileges to open /dev/pf. I use something like this:
I have a chrooted Apache so I made a /chroot/tmp directory, I put my timezone data in /chroot/usr/share/zoneinfo (if you don't do this you get UTC times) and I put a statically compiled rrdtool in /chroot/bin.
Sample output:
Valid XHTML 1.1
Path:
home >
stuff >
traf
copyright © 2004 Emil Mikulic
$Date: 2006/04/22 07:07:12 $