Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RRD::Base#fetch returns different values in the "time" column than 'rrdtool fetch' #29

Open
dgutov opened this issue Feb 19, 2014 · 1 comment

Comments

@dgutov
Copy link

dgutov commented Feb 19, 2014

Take this file:

require 'rrd'

rrd = RRD::Base.new("test.rrd")

time = Time.now.to_i / 300 * 300

rrd.create!(start: time, step: 5.minutes) do
  datasource "foo", type: :gauge, heartbeat: 10.minutes, min: 0.0, max: 1000000000.0
  archive :max, every: 5.minutes, during: (5*115200).minutes
end

rrd.update(time, 500)
rrd.update(time + 300, 600)
rrd.update(time + 600, 700)

puts "#{time} to #{time + 600}"

rrd.fetch!(:max, start: time, end: time + 600).each do |row|
  puts row.join("\t")
end

Compare its output with the command-line tool:

$ ruby test.rb
1392837600 to 1392838200
time    foo
1392837600  600.0
1392837900  700.0
1392838200  NaN
$ rrdtool fetch test.rrd MAX -s 1392837600 -e 1392838200
                            foo

1392837900: 6,0000000000e+02
1392838200: 7,0000000000e+02
1392838500: -nan

All time values returned by #fetch are smaller by the value of step.

@hachpai
Copy link

hachpai commented Dec 8, 2015

Have the same, all values are shifted by one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants