Send metrics to graphite (if configured)

This commit is contained in:
Scott Schneider 2013-11-12 15:03:34 -08:00
parent 57975a489f
commit 77fe40b59b
2 changed files with 25 additions and 0 deletions

17
lib/graphite.rb Executable file
View file

@ -0,0 +1,17 @@
require 'rubygems' unless defined?(Gem)
require 'graphite-api'
class Graphite
def initialize(
s = 'graphite'
)
@server = s
end
def log path, value
socket = TCPSocket.new(@server, 2003)
socket.puts "#{path} #{value} #{Time.now.to_i}"
socket.close
end
end