Sha256: 1d0c74981166234c6dd5535ec9747d95c05b9c09afdb16a98e954467f7210849

Contents?: true

Size: 653 Bytes

Versions: 4

Compression:

Stored size: 653 Bytes

Contents

=begin rdoc
  Basic monitor on the cpu stats
=end
require "poolparty"

module Web
  module Master
    # Get the average web request capabilities over the cloud
    def web
      nodes.size > 0 ? nodes.inject(0) {|i,a| i += a.web } / nodes.size : 0.0
    end
  end

  module Remote
    def web
      out = begin
        str = run("httperf --server localhost --port #{Application.client_port} --num-conn 3 --timeout 5 | grep 'Request rate'")
        str[/[.]* ([\d]*\.[\d]*) [.]*/, 0].chomp.to_f
      rescue Exception => e
        0.0
      end
      PoolParty.message "Web requests: #{out}"
      out
    end
  end
  
end

PoolParty.register_monitor Web

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
auser-poolparty-0.1.0 lib/poolparty/monitors/web.rb
auser-poolparty-0.1.1 lib/poolparty/monitors/web.rb
auser-poolparty-0.1.2 lib/poolparty/monitors/web.rb
jtzemp-poolparty-0.1.2 lib/poolparty/monitors/web.rb