Skip to content

Instantly share code, notes, and snippets.

@ymek
Created October 22, 2013 22:32
Show Gist options
  • Select an option

  • Save ymek/7109337 to your computer and use it in GitHub Desktop.

Select an option

Save ymek/7109337 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'benchmark'
def graphite_test(host)
system("echo 'ap.test.foo 1 #{Time.now.to_i}' | nc #{host} 2003")
# send(metric_path value unix_timestamp)
# example: send("foo.bar.baz my_value 12345678")
end
%w(
fenris-i-b923bcc1.prod.falcon.utorrent.com
panoptes.bittorrent.com
).each do |host|
processing_time = Benchmark.realtime do
graphite_test(host)
end
elapsed = processing_time > 60 ? "#{(processing_time / 60).to_i}m #{(processing_time % 60).round(2)}s" : "#{processing_time.round(2)}s"
puts "Processed #{host} in #{elapsed}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment