MRTG::Parse - Perl extension for parsing and utilizing the logfiles generated by the famous MRTG Tool.
use strict; use MRTG::Parse; my $mrtg_logfile = "/var/www/htdocs/mrtg/eth0.log"; my $period = "day"; my $desired_unit = "GB"; my ($traffic_incoming, $traffic_outgoing, $traffic_sum) = mrtg_parse($mrtg_logfile, $period, $desired_unit); print "Incoming Traffic: $traffic_incoming\n"; print "Outgoing Traffic: $traffic_outgoing\n"; print "= Sum $traffic_sum\n";
This perl extension enables its users to parse and utilize the logfiles that are generated by the famous MRTG (Multi Router Traffic Grapher) tool.
mrtg_parse() takes three argument:
1st: filename of the mrtg logfile 2nd: time period to genereate the output for valid values are: - individual time periods like: 20040821-20050130 (ISO 8601) - static values: day, month, year 3rd: the desired unit (optional) valid values are: - B, KB, MB, GB, TB - if missing mrtg_parse will chose an adequate one for you
mrtg_parse() returns three values:
1st: Incoming traffic 2nd: Outgoing traffic 3rd: Sum of incoming and outgoing
mrtg_parse()
http://people.ee.ethz.ch/~oetiker/webtools/mrtg/ - MRTG Homepage
http://people.ee.ethz.ch/~oetiker/webtools/mrtg/mrtg-logfile.html - Description of the MRTG Logfile Format
Please report any bugs or feature requests directly to mariof@cpan.org. Thanks!
Mario Fuerderer, <mariof@cpan.org>
Copyright (C) 2005 by Mario Fuerderer
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
To install MRTG::Parse, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MRTG::Parse
CPAN shell
perl -MCPAN -e shell install MRTG::Parse
For more information on module installation, please visit the detailed CPAN module installation guide.