Module: NginxUtils::Status

Defined in:
lib/nginx_utils/status.rb

Class Method Summary collapse

Class Method Details

.get(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/nginx_utils/status.rb', line 6

def get(options={})
  host = options.fetch(:host, "localhost")
  port = options.fetch(:port, 80)
  path = options.fetch(:path, "/nginx_status")

  req = Net::HTTP::Get.new(path)
  res = Net::HTTP.start(host, port){|http| http.request(req)}
  parse res.body.split("\n").map{|l| l.split}
end