1RRDp(3) User Contributed Perl Documentation RRDp(3)
2
3
4
6 RRDp - Attach RRDtool from within a perl script via a set of pipes;
7
9 use RRDp
10
11 RRDp::start path to RRDtool executable
12
13 RRDp::cmd rrdtool commandline
14
15 $answer = RRD::read
16
17 $status = RRD::end
18
19 $RRDp::user, $RRDp::sys, $RRDp::real, $RRDp::error_mode, $RRDp::error
20
22 With this module you can safely communicate with the RRDtool.
23
24 After every RRDp::cmd you have to issue an RRDp::read command to get
25 RRDtools answer to your command. The answer is returned as a pointer,
26 in order to speed things up. If the last command did not return any
27 data, RRDp::read will return an undefined variable.
28
29 If you import the PERFORMANCE variables into your namespace, you can
30 access RRDtool's internal performance measurements.
31
32 use RRDp
33 Load the RRDp::pipe module.
34
35 RRDp::start path to RRDtool executable
36 start RRDtool. The argument must be the path to the RRDtool
37 executable
38
39 RRDp::cmd rrdtool commandline
40 pass commands on to RRDtool. check the RRDtool documentation
41 for more info on the RRDtool commands.
42
43 $answer = RRDp::read
44 read RRDtool's response to your command. Note that the $answer
45 variable will only contain a pointer to the returned data. The
46 reason for this is, that RRDtool can potentially return quite
47 excessive amounts of data and we don't want to copy this around
48 in memory. So when you want to access the contents of $answer
49 you have to use $$answer which dereferences the variable.
50
51 $status = RRDp::end
52 terminates RRDtool and returns RRDtool's status ...
53
54 $RRDp::user, $RRDp::sys, $RRDp::real
55 these variables will contain totals of the user time, system
56 time and real time as seen by RRDtool. User time is the time
57 RRDtool is running, System time is the time spend in system
58 calls and real time is the total time RRDtool has been running.
59
60 The difference between user + system and real is the time spent
61 waiting for things like the hard disk and new input from the
62 perl script.
63
64 $RRDp::error_mode and $RRDp::error
65 If you set the variable $RRDp::error_mode to the value 'catch'
66 before you run RRDp::read a potential ERROR message will not
67 cause the program to abort but will be returned in this vari‐
68 able. If no error occurs the variable will be empty.
69
70 $RRDp::error_mode = 'catch';
71 RRDp::cmd qw(info file.rrd);
72 print $RRDp::error if $RRDp::error;
73
75 use RRDp;
76 RRDp::start "/usr/local/bin/rrdtool";
77 RRDp::cmd qw(create demo.rrd --step 100
78 DS:in:GAUGE:100:U:U
79 RRA:AVERAGE:0.5:1:10);
80 $answer = RRDp::read;
81 print $$answer;
82 ($usertime,$systemtime,$realtime) = ($RRDp::user,$RRDp::sys,$RRDp::real);
83
85 For more information on how to use RRDtool, check the manpages.
86
88 Tobias Oetiker <tobi@oetiker.ch>
89
90
91
92perl v5.8.8 2008-02-17 RRDp(3)