rack-monitor 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rack/monitor/monitor_app.rb +14 -7
- data/munin/rack_memory +0 -1
- metadata +2 -2
@@ -11,7 +11,10 @@ module Rack::Monitor
|
|
11
11
|
class MonitorApp
|
12
12
|
def initialize(app, options={})
|
13
13
|
@app = app
|
14
|
-
@options = {
|
14
|
+
@options = {
|
15
|
+
:url => '/rack_status',
|
16
|
+
:ignore_addr => ['127.0.0.1']
|
17
|
+
}.merge(options)
|
15
18
|
sensor_class_names = Rack::Monitor.constants.reject { |s| %q(Sensor MonitorApp).include?(s) }
|
16
19
|
@sensors = sensor_class_names.collect { |s| Rack::Monitor.const_get(s).new }
|
17
20
|
@watches = {}
|
@@ -26,17 +29,21 @@ class MonitorApp
|
|
26
29
|
if env["PATH_INFO"] == @options[:url]
|
27
30
|
[200, {'Content-Type' => 'text/plain'}, [monitor_output]]
|
28
31
|
else
|
29
|
-
@
|
30
|
-
|
31
|
-
@watches
|
32
|
+
unless @options[:ignore_addr].include?(env['REMOTE_ADDR'])
|
33
|
+
@sensors.each { |sensor| sensor.before(env) }
|
34
|
+
if @watches.has_key?(env["PATH_INFO"])
|
35
|
+
@watches[env["PATH_INFO"]].each { |sensor| sensor.before(env) }
|
36
|
+
end
|
32
37
|
end
|
33
38
|
|
34
39
|
status, headers, body = @app.call(env)
|
35
40
|
|
36
|
-
|
37
|
-
@watches
|
41
|
+
unless @options[:ignore_addr].include?(env['REMOTE_ADDR'])
|
42
|
+
if @watches.has_key?(env["PATH_INFO"])
|
43
|
+
@watches[env["PATH_INFO"]].each { |sensor| sensor.after(env, status, headers, body) }
|
44
|
+
end
|
45
|
+
@sensors.each { |sensor| sensor.after(env, status, headers, body) }
|
38
46
|
end
|
39
|
-
@sensors.each { |sensor| sensor.after(env, status, headers, body) }
|
40
47
|
[status, headers, body]
|
41
48
|
end
|
42
49
|
end
|
data/munin/rack_memory
CHANGED
@@ -65,7 +65,6 @@ if ( defined $ARGV[0] and $ARGV[0] eq "config" )
|
|
65
65
|
print "graph_category Http\n";
|
66
66
|
foreach my $port (@PORTS) {
|
67
67
|
print "memory$port.label Port $port\n";
|
68
|
-
print "memory$port.draw AREA\n";
|
69
68
|
print "memory$port.info Memory used by rack process.\n";
|
70
69
|
}
|
71
70
|
exit 0;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pirmin Kalberer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-17 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|