Smokeping::RRDtools - Tools for RRD file handling
use Smokeping::RRDtools; use RRDs;
my $file = '/path/to/file.rrd';
# get the create arguments that $file was created with my $create = Smokeping::RRDtools::info2create($file);
# use them to create a new file RRDs::create('/path/to/file2.rrd', @$create);
# or compare them against another create list my @create = ('--step', 60, 'DS:ds0:GAUGE:120:0:U', 'RRA:AVERAGE:0.5:1:1008'); my $comparison = Smokeping::RRDtools::compare($file, \@create); print "Create arguments didn't match: $comparison\n" if $comparison;
This module offers two functions, info2create
and compare
.
The first can be used to recreate the arguments that an RRD file
was created with. The second checks if an RRD file was created
with the given arguments.
The function info2create
must be called with one argument:
the path to the interesting RRD file. It will return an array
reference of the argument list that can be fed to RRDs::create
.
Note that this list will never contain the start
parameter,
but it will contain the step
parameter.
The function compare
must be called with two arguments: the path
to the interesting RRD file, and a reference to an argument list that
could be fed to RRDs::create
. The function will then simply compare
the result of info2create
with this argument list. It will return
undef
if the arguments matched, and a string indicating the difference
if a discrepancy was found. Note that if there is a start
parameter in
the argument list, compare
disregards it. If step
isn't specified,
compare
will use the rrdtool
default of 300 seconds.
This module is not particularly specific to Smokeping, it is just distributed with it.
Probably.
Copyright (c) 2005 by Niko Tyni.
Niko Tyni <ntyni@iki.fi>
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.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
RRDs(3)