city-watch 0.4.7 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,18 +13,11 @@ class Nginx
13
13
  acc
14
14
  end
15
15
 
16
- require 'net/http'
17
- require 'net/https'
18
- uri = URI.parse("http://localhost/nginx_status")
19
- http = Net::HTTP.new(uri.host, uri.port)
20
- req = Net::HTTP::Get.new(uri.path)
21
- resp = http.request(req)
22
- case resp
23
- when Net::HTTPSuccess
24
- active, garbage, nums, open = resp.read_body.split("\n")
25
- accepts, handled, requests = nums.split
26
- garbage, reading, garbage, writing, garbage, waiting = open.split
27
- out.merge({:active_connections => active.gsub(/.*:/,''), :accepted => accepts, :handled => handled, :requests => requests, :reading => reading, :writing => writing, :waiting => waiting})
16
+ if `curl -I http://localhost/nginx_status`[/^HTTP\/1.1 200/]
17
+ active, garbage, nums, open = `curl http://localhost/nginx_status`.split("\n")
18
+ accepts, handled, requests = nums.split
19
+ garbage, reading, garbage, writing, garbage, waiting = open.split
20
+ out.merge({:active_connections => active.gsub(/.*:/,'').to_i, :accepted => accepts.to_i, :handled => handled.to_i, :requests => requests.to_i, :reading => reading.to_i, :writing => writing.to_i, :waiting => waiting.to_i})
28
21
  end
29
22
 
30
23
  out.merge({:num_masters => out[:masters].count, :num_workers => out[:workers].count, :summary => [:num_masters, :num_workers, :active_connections]})
@@ -7,12 +7,13 @@ class Unicorns
7
7
  if line[:command][/^start master/]
8
8
  acc[:masters] << line
9
9
  acc[:master_memory] += line[:rss].to_i
10
+ acc[:total_memory] += line[:rss].to_i
10
11
  end
11
12
  if line[:command][/^start worker/]
12
13
  acc[:workers] << line
13
14
  acc[:worker_memory] += line[:rss].to_i
15
+ acc[:total_memory] += line[:rss].to_i
14
16
  end
15
- acc[:total_memory] += line[:rss].to_i
16
17
  acc
17
18
  end
18
19
  out.merge({:num_masters => out[:masters].count, :num_workers => out[:workers].count, :summary => [:num_masters, :num_workers]})
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CityWatch
2
- VERSION = "0.4.7"
2
+ VERSION = "0.4.9"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: city-watch
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.7
5
+ version: 0.4.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - John Bragg