comparison contrib/app_acct_tools/README @ 533:4cdf146f11d5

Added a set of example PHP scripts to parse the app_acct.fdx data.
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 07 Sep 2010 16:57:48 +0900
parents
children e5010975da35
comparison
equal deleted inserted replaced
532:4cb8f63a0f67 533:4cdf146f11d5
1 This folder contains several tools to use and parse the data from the app_acct.fdx extension.
2
3 - database.sql :
4 An example database format for use with the scripts in this folder.
5
6 - app_acct.conf :
7 The part of app_acct.conf that is relevant to this database schema.
8
9 - purge_to_file.php :
10 This PHP script is used to take the records from the incoming table (stored by app_acct.fdx
11 extension) and save these records in a file in SQL format. This is similar to pg_dump
12 command, except that all the records that have been saved in the file are removed from
13 the table. This can be used in cron jobs for example to maintain a reasonable size of
14 the incoming table and move the data to another host for off-line processing. It can
15 also be useful to aggregate the data from different hosts, if you are load-balancing your
16 accounting servers for example (granted that all app_acct.fdx use identical table format
17 on all the servers). See the top of the file for configuration parameters.
18
19 - process_records.php :
20 This PHP script processes the records pertaining to users sessions, as follow:
21 * when a session is complete (STOP record received), it stores a session summary
22 into the processed records table (see process_database.sql file for format).
23 * It optionaly archives the processed records into a different table, before deleting them.
24 * It can also move records of unterminated sessions that are older than a configurable time
25 to an orphan_records table, so that they are not re-processed every time.
26 This orphans table must have the same structure as the "incoming" table.
27
28 - display_results.php, display_self.php, display_stats.php :
29 These scripts give a few examples of how to display the processed data.
30
31 USAGE:
32 *) Initial: create your database using database.sql file
33 *) Configure the app_acct.fdx extension using tips from app_acct.conf
34
35 The following processing can be run for example as cron jobs.
36 1) On each accounting server for the realm, configure the app_acct.fdx extension to
37 dump the records in a local database (all servers must use the same database format).
38 The table would typically be "incoming".
39 2) Run the purge_to_file.php script on each server regularly, then move the generated
40 files onto a single server for processing. This server only needs the other tables.
41 3) Add the data from the files into the database in this server by running:
42 psql < file.sql
43 Each file that has been added should then be archived and removed so that it is not
44 re-added later.
45 4) Run the process_records.php script on this processing server. Now, the database
46 contains the aggregated data that can be visualized with display_*.php scripts.
47
"Welcome to our mercurial repository"