Skip to content

Instantly share code, notes, and snippets.

@goyox86
Created December 1, 2014 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goyox86/4290e0c95abd86d76858 to your computer and use it in GitHub Desktop.
Save goyox86/4290e0c95abd86d76858 to your computer and use it in GitHub Desktop.
require 'influxdb'
class InfluxdbEmitter
def initialize
@username = "root"
@password = "root"
@database = "rbx1"
#InfluxDB::Client.new.create_database(@database)
@influxdb = InfluxDB::Client.new @database, username: @username,
password: @password
end
def start!
if RUBY_ENGINE != 'rbx'
puts "Not RBX. Nothing to do here!"
return
end
Thread.new do
loop do
metrics = Rubinius::Metrics.data.keys
metrics.each do |metric|
@influxdb.write_point(metric, { value: Rubinius::Metrics.data[metric] })
end
sleep 1
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment