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 Note: Due to design limitations, RRDp::cmd does not support the
44 "graph -" command - use "graphv -" instead.
45
46 $answer = RRDp::read
47 read RRDtool's response to your command. Note that the $answer
48 variable will only contain a pointer to the returned data. The
49 reason for this is, that RRDtool can potentially return quite
50 excessive amounts of data and we don't want to copy this around
51 in memory. So when you want to access the contents of $answer
52 you have to use $$answer which dereferences the variable.
53
54 $status = RRDp::end
55 terminates RRDtool and returns RRDtool's status ...
56
57 $RRDp::user, $RRDp::sys, $RRDp::real
58 these variables will contain totals of the user time, system
59 time and real time as seen by RRDtool. User time is the time
60 RRDtool is running, System time is the time spent in system
61 calls and real time is the total time RRDtool has been running.
62
63 The difference between user + system and real is the time spent
64 waiting for things like the hard disk and new input from the
65 Perl script.
66
67 $RRDp::error_mode and $RRDp::error
68 If you set the variable $RRDp::error_mode to the value 'catch'
69 before you run RRDp::read a potential ERROR message will not
70 cause the program to abort but will be returned in this
71 variable. If no error occurs the variable will be empty.
72
73 $RRDp::error_mode = 'catch';
74 RRDp::cmd qw(info file.rrd);
75 print $RRDp::error if $RRDp::error;
76
78 use RRDp;
79 RRDp::start "/usr/local/bin/rrdtool";
80 RRDp::cmd qw(create demo.rrd --step 100
81 DS:in:GAUGE:100:U:U
82 RRA:AVERAGE:0.5:1:10);
83 $answer = RRDp::read;
84 print $$answer;
85 ($usertime,$systemtime,$realtime) = ($RRDp::user,$RRDp::sys,$RRDp::real);
86
88 For more information on how to use RRDtool, check the manpages.
89
91 Tobias Oetiker <tobi@oetiker.ch>
92
93
94
95perl v5.32.1 2021-01-27 RRDp(3)