Smokeping::RRDtools3
Tools for rrd file handling
Usage
use Smokeping::RRDtools;use RRDs;my $file = '/path/to/file.rrd';# get the create arguments that $file was created withmy $create = Smokeping::RRDtools::info2create($file);# use them to create a new fileRRDs::create('/path/to/file2.rrd', @$create);# or compare them against another create listmy @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);
Overview
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.
Notes
This module is not particularly specific to Smokeping, it is just distributed with it.
Releases
3 releases since Debian 4.0 (Etch); the text changed 2 times.