require "RRD"
RRD.create(
rrd,
- "--start", "#{start - 1}",
"--step", "300",
- "DS:a:GAUGE:600:U:U",
+ "DS:a:GAUGE:600:U:U",
"DS:b:GAUGE:600:U:U",
"RRA:AVERAGE:0.5:1:300")
$: << '/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}",
puts
puts "fetching data from #{rrd}"
- (fstart, fend, data) = RRD.fetch(rrd, "--start", start.to_s, "--end",
+ (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
If you use the B<--ruby-site-install> configure option you can drop the $:
-line since the rrdtool module will be found automatically.
+line since the RRDtool module will be found automatically.
-If rrdtool runs into trouble, it will throw an exception which you might
+If RRDtool runs into trouble, it will throw an exception which you might
want to catch.
=head1 SEE ALSO