3 rrdruby - About the RRD Ruby bindings
13 "RRA:AVERAGE:0.5:1:300")
17 The B<rrdtool> functions are directly callable via the Ruby programming
18 language. This wrapper implementation has been written from the scratch
21 The API's simply expects string parameters to the functions. Please refer
22 to the other B<rrdtool> documentation for functions and valid arguments.
26 $: << '/path/to/rrdtool/lib/ruby/1.8/i386-linux'
35 "--start", "#{start - 1}",
39 "RRA:AVERAGE:0.5:1:300")
42 puts "updating #{rrd}"
43 start.to_i.step(start.to_i + 300 * 300, 300) { |i|
44 RRD.update(rrd, "#{i}:#{rand(100)}:#{Math.sin(i / 800) * 50 + 50}")
48 puts "fetching data from #{rrd}"
49 (fstart, fend, data, step) = RRD.fetch(rrd, "--start", start.to_s, "--end",
50 (start + 300 * 300).to_s, "AVERAGE")
51 puts "got #{data.length} data points from #{fstart} to #{fend}"
54 puts "generating graph #{name}.png"
57 "--title", " RubyRRD Demo",
58 "--start", "#{start+3600}",
59 "--end", "start + 1000 min",
63 "DEF:a=#{rrd}:a:AVERAGE",
64 "DEF:b=#{rrd}:b:AVERAGE",
65 "CDEF:line=TIME,2400,%,300,LT,a,UNKN,IF",
67 "AREA:line#0022e9:alpha",
71 If you use the B<--ruby-site-install> configure option you can drop the $:
72 line since the rrdtool module will be found automatically.
74 If rrdtool runs into trouble, it will throw an exception which you might
79 rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast,
84 Loïs Lherbier E<lt>lois.lherbier@covadis.chE<gt>
86 Miles Egan E<lt>miles@caddr.comE<gt>