RRDp(3)
π NAME π
RRDp β attach RRDtool from inside a perl script via a set of pipes β¨ (yes, pipes, we love a good pipe situation)
πΈ SYNOPSIS πΈ
use RRDp
RRDp::start path to RRDtool executable
RRDp::cmd rrdtool commandline
$answer = RRD::read
$status = RRD::end
$RRDp::user, $RRDp::sys, $RRDp::real, $RRDp::error_mode, $RRDp::error
Quick vibe check: that's the whole shape of it, bestie. π
π¦ DESCRIPTION π¦
With this module you can safely communicate with the RRDtool. Like, actually safely. No cap. π«Ά
After every RRDp::cmd you have to issue an RRDp::read command to get RRDtool's answer back to your command. And here's the iconic bit: the answer is returned as a pointer, on purpose, to speed things up. If the last command didn't return any data, RRDp::read will return an undefined variable. That's it, that's the deal. π
If you import the PERFORMANCE variables into your namespace, you can access RRDtool's internal performance measurements. Very main character of them honestly. π
use RRDpβ loads theRRDp::pipemodule. That's the whole job. Load and go. π«RRDp::start path to RRDtool executableβ starts RRDtool. The argument must be the path to the RRDtool executable. No shortcuts, no "it's probably on the PATH", just give it the path. πRRDp::cmd rrdtool commandlineβ passes commands on to RRDtool. Check the RRDtool documentation for more info on all the RRDtool commands. π
β οΈ Note: due to design limitations,RRDp::cmddoes not support thegraph -command β usegraphv -instead. Fr fr, this is the one you'll trip over at 2am. π
$answer = RRDp::readβ reads RRDtool's response to your command. Heads up, the$answervariable will only contain a pointer to the returned data. Why? Because RRDtool can potentially return quite excessive amounts of data and we do not want to copy that around in memory. So when you want to actually access the contents of$answeryou have to use$$answer, which dereferences the variable. Slay, memory efficiency. π$status = RRDp::endβ terminates RRDtool and returns RRDtool's status ... π$RRDp::user,$RRDp::sys,$RRDp::realβ these variables will contain totals of the user time, system time and real time as seen by RRDtool. Lowkey a whole little breakdown:- User time is the time RRDtool is running.
- System time is the time spent in system calls.
- Real time is the total time RRDtool has been running.
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. So basically, the real variable is out here exposing all the waiting. π
$RRDp::error_modeand$RRDp::errorβ if you set the variable$RRDp::error_modeto the value'catch'before you runRRDp::read, a potential ERROR message will not cause the program to abort, but will be returned in this variable instead. If no error occurs the variable will be empty. Genuinely such a glow-up for debugging. π
$RRDp::error_mode = 'catch';
RRDp::cmd qw(info file.rrd);
print $RRDp::error if $RRDp::error;
β¨ EXAMPLE β¨
Look at her go. π
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);
See that $$answer? Dereference. We told you. π§
π₯ SEE ALSO π₯
For more information on how to use RRDtool, check the manpages. They're right there, go read them, iykyk. π
π AUTHOR π
Tobias Oetiker <tobi@oetiker.ch>
Okay bestie, that's the whole page β signed off from the perl v5.44.0 era, dated 2026-10-17, straight from the RRDp(3) files. Go forth and pipe responsibly. πππ¦β
π¦ where this page comes from
- arch rolling: rrdtool 1.11.0-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms