В статье "Monitoring Net Traffic with OpenBSD's Packet Filter" описано как создать несложную систему учета трафика используя пакетный фильтр pf и perl (без использования SQL через DBD::SQLite, для рисования графика применяется GD::Graph).
/etc/pf.conf (пример организации счетчиков):
pass quick on lo0 keep state
pass in log label "other-inbound" keep state
pass out log label "other-outbound" keep state
pass in to <geekcruises> label "geekcruises-inbound" keep state
pass out from <geekcruises> label "geekcruises-outbound" keep state
pass in to <redcat> label "redcat-inbound" keep state
pass out from <redcat> label "redcat-outbound" keep state
pass in to <webstonehenge> label "webstonehenge-inbound" keep state
pass out from <webstonehenge> label "webstonehenge-outbound" keep state
pass in to <stonehenge> label "stonehenge-inbound" keep state
pass out from <stonehenge> label "stonehenge-outbound" keep state
Дамп статистики через pfctl -zvsl
URL: http://www.samag.com/documents/s=9053/sam0403j/0403j.htm
Новость: http://www.opennet.me/opennews/art.shtml?num=3406