Advertisement
Guest User

Untitled

a guest
Jun 19th, 2015
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. def rrd_update(object, counter, metrics)
  2. rrdpath = "#{Rails.root.join("tmp")}/rrd/#{object.id}"
  3. rrdfile = "#{rrdpath}/#{counter}.rrd"
  4. # If the rrd doesn't exist, we have to create it
  5. if !File.exist?(rrdfile)
  6. counters = Array.new
  7. metrics.first[1].each_key do |key|
  8. counters.push("DS:#{key}:GAUGE:120:U:U")
  9. end
  10. pp counters
  11. # TODO: Look at earliest metric time
  12. start = 0
  13. RRD.create(rrdfile, "--start", start, "--step", "60",
  14. ^counters, "RRA:AVERAGE:0.5:1:60")
  15. end
  16. #RRD.update(rrdfile, "time:counter")
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement