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 ($fatal, $comparison) = Smokeping::RRDtools::compare($file, \@create); print "Fatal: " if $fatal; print "Create arguments didn't match: $comparison\n" if $comparison;
Smokeping::RRDtools::tuneds($file, \@create); =head1 DESCRIPTION
This module offers three functions, info2create
, compare
and
tuneds
. 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 thirds tunes the DS parameters according to the
supplied create string.
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 an array of two values:
(fatal, text)
where fatal
is 1 if it found a fatal difference, and 0 if not.
The text
will contain an error message if fatal == 1
and a possible warning
message if fatal == 0
. If fatal == 0
and text
is undef
, all the
arguments matched.
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. compare
ignores non-matching DS
parameters since tuneds
will fix them.
tuneds
talks on stderr about the parameters it fixes.
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)