.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "RRDp 3pm" .TH RRDp 3pm 2024-02-29 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME RRDp \- Attach RRDtool from within a perl script via a set of pipes; .SH SYNOPSIS .IX Header "SYNOPSIS" use \fBRRDp\fR .PP \&\fBRRDp::start\fR \fIpath to RRDtool executable\fR .PP \&\fBRRDp::cmd\fR \fIrrdtool commandline\fR .PP \&\f(CW$answer\fR = \fBRRD::read\fR .PP \&\f(CW$status\fR = \fBRRD::end\fR .PP \&\fR\f(CB$RRDp::user\fR\fB\fR, \fB\fR\f(CB$RRDp::sys\fR\fB\fR, \fB\fR\f(CB$RRDp::real\fR\fB\fR, \fB\fR\f(CB$RRDp::error_mode\fR\fB\fR, \fB\fR\f(CB$RRDp::error\fR\fB\fR .SH DESCRIPTION .IX Header "DESCRIPTION" With this module you can safely communicate with the RRDtool. .PP After every \fBRRDp::cmd\fR you have to issue an \fBRRDp::read\fR command to get \&\fBRRDtool\fRs answer to your command. The answer is returned as a pointer, in order to speed things up. If the last command did not return any data, \fBRRDp::read\fR will return an undefined variable. .PP If you import the PERFORMANCE variables into your namespace, you can access RRDtool's internal performance measurements. .IP "use \fBRRDp\fR" 8 .IX Item "use RRDp" Load the RRDp::pipe module. .IP "\fBRRDp::start\fR \fIpath to RRDtool executable\fR" 8 .IX Item "RRDp::start path to RRDtool executable" start RRDtool. The argument must be the path to the RRDtool executable .IP "\fBRRDp::cmd\fR \fIrrdtool commandline\fR" 8 .IX Item "RRDp::cmd rrdtool commandline" pass commands on to RRDtool. Check the RRDtool documentation for more info on the RRDtool commands. .Sp \&\fBNote\fR: Due to design limitations, \fBRRDp::cmd\fR does not support the \&\f(CW\*(C`graph \-\*(C'\fR command \- use \f(CW\*(C`graphv \-\*(C'\fR instead. .ie n .IP "$answer = \fBRRDp::read\fR" 8 .el .IP "\f(CW$answer\fR = \fBRRDp::read\fR" 8 .IX Item "$answer = RRDp::read" read RRDtool's response to your command. Note that the \f(CW$answer\fR variable will only contain a pointer to the returned data. The reason for this is, that RRDtool can potentially return quite excessive amounts of data and we don't want to copy this around in memory. So when you want to access the contents of \f(CW$answer\fR you have to use $$answer which dereferences the variable. .ie n .IP "$status = \fBRRDp::end\fR" 8 .el .IP "\f(CW$status\fR = \fBRRDp::end\fR" 8 .IX Item "$status = RRDp::end" terminates RRDtool and returns RRDtool's status ... .ie n .IP "\fR\fB$RRDp::user\fR\fB\fR, \fB\fR\fB$RRDp::sys\fR\fB\fR, \fB\fR\fB$RRDp::real\fR\fB\fR" 8 .el .IP "\fR\f(CB$RRDp::user\fR\fB\fR, \fB\fR\f(CB$RRDp::sys\fR\fB\fR, \fB\fR\f(CB$RRDp::real\fR\fB\fR" 8 .IX Item "$RRDp::user, $RRDp::sys, $RRDp::real" these variables will contain totals of the user time, system time and real time as seen by RRDtool. User time is the time RRDtool is running, System time is the time spent in system calls and real time is the total time RRDtool has been running. .Sp The difference between user + system and real is the time spent waiting for things like the hard disk and new input from the Perl script. .ie n .IP "\fR\fB$RRDp::error_mode\fR\fB\fR and \fB\fR\fB$RRDp::error\fR\fB\fR" 8 .el .IP "\fR\f(CB$RRDp::error_mode\fR\fB\fR and \fB\fR\f(CB$RRDp::error\fR\fB\fR" 8 .IX Item "$RRDp::error_mode and $RRDp::error" If you set the variable \f(CW$RRDp::error_mode\fR to the value 'catch' before you run RRDp::read a potential ERROR message will not cause the program to abort but will be returned in this variable. If no error occurs the variable will be empty. .Sp .Vb 3 \& $RRDp::error_mode = \*(Aqcatch\*(Aq; \& RRDp::cmd qw(info file.rrd); \& print $RRDp::error if $RRDp::error; .Ve .SH EXAMPLE .IX Header "EXAMPLE" .Vb 8 \& use RRDp; \& RRDp::start "/usr/local/bin/rrdtool"; \& RRDp::cmd qw(create demo.rrd \-\-step 100 \& DS:in:GAUGE:100:U:U \& RRA:AVERAGE:0.5:1:10); \& $answer = RRDp::read; \& print $$answer; \& ($usertime,$systemtime,$realtime) = ($RRDp::user,$RRDp::sys,$RRDp::real); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" For more information on how to use RRDtool, check the manpages. .SH AUTHOR .IX Header "AUTHOR" Tobias Oetiker