Skip to content
This repository

RoR app which provides a dynamic summary view of collected traffic information from pmacct.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config
Octocat-spinner-32 db
Octocat-spinner-32 doc
Octocat-spinner-32 lib
Octocat-spinner-32 log
Octocat-spinner-32 public
Octocat-spinner-32 script
Octocat-spinner-32 spec
Octocat-spinner-32 test
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 COPYING
Octocat-spinner-32 Gemfile
Octocat-spinner-32 RAILS_README
Octocat-spinner-32 RAILS_README.rdoc
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 TODO
Octocat-spinner-32 config.ru
README.markdown

pmacctstats

Overview

"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.

Requirements

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

Usage

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:

[main]
networks = 192.0.2.0/24,fe80::/64

[source]
database = pmacct
host = localhost
username = pmacct
password = secret

[destination]
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.

Importing

  • 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.

Testing

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

Something went wrong with that request. Please try again.