4 use vars qw(@ISA $VERSION);
12 bootstrap RRDs $VERSION;
19 RRDs - Access rrdtool as a shared module
35 =head2 Calling Sequence
37 This module accesses rrdtool functionality directly from within perl. The
38 arguments to the functions listed in the SYNOPSIS are explained in the regular
39 rrdtool documentation. The commandline call
41 rrdtool update mydemo.rrd --template in:out N:12:13
45 RRDs::update ("mydemo.rrd", "--template", "in:out", "N:12:13");
56 The RRD functions will not abort your program even when they can not make
57 sense out of the arguments you fed them.
59 The function RRDs::error should be called to get the error status
60 after each function call. If RRDs::error does not return anything
61 then the previous function has completed its task successfully.
64 RRDs::update ("mydemo.rrd","N:12:13");
66 die "ERROR while updating mydemo.rrd: $ERR\n" if $ERR;
70 The functions RRDs::last, RRDs::graph, RRDs::info and RRDs::fetch return their
73 B<RRDs::last> returns a single INTEGER representing the last update time.
75 $lastupdate = RRDs::last ...
77 B<RRDs::graph> returns an pointer to an ARRAY containing the x-size and y-size of the
78 created gif and results of the PRINT arguments.
80 ($averages,$xsize,$ysize) = RRDs::graph ...
81 print "Gifsize: ${xsize}x${ysize}\n";
82 print "Averages: ", (join ", ", @$averages);
84 B<RRDs::info> returns a pointer to a hash. The keys of the hash
85 represent the property names of the rrd and the values of the hash are
86 the values of the properties.
88 $hash = RRDs::info "example.rrd";
89 foreach my $key (keys %$hash){
90 print "$key = $$hash{$key}\n";
93 B<RRDs::fetch> is the most complex of
94 the pack regarding return values. There are 4 values. Two normal
95 integers, a pointer to an array and a pointer to a array of pointers.
97 my ($start,$step,$names,$data) = RRDs::fetch ...
98 print "Start: ", scalar localtime($start), " ($start)\n";
99 print "Step size: $step seconds\n";
100 print "DS names: ", join (", ", @$names)."\n";
101 print "Data points: ", $#$data + 1, "\n";
103 foreach my $line (@$data) {
104 print " ", scalar localtime($start), " ($start) ";
106 foreach my $val (@$line) {
107 printf "%12.1f ", $val;
112 See the examples directory for more ways to use this extension.
116 Tobias Oetiker E<lt>oetiker@ee.ethz.chE<gt>