passenger_mon 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/passenger_mon +3 -16
- metadata +25 -47
data/bin/passenger_mon
CHANGED
@@ -32,7 +32,7 @@ end.parse!
|
|
32
32
|
# set option defaults
|
33
33
|
options[:interval] ||= 30
|
34
34
|
options[:threshold] ||= 400
|
35
|
-
options[:log] ||= "/var/log/
|
35
|
+
options[:log] ||= "/var/log/passenger_mon.log"
|
36
36
|
options[:pidfile] ||= "/tmp/passenger_mon.pid"
|
37
37
|
options[:threshold] = options[:threshold].to_i
|
38
38
|
|
@@ -62,28 +62,15 @@ Signal.trap('INT') do
|
|
62
62
|
abort("\n")
|
63
63
|
end
|
64
64
|
|
65
|
-
kill_attempts = {}
|
66
|
-
|
67
65
|
loop do
|
68
66
|
logger.info "Checking for naughty processes..."
|
69
67
|
|
70
|
-
results = `passenger-memory-stats`
|
71
|
-
results = results.split("\n").grep(/
|
68
|
+
results = `passenger-memory-stats 2> /dev/null`
|
69
|
+
results = results.split("\n").grep(/Rack/)
|
72
70
|
|
73
71
|
results.each do |res|
|
74
72
|
pid, vm_size, vm_size_label, mem_res, *bullshit = res.strip.split(/\s+/)
|
75
|
-
|
76
|
-
# ultimately, we need to have some logic in here that decides when
|
77
|
-
# it's appropriate to do a kill -9. If a process has truly run out of
|
78
|
-
# control (say, it's trying to load a massive table into memory at once)
|
79
|
-
# then we need to be more aggressive with how we terminate the process.
|
80
73
|
if mem_res.to_i >= options[:threshold]
|
81
|
-
if kill_attempts.has_key?(pid)
|
82
|
-
kill_attempts[pid] += 1
|
83
|
-
else
|
84
|
-
kill_attempts[pid] = 1
|
85
|
-
end
|
86
|
-
|
87
74
|
logger.info "Killing process #{pid} using #{mem_res.to_i}mb of ram (Threshold=#{options[:threshold]}mb)"
|
88
75
|
|
89
76
|
# passenger treats the USR1 signal as a graceful shutdown.
|
metadata
CHANGED
@@ -1,76 +1,54 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: passenger_mon
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 0.2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Alex Sharp
|
14
9
|
- Rick Bradley
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
date: 2011-03-09 00:00:00 -08:00
|
20
|
-
default_executable:
|
13
|
+
date: 2012-10-01 00:00:00.000000000 Z
|
21
14
|
dependencies: []
|
22
|
-
|
23
|
-
|
24
|
-
email:
|
15
|
+
description: When you need to control the memory footprint of your passenger processes
|
16
|
+
email:
|
25
17
|
- ajsharp@gmail.com
|
26
|
-
executables:
|
18
|
+
executables:
|
27
19
|
- passenger_mon
|
28
20
|
extensions: []
|
29
|
-
|
30
|
-
extra_rdoc_files:
|
21
|
+
extra_rdoc_files:
|
31
22
|
- README.md
|
32
23
|
- MIT-LICENSE
|
33
|
-
files:
|
24
|
+
files:
|
34
25
|
- README.md
|
35
26
|
- MIT-LICENSE
|
36
|
-
-
|
37
|
-
|
27
|
+
- !binary |-
|
28
|
+
YmluL3Bhc3Nlbmdlcl9tb24=
|
38
29
|
homepage: https://github.com/ajsharp/passenger_mon
|
39
30
|
licenses: []
|
40
|
-
|
41
31
|
post_install_message:
|
42
32
|
rdoc_options: []
|
43
|
-
|
44
|
-
require_paths:
|
33
|
+
require_paths:
|
45
34
|
- lib
|
46
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
36
|
none: false
|
48
|
-
requirements:
|
49
|
-
- -
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
hash: 57
|
52
|
-
segments:
|
53
|
-
- 1
|
54
|
-
- 8
|
55
|
-
- 7
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
56
40
|
version: 1.8.7
|
57
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
42
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
hash: 23
|
63
|
-
segments:
|
64
|
-
- 1
|
65
|
-
- 3
|
66
|
-
- 6
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
67
46
|
version: 1.3.6
|
68
47
|
requirements: []
|
69
|
-
|
70
48
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.
|
49
|
+
rubygems_version: 1.8.24
|
72
50
|
signing_key:
|
73
51
|
specification_version: 3
|
74
|
-
summary: Rails process monitoring for passenger 3
|
52
|
+
summary: Rails process memory monitoring for passenger 3
|
75
53
|
test_files: []
|
76
|
-
|
54
|
+
has_rdoc:
|