RRDRUBY(1)
π RRDRUBY(1) π
okay so this is the page for rrdruby, like, the Ruby bindings for rrdtool β it lives in the rrdtool manual set and honestly? it's a whole vibe. grab a snack, bestie, we're learning Ruby + RRD today π
β¨ NAME β¨
rrdruby β the β¨teaβ¨ on the RRD Ruby bindings, fr fr π«Ά
πΈ SYNOPSIS πΈ
require "RRD"
RRD.create(
rrd,
"--step", "300",
"DS:a:GAUGE:600:U:U",
"DS:b:GAUGE:600:U:U",
"RRA:AVERAGE:0.5:1:300")
that's it. that's the whole entrance. iconic π
π¦ DESCRIPTION π¦
so basically, the rrdtool functions are directly callable through the Ruby programming language β no middleman, no drama. this wrapper implementation was written from the scratch (without SWIG), which is lowkey a flex ngl π
the API simply expects string parameters passed to the functions. that's the whole contract, no cap. and for the actual functions and which arguments are valid? please refer to the other rrdtool documentation β that's where the lore lives πβ¨
π EXAMPLE π
here's a full little demo, copied exactly because we do not mess with code in this house:
$: << '/path/to/rrdtool/lib/ruby/1.8/i386-linux'
require "RRD"
name = "test"
rrd = "#{name}.rrd"
start = Time.now.to_i
RRD.create(
rrd,
"--start", "#{start - 1}",
"--step", "300",
"DS:a:GAUGE:600:U:U",
"DS:b:GAUGE:600:U:U",
"RRA:AVERAGE:0.5:1:300")
puts
puts "updating #{rrd}"
start.to_i.step(start.to_i + 300 * 300, 300) { |i|
RRD.update(rrd, "#{i}:#{rand(100)}:#{Math.sin(i / 800) * 50 + 50}")
}
puts
puts "fetching data from #{rrd}"
(fstart, fend, data, step) = RRD.fetch(rrd, "--start", start.to_s, "--end",
(start + 300 * 300).to_s, "AVERAGE")
puts "got #{data.length} data points from #{fstart} to #{fend}"
puts
puts "generating graph #{name}.png"
RRD.graph(
"#{name}.png",
"--title", " RubyRRD Demo",
"--start", "#{start+3600}",
"--end", "start + 1000 min",
"--interlaced",
"--imgformat", "PNG",
"--width=450",
"DEF:a=#{rrd}:a:AVERAGE",
"DEF:b=#{rrd}:b:AVERAGE",
"CDEF:line=TIME,2400,%,300,LT,a,UNKN,IF",
"AREA:b#00b6e4:beta",
"AREA:line#0022e9:alpha",
"LINE3:line#ff0000")
puts
so we're creating, updating, fetching, and graphing β the full glow-up pipeline ππ
π THE LIL' NOTES SECTION π
- if you use the
--ruby-site-installconfigure option, you can drop the$:line β because theRRDtoolmodule will be found automatically, no manual path-hunting needed β¨ - and if
RRDtoolruns into trouble, it will throw an exception, which you might want to catch. like, please catch it. don't just let it scream into the void π
fr fr: string parameters only, and catch your exceptions. that's the whole personality π«Ά
π SEE ALSO π
rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport, rrdinfo
go read them all, they're all bangers π₯
π AUTHOR π
LoΓ―s Lherbier <lois.lherbier@covadis.ch>
Miles Egan <miles@caddr.com>
absolute legends, both of them π«‘π
and that's the page!! version 1.11.0, dated 2026-10-17 β written by the icons above, brought to you by the rrdtool girlies. mwah, go forth and graph πΈπ¦π
π¦ 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