John Voigt posted the a way to accomplish this to the m0n0wall mailing list on September 22, 2004.
Chris Buechler did some work on making this more understandable and easier to follow. You can see it on the old wiki here . Another option is using Cacti to monitor the switch ports.