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