Skip to content

Instantly share code, notes, and snippets.

@octplane
Created March 12, 2013 09:55
Show Gist options
  • Save octplane/5141659 to your computer and use it in GitHub Desktop.
Save octplane/5141659 to your computer and use it in GitHub Desktop.
How to talk to graphite.
send_graphite("munin5.mysql.slow_count %.5f %d" % [@slow_count.to_f/@interval, Time.now.to_i])
def send_graphite(message)
hostname = 'graphite'
port = 2003
begin
s = TCPSocket.open(hostname, port)
s.puts(message)
s.close
rescue Exception => e
puts "Exception #{e} while sending \"#{message}\" to graphite"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment