Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rrd_update(object, counter, metrics)
- rrdpath = "#{Rails.root.join("tmp")}/rrd/#{object.id}"
- rrdfile = "#{rrdpath}/#{counter}.rrd"
- # If the rrd doesn't exist, we have to create it
- if !File.exist?(rrdfile)
- counters = Array.new
- metrics.first[1].each_key do |key|
- counters.push("DS:#{key}:GAUGE:120:U:U")
- end
- pp counters
- # TODO: Look at earliest metric time
- start = 0
- RRD.create(rrdfile, "--start", start, "--step", "60",
- ^counters, "RRA:AVERAGE:0.5:1:60")
- end
- #RRD.update(rrdfile, "time:counter")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement