Created
October 22, 2013 22:32
-
-
Save ymek/7109337 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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