| Port Accounting & Collection Tool -
or short PACT - is an SNMP-Tool to do port-accounting for any device that
conforms to SNMP standards and has at least a certain amount of SNMP-querieable
data (e.g. octets in/out, etc.). Additional tool will allow it to use Apache
logfiles as basis for accounting. As of version 0.9f, it also includes support
for Linux' ipchains.
The idea is based on an old script I wrote that used
snmpwalk together with some shell script magic to do accounting on several
routers. Among others, two main drawbacks were included in the original version
- if the internal offset of a port changed, the script would start recording
the wrong port. Also, the speed factor was a problem (it took between 3 and 7
minutes to go through 15 routers and calculate & store the port counters in
the database). With PACT, all drawbacks have been addressed. Now, all ports are
addressed with their symbolic name, and also speed issues have greatly improved
(down to approximately 1 second per router, switch, hub etc.). Plus a nice UI
has been added, allowing anybody to alter or create entries or config options.
PACT consists of several different parts, depending on the
kind of work being done, and uses a combination of programs, tools and
libraries. The core program, the data collector, is based on an example program
from the ucd-snmp-package. It's written entirely in C and utilizes the libsnmp
from the ucd-snmp-package. The data is collected using configuration data
retrieved from a MySQL database, which is also used to store the collected daa.
All UI-specific work is done using HTML pages, most of
which using PHP with its MySQL routines to display and administer dynamic data
(like host, customer and port data, etc.). Finally, tools to consolidate the
collected data and reduce the amounts by adding up on a day-to-day base were
planned in C for performance reasons (our current accounting collects nearly
two million of data sets per month, which is compressed to about 200000 sets of
data), but was written as PHP/SQL-scripts, as just about all work is done in
the core of MySQL, so the frontend-performance doesn't matter too much.
Apart from SNMP-ports, PACT can also be used to do
accounting for just about anything that can be counted. To date, an additional
program exists (for registered users) converting Apache http-logs into PACT
data. This was necessary, as doing an accounting for virtual servers running on
a single IP is not possible via SNMP ... |