Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (45 sloc) 1.72 KB



"pmacctstats" is a Ruby on Rails application which provides a dynamic summary view of collected traffic information from pmacct, an excellent traffic accounting package for IPv4 and IPv6.


  • Ruby 1.8.7
  • Gems listed in Gemfile (use bundler)
  • libmysqlclient14
  • MySQL 5.1.41-3ubuntu12.7


Put the source somewhere, start up script/server like you usually would, or run through Passenger or some other webserver (only tested with built-in Webrick so far).

Import of pmacct data

Configuration file

Please create a configuration file, "/etc/pmacctstats.conf" containing the following information:

networks =,fe80::/64

database = pmacct
host = localhost
username = pmacct
password = secret

database = pmacctstats
host = localhost
username = pmacctstats
password = secret
  • It at least needs to be readable by the user you run pmacctstats as.
  • Multiple local network designations must be comma-separated.
  • IPv4 and IPv6 are supported.


  • lib/summarise.rb contains the logic for importing the traffic data.
  • You can (in fact MUST right now) run it manually from rake:
    • rake summarise
  • I suggest you schedule this from cron at the moment, to run some time after midnight, to import the previous day's stats.


In its infinite wisdom, Rails 3 will attempt to populate your testing database from the development database before running tests. If you don't feel like keeping MySQL around all the time for testing just run the following:

RAILS_ENV='test' rake db:migrate RAILS_ENV='test' rake test

Jump to Line
Something went wrong with that request. Please try again.