You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well, the fetch command gets all data for an archive type not a datasource one.
Try something like this:
rrd.fetch(:average).each {|line| puts line.inspect}
If I am not mistaken, line[0] contains all datasources' titles, the first column in all lines contains the timestamp unix time.
I am trying to fetch data from a rrd via, but don't know how ?
Here is some code
rrd = RRD::Base.new("myrrd.rrd")
tend = Time.now
tstart = tend - 1.month
tstep = 5.minutes
rrd.create :start => Time.now - 1.year, :step => tstep do
datasource "idle", :type => :gauge, :heartbeat => tstep, :min => 0, :max => 100
datasource "irq", :type => :gauge, :heartbeat => tstep, :min => 0, :max => 100
datasource "softirq", :type => :gauge, :heartbeat => tstep, :min => 0, :max => 100
archive :average, :every => 10.minutes, :during => 1.year
end
t = tstart
while t <= tend
rrd.update t, rand(100),rand(100),rand(100)
t = t + tstep
end
now fetch data each datasource ????
rrd.fetch("idle").each do |line|
.....
end
The text was updated successfully, but these errors were encountered: