NAME
Fwctl::AcctReport - Generates reports from fwctl dump-acct
command.
SYNOPSIS
use Fwctl::AcctReport;
my $report = new Fwctl::Report( options ... );
my $r = $report->summary_report;
foreach my $r ( @$src_alias_sum ) {
print $r->{name}, " = ", $r->{bytes_sum}, "\n";
}
DESCRIPTION
The Fwctl::AcctReport(3) module can be used to generate packet and bandwith report from the data generated by the fwctl dump-acct
command.
This module can be used as backend for two kinds of report. Summary which compiles the total number of packets and bytes received by each accounting chains over the report's period or histogram type report where you have the packets and bytes total for each sample (hour, day, etc) over the report's period.
CAVEATS
The fwctl dump-acct
commands dumps the packets and bytes total since the time of the last invocation. If the last invocation wasn't wholly comprised in the current sample, the total will be interpolated. This means that you should run the fwctl dump-acct
command at least as frequently as the smallest sample period you want to use.
CREATING A NEW REPORT OBJECT
Ex. my $report = new Fwctl::AcctReport( start => 'yesterday',
period => '1 day',
sample => '1d',
files => [ 'log' ] );
PARAMETERS
The new
method accepts the following parameter :
- files
-
Specifies the file from which to read the dumped acctounting informations. It is an array of file handle or file names. If this parameter is not specified the records will be read from STDIN.
- start
-
Sets the start of the report's period. If the Date::Manip(3) module is installed, you can use any format that this module can parse. If that module isn't installed you must use the following format YYYY-MM-DD HH:MM:SS or any meaningful subset of that format.
If this option is not used, the report will start with the first record.
- end
-
Sets the end of the report's period. If the Date::Manip(3) module is installed, you can use any format that this module can parse. If that module isn't installed you must use the following format YYYY-MM-DD HH:MM:SS or any meaningful subset of that format.
If this option is not used, the report will end with the last record.
- period
-
Sets the length of the report's period. This length is interpreted relative to the report's start. This option has priority over the end option.
If you have the Date::Manip module installed, you can use any format that this module can parse. If that module isn't available, you can use a subset of the following format X weeks X days X hours X mins X secs.
- sample
-
Sets the length the sample's for the report. The sample_report will returns results aggregated over that length. For example, if you use 1d as sample's length, you will get the stats for every day from the beginning of the report until the end.
If you have the Date::Manip module installed, you can use any format that this module can parse. If that module isn't available, you can use a subset of the following format X weeks X days X hours X mins X secs.
- names
-
Restrict records to those whose name matches names.
You can use this parameter multiple times to specify multiple possibility. The record will be included if it matches any of those.
METHODS
start()
Return the start of the report in seconds since epoch.
end()
Returns the end of the report in seconds since epoch.
period()
Returns the length of the report's period ( $report->end() - $report->start() )
sample()
Returns the length of the sample period.
records()
Returns an array reference to all the records read and which makes the report's samples.
RECORD FIELDS
Each record is an array ref. You can accessed the individual fields of the record by using the following constants. (Those can be imported by using the :fields
import tag.)
- TIME
-
The epoch start time of the sample.
- NAME
-
The name of the accounting chain.
- PACKETS
-
The number of packets received.
- BYTES
-
The total number of bytes.
REPORTS
The following report generation methods are available :
summary_report()
my $r = $report->summary_report();
Generates a report that shows the compiled statistics for every accounting chain.
The resulting report is an array ref of hash reference. Each report record's has the following fields.
- name
-
The name of the chains.
- packets_sum
-
The total number of packets over the report's period.
This number is a Math::BigInt(3) object.
- bytes_sum
-
The total number of bytes received over the report's period.
This number is a Math::BigInt(3) object.
- packets_avg
-
The average number of packets received by that chain by sample.
This number is a Math::BigInt(3) object.
- bytes_avg
-
The average number of packets bytes by that chain by sample.
This number is a Math::BigInt(3) object.
sample_report()
my $r = $report->sample_report();
Generates a report that compiles the stats for each sample for each chains.
The resulting report is an hash reference. Each key is a chain and each value is an array ref to the chain compiled statistics. Each element of the array is an hash reference comprises of the following elements :
- start
-
The start time in seconds since epoch for that sample.
- packets
-
The total number of packets received in that sample.
This number is a Math::BigInt(3) object.
- bytes
-
The total number of bytes received in that sample.
This number is a Math::BigInt(3) object.
AUTHOR
Francis J. Lacoste <francis.lacoste@iNsu.COM>
COPYRIGHT
Copyright (c) 2000 iNsu Innovations Inc. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
SEE ALSO
Fwctl(3) Fwctl::RuleSet(3) fwctl(8) fwctllog(8) fwctacctreport(8) Fwctl::Report(3) Date::Manip(3).
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 269:
You forgot a '=back' before '=head1'