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

DESCRIPTION

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

NOTE

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

AUTHOR

130       Tobias Oetiker <tobi@oetiker.ch>
131
132
133
134perl v5.10.1                      2017-03-21                           RRDs(3)
Impressum