Permalink
Browse files

quick restructure and mention curb gem

  • Loading branch information...
1 parent 890f0c6 commit 7c4a576326df9b646b0792279e771257f200e9f3 @ripienaar committed Apr 26, 2012
View
@@ -0,0 +1 @@
+Rewrite to use - http://curb.rubyforge.org/
@@ -1,5 +1,5 @@
-metadata :name => "SimpleRPC URL Testing Agent",
- :description => "Agent that connects to a URL and returns some statistics",
+metadata :name => "URL Tester",
+ :description => "Agent that connects to a URL and returns some statistics",
:author => "R.I.Pienaar",
:license => "GPLv2",
:version => "1.2",
@@ -9,7 +9,7 @@ metadata :name => "SimpleRPC URL Testing Agent",
action "perftest", :description => "Permform URL test" do
display :always
- input :url,
+ input :url,
:prompt => "URL",
:description => "The URL to test, only http is supported",
:type => :string,
File renamed without changes.
@@ -23,18 +23,14 @@ end
begin
tester = rpcclient("urltest", :options => options)
- tester.perftest(:url => url).each do |result|
+ results = tester.perftest(:url => url)
+
+ puts "%s Tester Location DNS Connect Pre-xfer Start-xfer Total Bytes Fetched%s" % [ MCollective::RPC::Helpers.color(:bold), MCollective::RPC::Helpers.color(:reset) ]
+
+ results.sort_by{|r| r[:data][:totaltime] rescue 0}.each do |result|
res = result[:data]
- puts "Tester Node: #{res[:testerlocation]}"
- puts " Lookup Time: #{res[:lookuptime]}"
- puts " Connect Time: #{res[:connectime]}"
- puts " Pre-Xfer Time: #{res[:prexfertime]}"
- puts " Start-Xfer Time: #{res[:startxfer]}"
- puts " Total Time: #{res[:totaltime]}"
- puts " Bytes Fetched: #{res[:bytesfetched]}"
- puts ""
- puts ""
+ puts "%20s: %.4f %.4f %.4f %.4f %.4f %d" % [ res[:testerlocation], res[:lookuptime], res[:connectime], res[:prexfertime], res[:startxfer], res[:totaltime], res[:bytesfetched]]
end
rescue Exception => e
raise e

0 comments on commit 7c4a576

Please sign in to comment.