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.
- data/lib/city_watch/watchmen/nginx.rb +5 -12
- data/lib/city_watch/watchmen/unicorns.rb +2 -1
- data/lib/version.rb +1 -1
- metadata +1 -1
@@ -13,18 +13,11 @@ class Nginx
|
|
13
13
|
acc
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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