1RRDs(3)               User Contributed Perl Documentation              RRDs(3)
2
3
4

NAME

6       RRDs - Access RRDtool as a shared module
7

SYNOPSIS

9         use RRDs;
10         RRDs::error
11         RRDs::last ...
12         RRDs::info ...
13         RRDs::create ...
14         RRDs::update ...
15         RRDs::updatev ...
16         RRDs::graph ...
17         RRDs::fetch ...
18         RRDs::tune ...
19         RRDs::times(start, end)
20         RRDs::dump ...
21         RRDs::restore ...
22         RRDs::flushcached ...
23

DESCRIPTION

25   Calling Sequence
26       This module accesses RRDtool functionality directly from within Perl.
27       The arguments to the functions listed in the SYNOPSIS are explained in
28       the regular RRDtool documentation. The command line call
29
30        rrdtool update mydemo.rrd --template in:out N:12:13
31
32       gets turned into
33
34        RRDs::update ("mydemo.rrd", "--template", "in:out", "N:12:13");
35
36       Note that
37
38        --template=in:out
39
40       is also valid.
41
42       The RRDs::times function takes two parameters:  a "start" and "end"
43       time.  These should be specified in the AT-STYLE TIME SPECIFICATION
44       format used by RRDtool.  See the rrdfetch documentation for a detailed
45       explanation on how to specify time.
46
47   Error Handling
48       The RRD functions will not abort your program even when they can not
49       make sense out of the arguments you fed them.
50
51       The function RRDs::error should be called to get the error status after
52       each function call. If RRDs::error does not return anything then the
53       previous function has completed its task successfully.
54
55        use RRDs;
56        RRDs::update ("mydemo.rrd","N:12:13");
57        my $ERR=RRDs::error;
58        die "ERROR while updating mydemo.rrd: $ERR\n" if $ERR;
59
60   Return Values
61       The functions RRDs::last, RRDs::graph, RRDs::info, RRDs::fetch and
62       RRDs::times return their findings.
63
64       RRDs::last returns a single INTEGER representing the last update time.
65
66        $lastupdate = RRDs::last ...
67
68       RRDs::graph returns an ARRAY containing the x-size and y-size of the
69       created image and a pointer to an array with the results of the PRINT
70       arguments.
71
72        ($result_arr,$xsize,$ysize) = RRDs::graph ...
73        print "Imagesize: ${xsize}x${ysize}\n";
74        print "Averages: ", (join ", ", @$averages);
75
76       RRDs::info returns a pointer to a hash. The keys of the hash represent
77       the property names of the RRD and the values of the hash are the values
78       of the properties.
79
80        $hash = RRDs::info "example.rrd";
81        foreach my $key (keys %$hash){
82          print "$key = $$hash{$key}\n";
83        }
84
85       RRDs::graphv takes the same parameters as RRDs::graph but it returns a
86       pointer to hash. The hash returned contains meta information about the
87       graph. Like its size as well as the position of the graph area on the
88       image.  When calling with and empty filename than the contents of the
89       graph will be returned in the hash as well (key 'image').
90
91       RRDs::updatev also returns a pointer to hash. The keys of the hash are
92       concatenated strings of a timestamp, RRA index, and data source name
93       for each consolidated data point (CDP) written to disk as a result of
94       the current update call. The hash values are CDP values.
95
96       RRDs::fetch is the most complex of the pack regarding return values.
97       There are 4 values. Two normal integers, a pointer to an array and a
98       pointer to a array of pointers.
99
100         my ($start,$step,$names,$data) = RRDs::fetch ...
101         print "Start:       ", scalar localtime($start), " ($start)\n";
102         print "Step size:   $step seconds\n";
103         print "DS names:    ", join (", ", @$names)."\n";
104         print "Data points: ", $#$data + 1, "\n";
105         print "Data:\n";
106         for my $line (@$data) {
107           print "  ", scalar localtime($start), " ($start) ";
108           $start += $step;
109           for my $val (@$line) {
110             printf "%12.1f ", $val;
111           }
112           print "\n";
113         }
114
115       RRDs::times returns two integers which are the number of seconds since
116       epoch (1970-01-01) for the supplied "start" and "end" arguments,
117       respectively.
118
119       See the examples directory for more ways to use this extension.
120

NOTE

122       If you are manipulating the TZ variable you should also call the POSIX
123       function tzset(3) to initialize all internal state of the library for
124       properly operating in the timezone of your choice.
125
126        use POSIX qw(tzset);
127        $ENV{TZ} = 'CET';
128        POSIX::tzset();
129

AUTHOR

131       Tobias Oetiker <tobi@oetiker.ch>
132
133
134
135perl v5.16.3                      2015-11-20                           RRDs(3)
Impressum