munin-plugins-rails 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +74 -0
- data/VERSION +1 -0
- data/bin/request-log-analyzer-munin +4 -0
- data/lib/munin-plugins-rails.rb +7 -0
- data/lib/munin/command.rb +77 -0
- data/lib/munin/plugins/passenger_memory_stats.rb +42 -0
- data/lib/munin/plugins/passenger_queue.rb +27 -0
- data/lib/munin/plugins/passenger_status.rb +46 -0
- data/lib/munin/plugins/rails_database_time.rb +49 -0
- data/lib/munin/plugins/rails_request_duration.rb +47 -0
- data/lib/munin/plugins/rails_request_error.rb +42 -0
- data/lib/munin/plugins/rails_requests.rb +51 -0
- data/lib/munin/plugins/rails_view_render_time.rb +47 -0
- data/lib/munin/rails_plugin.rb +83 -0
- data/lib/munin/request_log_analyzer_plugin.rb +115 -0
- data/munin/munin_passenger_memory_stats +48 -0
- data/munin/munin_passenger_queue +51 -0
- data/munin/munin_passenger_status +50 -0
- data/munin/munin_rails_database_time +53 -0
- data/munin/munin_rails_request_duration +53 -0
- data/munin/munin_rails_request_error +54 -0
- data/munin/munin_rails_requests +54 -0
- data/munin/munin_rails_view_render_time +53 -0
- metadata +90 -0
data/README.rdoc
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
= Munin-Rails-Plugins
|
2
|
+
Collection of Concise Munin plugins for Rails server environments.
|
3
|
+
This will make monitoring your rails app a piece of cake.
|
4
|
+
|
5
|
+
This project contains munin plugins that not only work in munin, but are also concise (see references).
|
6
|
+
Most things in this repository rely heavily on the request-log-analyzer gem.
|
7
|
+
|
8
|
+
== What's in the box?
|
9
|
+
* passenger_memory_stats - Munin plugin to monitor the memory usage of passenger application servers.
|
10
|
+
* pasenger_queue - Montoring of passenger queue lenth.
|
11
|
+
* passenger_status - Running, active and maximum number of passenger instances as well as sessions.
|
12
|
+
* rails_database_time - Min, avg, max of database times.
|
13
|
+
* rails_request_duration - Min, avg, max of the total request durations.
|
14
|
+
* rails_request_error - Application errors and process blocker counters.
|
15
|
+
* rails_requests - Get, put, post and delete requests.
|
16
|
+
* rails_view_render_time - Min, avg and max view render times.
|
17
|
+
|
18
|
+
For screenshots, head over to: http://barttenbrinke.github.com/munin-plugins-rails/
|
19
|
+
|
20
|
+
== Installation
|
21
|
+
The plugins follows the default munin installation scheme:
|
22
|
+
git clone git://github.com/barttenbrinke/munin-plugins-rails.git
|
23
|
+
cp munin-plugins-rails/rails_requests /usr/share/munin/plugins/
|
24
|
+
chmod +x /usr/share/munin/plugins/rails_requests
|
25
|
+
ln -s /usr/share/munin/plugins/rails_requests /etc/munin/plugins/rails_requests
|
26
|
+
vi /etc/munin/plugin-conf.d/munin-node
|
27
|
+
|
28
|
+
Paste the configuration from the documentation of rails_requests into the munin-node file.
|
29
|
+
[rails_requests]
|
30
|
+
env.log_file '/path/to/production.log'
|
31
|
+
user www-data
|
32
|
+
command /usr/local/bin/ruby %c
|
33
|
+
|
34
|
+
Run "/etc/munin/plugins/rails_requests autoconf" and "munin-run rails_requests" to test the plugin.
|
35
|
+
|
36
|
+
For more detailed information, see the documentation embedded in the plugin.
|
37
|
+
Each plugin is packed with an example config and a ln -s you can copy.
|
38
|
+
|
39
|
+
== Monitoring multiple applications
|
40
|
+
|
41
|
+
If you want to run the plugin for more than one app the best way is to symlink the plugin multiple times.
|
42
|
+
Also set a different graph_category for each of app. For instance:
|
43
|
+
|
44
|
+
ln -s /usr/share/munin/plugins/rails_requests /etc/munin/plugins/rails_app1_requests
|
45
|
+
ln -s /usr/share/munin/plugins/rails_requests /etc/munin/plugins/rails_app2_requests
|
46
|
+
|
47
|
+
And in the munin-node file:
|
48
|
+
|
49
|
+
[rails_app1_*]
|
50
|
+
env.log_file '/path/to/app1/production.log'
|
51
|
+
env.graph_category App1
|
52
|
+
|
53
|
+
[rails_app2_*]
|
54
|
+
env.log_file '/path/to/app2/production.log'
|
55
|
+
env.graph_category App2
|
56
|
+
|
57
|
+
== Problems
|
58
|
+
* sudo gem install request-log-analyzer
|
59
|
+
* Check if the paths in the plugin configuration are correct.
|
60
|
+
* Make sure the specified user is allowed to write to /tmp and access your rails logfile.
|
61
|
+
|
62
|
+
If you encounter performance problems with your app, please take a look at the request-log-analyzer wiki on
|
63
|
+
examples on how to drill down to the core of your problem. If you want to hire an expert, please visit us at
|
64
|
+
http://railsdoctors.com or mail me at: bart@railsdoctors.com
|
65
|
+
|
66
|
+
Happy monitoring!
|
67
|
+
|
68
|
+
== Additional information
|
69
|
+
* Railsdoctors: http://railsdoctors.com
|
70
|
+
* Request-log-analzer: http://github.com/wvanbergen/request-log-analyzer/
|
71
|
+
* Screenshots http://barttenbrinke.github.com/munin-plugins-rails/
|
72
|
+
* Munin: http://munin.projects.linpro.no/wiki/ConcisePlugins
|
73
|
+
* License: MIT
|
74
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.10
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'erb'
|
3
|
+
module Munin
|
4
|
+
class Command
|
5
|
+
def run(args)
|
6
|
+
if args.first == "install"
|
7
|
+
install_passenger_plugins
|
8
|
+
elsif args.first == "add"
|
9
|
+
args.shift
|
10
|
+
install_application(args)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
PASSENGER_PLUGINS = %W{munin_passenger_memory_stats munin_passenger_queue munin_passenger_status}
|
14
|
+
RAILS_PLUGINS = %W{munin_rails_database_time munin_rails_request_duration munin_rails_request_error munin_rails_requests munin_rails_view_render_time}
|
15
|
+
|
16
|
+
PASSENGER_PLUGIN_CONFIG = <<-DATA
|
17
|
+
[<%= plugin_target_name %>]
|
18
|
+
user root
|
19
|
+
command /usr/local/bin/ruby %c
|
20
|
+
env.passenger_status '/usr/local/bin/passenger-status'
|
21
|
+
env.passenger_memory_stats '/usr/local/bin/passenger-memory-stats'
|
22
|
+
env.graph_category Passenger
|
23
|
+
DATA
|
24
|
+
|
25
|
+
RAILS_PLUGIN_CONFIG = <<-DATA
|
26
|
+
[<%= plugin_target_name %>]
|
27
|
+
env.log_file <%= options[:log_file] %>
|
28
|
+
user root
|
29
|
+
command /usr/local/bin/ruby %c
|
30
|
+
env.request_log_analyzer /usr/local/bin/request-log-analyzer
|
31
|
+
env.graph_category <%= plugin_target_name %>
|
32
|
+
DATA
|
33
|
+
|
34
|
+
def install_application(args)
|
35
|
+
app_name = args.shift
|
36
|
+
log_file = args.shift
|
37
|
+
RAILS_PLUGINS.each do |plugin|
|
38
|
+
plugin_target_name = [app_name, plugin].join("_")
|
39
|
+
add_plugin(plugin, plugin_target_name)
|
40
|
+
add_plugin_config(plugin_target_name, RAILS_PLUGIN_CONFIG, :log_file => log_file)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def install_passenger_plugins
|
45
|
+
PASSENGER_PLUGINS.each do |plugin|
|
46
|
+
add_plugin(plugin, plugin)
|
47
|
+
add_plugin_config(plugin, PASSENGER_PLUGIN_CONFIG)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def add_plugin_config(plugin_target_name, config_template, options = {})
|
52
|
+
FileUtils.mkdir_p(munin_plugin_config_path)
|
53
|
+
template = ERB.new config_template
|
54
|
+
File.open(File.join(munin_plugin_config_path, plugin_target_name), "w+") do |file|
|
55
|
+
file << template.result(binding)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def add_plugin(plugin_file, plugin_target_name = nil)
|
60
|
+
FileUtils.mkdir_p(munin_plugins_path)
|
61
|
+
plugin_target_name ||= plugin_file
|
62
|
+
`ln -nsf "#{File.join(munin_dir, plugin_file)}" "#{munin_plugins_path}/#{plugin_target_name}"`
|
63
|
+
end
|
64
|
+
|
65
|
+
def munin_plugins_path
|
66
|
+
"/etc/munin/plugins"
|
67
|
+
end
|
68
|
+
|
69
|
+
def munin_plugin_config_path
|
70
|
+
"/etc/munin/plugin-conf.d"
|
71
|
+
end
|
72
|
+
|
73
|
+
def munin_dir
|
74
|
+
File.join(File.dirname(__FILE__), "..", "..", "munin")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Munin
|
2
|
+
class PassengerMemoryStats < RequestLogAnalyzerPlugin
|
3
|
+
def ensure_configuration
|
4
|
+
require_passenger_gem
|
5
|
+
require_passenger_memory_stats
|
6
|
+
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def config
|
11
|
+
memory_info = open('/proc/meminfo', 'r') do |lines|
|
12
|
+
lines.inject({}) do |h, line|
|
13
|
+
matched = line.match(/^([\w_\(\)]+):\s+(\d+)/)
|
14
|
+
h[matched[1].to_sym] = matched[2].to_i * 1024
|
15
|
+
h
|
16
|
+
end
|
17
|
+
end
|
18
|
+
upper_limit = memory_info[:MemTotal]
|
19
|
+
puts <<-CONFIG
|
20
|
+
graph_category #{graph_category}
|
21
|
+
graph_title Passenger memory stats
|
22
|
+
graph_vlabel Bytes
|
23
|
+
graph_args --base 1000 -l 0 --upper-limit #{upper_limit}
|
24
|
+
graph_info The memory used by passenger instances on this application server
|
25
|
+
|
26
|
+
memory.label memory
|
27
|
+
CONFIG
|
28
|
+
exit 0
|
29
|
+
end
|
30
|
+
|
31
|
+
# Collect the data
|
32
|
+
# <tt>debug</tt> Show debug information
|
33
|
+
def run
|
34
|
+
stats = run_command(passenger_memory_stats, debug)
|
35
|
+
|
36
|
+
#### Total private dirty RSS: 81.81 MB
|
37
|
+
stats =~ /RSS:\s*([\d\.]+)\s*MB\Z/m
|
38
|
+
memory = ($1.to_f * 1024 * 1024).to_i
|
39
|
+
puts "memory.value #{memory}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Munin
|
2
|
+
class PassengerQueue < RequestLogAnalyzerPlugin
|
3
|
+
def ensure_configuration
|
4
|
+
require_passenger_status
|
5
|
+
super
|
6
|
+
end
|
7
|
+
|
8
|
+
def config
|
9
|
+
puts <<-CONFIG
|
10
|
+
graph_category #{graph_category}
|
11
|
+
graph_title Passenger queue
|
12
|
+
graph_vlabel count
|
13
|
+
graph_args --base 1000 -l 0
|
14
|
+
graph_info The amount of requests waiting on global queue
|
15
|
+
|
16
|
+
requests.label requests
|
17
|
+
CONFIG
|
18
|
+
exit 0
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
status = run_command(passenger_status, debug)
|
23
|
+
status =~ /Waiting on global queue:\s+(\d+)/
|
24
|
+
puts "requests.value #{$1}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Munin
|
2
|
+
class PassengerStatus < RequestLogAnalyzerPlugin
|
3
|
+
def ensure_configuration
|
4
|
+
require_passenger_status
|
5
|
+
super
|
6
|
+
end
|
7
|
+
|
8
|
+
def config
|
9
|
+
status = `#{passenger_status}`
|
10
|
+
|
11
|
+
status =~ /max\s+=\s+(\d+)/
|
12
|
+
upper_limit = $1 || 150
|
13
|
+
|
14
|
+
puts <<-CONFIG
|
15
|
+
graph_category #{graph_category}
|
16
|
+
graph_title Passenger status
|
17
|
+
graph_vlabel count
|
18
|
+
graph_args --base 1000 -l 0 --upper-limit #{upper_limit}
|
19
|
+
graph_info The amount of active passengers on this application server - railsdoctors.com
|
20
|
+
|
21
|
+
sessions.label sessions
|
22
|
+
max.label max processes
|
23
|
+
running.label running processes
|
24
|
+
active.label active processes
|
25
|
+
CONFIG
|
26
|
+
exit 0
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
status = run_command(passenger_status, debug)
|
31
|
+
|
32
|
+
status =~ /max\s+=\s+(\d+)/
|
33
|
+
puts "max.value #{$1}"
|
34
|
+
|
35
|
+
status =~ /count\s+=\s+(\d+)/
|
36
|
+
puts "running.value #{$1}"
|
37
|
+
|
38
|
+
status =~ /active\s+=\s+(\d+)/
|
39
|
+
puts "active.value #{$1}"
|
40
|
+
|
41
|
+
total_sessions = 0
|
42
|
+
status.scan(/Sessions: (\d+)/).flatten.each { |count| total_sessions += count.to_i }
|
43
|
+
puts "sessions.value #{total_sessions}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Munin
|
2
|
+
class RailsDatabaseTime < RailsPlugin
|
3
|
+
def config
|
4
|
+
puts <<-CONFIG
|
5
|
+
graph_category #{graph_category}
|
6
|
+
graph_title Database time
|
7
|
+
graph_vlabel Seconds
|
8
|
+
graph_args --base 1000 -l 0
|
9
|
+
graph_info The minimum, maximum and average database times - railsdoctors.com
|
10
|
+
|
11
|
+
min.label min
|
12
|
+
max.label max
|
13
|
+
average.label avg
|
14
|
+
CONFIG
|
15
|
+
exit 0
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gather information
|
19
|
+
def run
|
20
|
+
ensure_log_file
|
21
|
+
|
22
|
+
# Initialize values
|
23
|
+
max_value = 0
|
24
|
+
min_value = 1.0/0.0
|
25
|
+
cumulative = 0
|
26
|
+
hits = 0
|
27
|
+
|
28
|
+
rla = parse_request_log_analyzer_data
|
29
|
+
|
30
|
+
if rla && rla["Database time"]
|
31
|
+
rla["Database time"].each do |item|
|
32
|
+
max_value = item[1][:max] if item[1][:max] > max_value
|
33
|
+
min_value = item[1][:min] if item[1][:min] < min_value
|
34
|
+
hits += item[1][:hits]
|
35
|
+
cumulative += item[1][:sum]
|
36
|
+
end
|
37
|
+
else
|
38
|
+
hits = 1
|
39
|
+
min_value = 0
|
40
|
+
end
|
41
|
+
|
42
|
+
# Report in seconds
|
43
|
+
puts "max.value #{max_value}"
|
44
|
+
puts "min.value #{min_value}"
|
45
|
+
puts "average.value #{cumulative / hits.to_f}"
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Munin
|
2
|
+
class RailsRequestDuration < RailsPlugin
|
3
|
+
def config
|
4
|
+
puts <<-CONFIG
|
5
|
+
graph_category #{graph_category}
|
6
|
+
graph_title Request time
|
7
|
+
graph_vlabel Seconds
|
8
|
+
graph_args --base 1000 -l 0
|
9
|
+
graph_info The minimum, maximum and average request times - railsdoctors.com
|
10
|
+
|
11
|
+
min.label min
|
12
|
+
max.label max
|
13
|
+
average.label avg
|
14
|
+
CONFIG
|
15
|
+
exit 0
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gather information
|
19
|
+
def run
|
20
|
+
ensure_log_file
|
21
|
+
|
22
|
+
# Initialize values
|
23
|
+
max_value = 0
|
24
|
+
min_value = 1.0/0.0
|
25
|
+
cumulative = 0
|
26
|
+
hits = 0
|
27
|
+
|
28
|
+
rla = parse_request_log_analyzer_data
|
29
|
+
|
30
|
+
if rla && rla["Request duration"]
|
31
|
+
rla["Request duration"].each do |item|
|
32
|
+
max_value = item[1][:max] if item[1][:max] > max_value
|
33
|
+
min_value = item[1][:min] if item[1][:min] < min_value
|
34
|
+
hits += item[1][:hits]
|
35
|
+
cumulative += item[1][:sum]
|
36
|
+
end
|
37
|
+
else
|
38
|
+
hits = 1
|
39
|
+
min_value = 0
|
40
|
+
end
|
41
|
+
|
42
|
+
puts "max.value #{max_value}"
|
43
|
+
puts "min.value #{min_value}"
|
44
|
+
puts "average.value #{cumulative / hits.to_f}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Munin
|
2
|
+
class RailsRequestError < RailsPlugin
|
3
|
+
def config
|
4
|
+
puts <<-CONFIG
|
5
|
+
graph_category #{graph_category}
|
6
|
+
graph_title Request errors
|
7
|
+
graph_vlabel Count
|
8
|
+
graph_info The amount of request errors - railsdoctors.com
|
9
|
+
|
10
|
+
error.label error
|
11
|
+
blocker.label blocker
|
12
|
+
CONFIG
|
13
|
+
exit 0
|
14
|
+
end
|
15
|
+
|
16
|
+
# Gather information
|
17
|
+
def run
|
18
|
+
ensure_log_file
|
19
|
+
|
20
|
+
# Initialize values
|
21
|
+
error_value = 0
|
22
|
+
blocker_value = 0
|
23
|
+
|
24
|
+
rla = parse_request_log_analyzer_data
|
25
|
+
|
26
|
+
if rla && rla["Failed requests"]
|
27
|
+
rla["Failed requests"].each do |item|
|
28
|
+
error_value += item[1]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
if rla && rla["Process blockers (> 1 sec duration)"]
|
33
|
+
rla["Process blockers (> 1 sec duration)"].each do |item|
|
34
|
+
blocker_value += item[1]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
puts "error.value #{error_value}"
|
39
|
+
puts "blocker.value #{blocker_value}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Munin
|
2
|
+
class RailsRequests < RailsPlugin
|
3
|
+
def config
|
4
|
+
puts <<-CONFIG
|
5
|
+
graph_category #{graph_category}
|
6
|
+
graph_title Processed requests
|
7
|
+
graph_vlabel Requests per second
|
8
|
+
graph_info The amount of requests processed by this application server - railsdoctors.com
|
9
|
+
|
10
|
+
get.label get
|
11
|
+
get.draw AREA
|
12
|
+
post.label post
|
13
|
+
post.draw STACK
|
14
|
+
put.label put
|
15
|
+
put.draw STACK
|
16
|
+
delete.label delete
|
17
|
+
delete.draw STACK
|
18
|
+
CONFIG
|
19
|
+
exit 0
|
20
|
+
end
|
21
|
+
|
22
|
+
# Gather information
|
23
|
+
def run
|
24
|
+
ensure_log_file
|
25
|
+
|
26
|
+
# Initialize values
|
27
|
+
get_value = 0
|
28
|
+
post_value = 0
|
29
|
+
put_value = 0
|
30
|
+
delete_value = 0
|
31
|
+
|
32
|
+
# Walk through the
|
33
|
+
File.open(get_request_log_analyzer_file).each_line{ |line|
|
34
|
+
if match = line.match(/^\s+GET\:\s(\d+).*/)
|
35
|
+
get_value = match[1].to_i
|
36
|
+
elsif match = line.match(/^\s+POST\:\s(\d+).*/)
|
37
|
+
post_value = match[1].to_i
|
38
|
+
elsif match = line.match(/^\s+PUT\:\s(\d+).*/)
|
39
|
+
put_value = match[1].to_i
|
40
|
+
elsif match = line.match(/^\s+DELETE\:\s(\d+).*/)
|
41
|
+
delete_value = match[1].to_i
|
42
|
+
end
|
43
|
+
}
|
44
|
+
|
45
|
+
puts "get.value #{get_value / interval.to_f}"
|
46
|
+
puts "post.value #{post_value / interval.to_f}"
|
47
|
+
puts "put.value #{put_value / interval.to_f}"
|
48
|
+
puts "delete.value #{delete_value / interval.to_f}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Munin
|
2
|
+
class RailsViewRenderTime < RailsPlugin
|
3
|
+
def config
|
4
|
+
puts <<-CONFIG
|
5
|
+
graph_category #{graph_category}
|
6
|
+
graph_title View render times
|
7
|
+
graph_vlabel Seconds
|
8
|
+
graph_args --base 1000 -l 0
|
9
|
+
graph_info The minimum, maximum and average view render times - railsdoctors.com
|
10
|
+
|
11
|
+
min.label min
|
12
|
+
max.label max
|
13
|
+
average.label avg
|
14
|
+
CONFIG
|
15
|
+
exit 0
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gather information
|
19
|
+
def run
|
20
|
+
ensure_log_file
|
21
|
+
|
22
|
+
# Initialize values
|
23
|
+
max_value = 0
|
24
|
+
min_value = 1.0/0.0
|
25
|
+
cumulative = 0
|
26
|
+
hits = 0
|
27
|
+
|
28
|
+
rla = parse_request_log_analyzer_data
|
29
|
+
|
30
|
+
if rla && rla["View rendering time"]
|
31
|
+
rla["View rendering time"].each do |item|
|
32
|
+
max_value = item[1][:max] if item[1][:max] > max_value
|
33
|
+
min_value = item[1][:min] if item[1][:min] < min_value
|
34
|
+
hits += item[1][:hits]
|
35
|
+
cumulative += item[1][:sum]
|
36
|
+
end
|
37
|
+
else
|
38
|
+
hits = 1
|
39
|
+
min_value = 0
|
40
|
+
end
|
41
|
+
|
42
|
+
puts "max.value #{max_value}"
|
43
|
+
puts "min.value #{min_value}"
|
44
|
+
puts "average.value #{cumulative / hits.to_f}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Munin
|
2
|
+
class RailsPlugin < RequestLogAnalyzerPlugin
|
3
|
+
|
4
|
+
attr_accessor :interval
|
5
|
+
attr_accessor :number_of_lines
|
6
|
+
attr_accessor :log_file
|
7
|
+
attr_accessor :log_format
|
8
|
+
attr_accessor :after_time
|
9
|
+
attr_accessor :floor_time
|
10
|
+
attr_accessor :temp_folder
|
11
|
+
attr_accessor :temp_prefix
|
12
|
+
attr_accessor :temp_file_name
|
13
|
+
attr_accessor :request_log_analyzer
|
14
|
+
|
15
|
+
def handle_arguments(args, environment)
|
16
|
+
super
|
17
|
+
|
18
|
+
self.interval = environment['interval'] ? environment['interval'].to_i : 300
|
19
|
+
self.number_of_lines = environment['lines'] || 50000
|
20
|
+
self.log_file = environment['log_file'] || args[0]
|
21
|
+
self.log_format = environment['log_format'] ? "--format #{environment['log_format']}" : ''
|
22
|
+
self.after_time = (Time.now - interval).strftime('%Y%m%d%H%M%S')
|
23
|
+
self.floor_time = Time.at((Time.now.to_f / interval).floor * interval)
|
24
|
+
|
25
|
+
self.temp_folder = '/tmp'
|
26
|
+
self.temp_prefix = graph_category == 'App' ? 'rla' : graph_category.downcase
|
27
|
+
self.temp_file_name = "#{temp_prefix}_#{floor_time.to_i}.yml"
|
28
|
+
self.request_log_analyzer = environment['request_log_analyzer'] || '/usr/bin/request-log-analyzer'
|
29
|
+
end
|
30
|
+
|
31
|
+
def parse_request_log_analyzer_data
|
32
|
+
YAML::load_file( get_request_log_analyzer_file )
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_request_log_analyzer_file
|
36
|
+
fetch_or_create_yaml_file(log_file, debug)
|
37
|
+
end
|
38
|
+
|
39
|
+
def ensure_configuration
|
40
|
+
require_request_log_analyzer_gem
|
41
|
+
require_yaml_gem
|
42
|
+
require_tail_command
|
43
|
+
|
44
|
+
super
|
45
|
+
end
|
46
|
+
|
47
|
+
def ensure_log_file
|
48
|
+
if log_file == "" || log_file.nil?
|
49
|
+
$stderr.puts "Filepath unspecified. Exiting"
|
50
|
+
exit 1
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def fetch_or_create_yaml_file(log_file, debug = false)
|
55
|
+
# Clean up any old temp files left in de temp folder
|
56
|
+
Dir.new(temp_folder).entries.each do |file_name|
|
57
|
+
if match = file_name.match(/^#{temp_prefix}_.*\.yml/)
|
58
|
+
if match[0] != temp_file_name
|
59
|
+
puts "Removing old cache file: #{file_name}" if debug
|
60
|
+
File.delete(temp_folder + "/" + file_name)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
temp_file = temp_folder + "/" + temp_file_name
|
66
|
+
|
67
|
+
# Create temp file rla if needed
|
68
|
+
unless File.exists?(temp_file)
|
69
|
+
puts "Processing the last #{number_of_lines} lines of #{log_file} which are less then #{interval} seconds old." if debug
|
70
|
+
status = `tail -n #{number_of_lines} #{log_file} | #{request_log_analyzer} - --after #{after_time} #{log_format} -b --dump #{temp_file}`
|
71
|
+
|
72
|
+
unless $?.success?
|
73
|
+
$stderr.puts "failed executing request-log-analyzer. Is the gem path correct?"
|
74
|
+
exit 1
|
75
|
+
end
|
76
|
+
else
|
77
|
+
puts "Processing cached YAML result #{temp_file}" if debug
|
78
|
+
end
|
79
|
+
|
80
|
+
return temp_file
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module Munin
|
2
|
+
class RequestLogAnalyzerPlugin
|
3
|
+
attr_accessor :graph_category
|
4
|
+
attr_accessor :passenger_memory_stats
|
5
|
+
attr_accessor :passenger_status
|
6
|
+
attr_accessor :debug
|
7
|
+
attr_accessor :environment
|
8
|
+
|
9
|
+
def initialize(args, environment)
|
10
|
+
handle_arguments(args, environment)
|
11
|
+
ensure_configuration
|
12
|
+
|
13
|
+
if args[0] == "config"
|
14
|
+
config
|
15
|
+
elsif args[0] == "autoconf"
|
16
|
+
autoconf
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def handle_arguments(args, environment)
|
21
|
+
self.environment = environment
|
22
|
+
self.graph_category = environment['graph_category'] || 'App'
|
23
|
+
|
24
|
+
if args[0] == "debug"
|
25
|
+
args.shift
|
26
|
+
self.debug = true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def require_passenger_gem
|
31
|
+
require_gem("passenger", ">=2.0")
|
32
|
+
end
|
33
|
+
|
34
|
+
def run_command(command, debug = false)
|
35
|
+
result = `#{command}`
|
36
|
+
|
37
|
+
unless $?.success?
|
38
|
+
$stderr.puts "failed executing #{command}"
|
39
|
+
exit 1
|
40
|
+
end
|
41
|
+
|
42
|
+
puts result if debug
|
43
|
+
|
44
|
+
result
|
45
|
+
end
|
46
|
+
|
47
|
+
def require_request_log_analyzer_gem
|
48
|
+
require_gem("request-log-analyzer", ">=1.1.6")
|
49
|
+
end
|
50
|
+
|
51
|
+
def require_yaml_gem
|
52
|
+
begin
|
53
|
+
require 'yaml'
|
54
|
+
rescue Exception => e
|
55
|
+
puts "no (yaml not found)"
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def require_command(command_name)
|
61
|
+
status = `#{command_name}`
|
62
|
+
unless $?.success?
|
63
|
+
puts "no (error when excuting #{command_name})"
|
64
|
+
exit 1
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def require_tail_command
|
69
|
+
unless `echo "test" | tail 2>/dev/null`.include?("test")
|
70
|
+
puts "no (tail command not found)"
|
71
|
+
exit 1
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def require_passenger_status
|
76
|
+
self.passenger_status = environment['passenger_status'] || '/usr/local/bin/passenger-status'
|
77
|
+
#to use if you have multiple passenger on the host like phusion passenger standalone
|
78
|
+
if environment['apache_pid_file']
|
79
|
+
self.passenger_status = "cat #{environment['apache_pid_file']} | xargs -0 #{passenger_status}"
|
80
|
+
end
|
81
|
+
|
82
|
+
require_command(passenger_status)
|
83
|
+
end
|
84
|
+
|
85
|
+
def require_passenger_memory_stats
|
86
|
+
self.passenger_memory_stats = environment['passenger_memory_stats'] || '/usr/local/bin/passenger-memory-stats'
|
87
|
+
|
88
|
+
require_command(passenger_memory_stats)
|
89
|
+
end
|
90
|
+
|
91
|
+
def require_gem(gemname, version = nil)
|
92
|
+
begin
|
93
|
+
require 'rubygems'
|
94
|
+
if version
|
95
|
+
gem gemname, version
|
96
|
+
else
|
97
|
+
gem gemname
|
98
|
+
end
|
99
|
+
rescue Exception => e
|
100
|
+
puts "no (Gem not found: #{e})"
|
101
|
+
exit 1
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def ensure_configuration
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
def autoconf
|
110
|
+
ensure_configuration
|
111
|
+
puts "yes"
|
112
|
+
exit 0
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
pod=<<-POD
|
3
|
+
|
4
|
+
=head1 NAME
|
5
|
+
passenger_memory_stats - Munin plugin to monitor the memory usage of passenger application servers.
|
6
|
+
Monitors the memory consumed by passenger instances.
|
7
|
+
|
8
|
+
=head1 APPLICABLE SYSTEMS
|
9
|
+
All systems that have passenger installed.
|
10
|
+
|
11
|
+
=head1 CONFIGURATION
|
12
|
+
The plugin needs to execute passenger-memory-stats.
|
13
|
+
This configuration section shows the defaults of the plugin:
|
14
|
+
|
15
|
+
[passenger_*]
|
16
|
+
user root
|
17
|
+
command /usr/local/bin/ruby %c
|
18
|
+
|
19
|
+
Options
|
20
|
+
env.passenger_memory_stats '/path/to/passenger-memory-stats' # Path to passenger memory status.
|
21
|
+
env.graph_category 'App' # Graph Category. Defaults to App.
|
22
|
+
|
23
|
+
ln -s /usr/share/munin/plugins/passenger_memory_stats /etc/munin/plugins/passenger_memory_stats
|
24
|
+
|
25
|
+
=head1 INTERPRETATION
|
26
|
+
The plugin shows the memory consumed by passenger instances.
|
27
|
+
|
28
|
+
=head1 MAGIC MARKERS
|
29
|
+
#%# family=auto
|
30
|
+
#%# capabilities=autoconf
|
31
|
+
|
32
|
+
=head1 VERSION
|
33
|
+
1.9.7
|
34
|
+
|
35
|
+
=head1 BUGS
|
36
|
+
None known
|
37
|
+
|
38
|
+
=head1 AUTHOR
|
39
|
+
Ilya Lityuga
|
40
|
+
Bart ten Brinke - railsdoctors.com
|
41
|
+
|
42
|
+
=head1 LICENSE
|
43
|
+
MIT
|
44
|
+
|
45
|
+
POD
|
46
|
+
require 'rubygems'
|
47
|
+
require 'munin-plugins-rails'
|
48
|
+
Munin::PassengerMemoryStats.new(ARGV, ENV).run
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
pod=<<-POD
|
3
|
+
|
4
|
+
=head1 NAME
|
5
|
+
passenger_queue - Munin plugin to monitor passenger queue.
|
6
|
+
Monitors the amount of requests in global queue.
|
7
|
+
|
8
|
+
=head1 APPLICABLE SYSTEMS
|
9
|
+
All systems that have passenger installed.
|
10
|
+
|
11
|
+
=head1 CONFIGURATION
|
12
|
+
The plugin needs to execute passenger-status.
|
13
|
+
This configuration section shows the defaults of the plugin:
|
14
|
+
|
15
|
+
[passenger_*]
|
16
|
+
user root
|
17
|
+
command /usr/local/bin/ruby %c
|
18
|
+
|
19
|
+
Options
|
20
|
+
env.passenger_status '/path/to/passenger-status' # Path to passenger-status
|
21
|
+
env.apache_pid_file '/path/to/apache2.pid' # Path to passenger-status (like /var/run/apache2.pid)
|
22
|
+
env.graph_category 'App' # Graph Category. Defaults to App.
|
23
|
+
|
24
|
+
ln -s /usr/share/munin/plugins/passenger_queue /etc/munin/plugins/passenger_queue
|
25
|
+
|
26
|
+
=head1 INTERPRETATION
|
27
|
+
The plugin shows the current number of requests waiting on global queue.
|
28
|
+
|
29
|
+
=head1 MAGIC MARKERS
|
30
|
+
#%# family=auto
|
31
|
+
#%# capabilities=autoconf
|
32
|
+
|
33
|
+
=head1 VERSION
|
34
|
+
1.9.7
|
35
|
+
|
36
|
+
=head1 BUGS
|
37
|
+
None known
|
38
|
+
|
39
|
+
=head1 AUTHOR
|
40
|
+
Michaël Witrant - http://michael.witrant.com/
|
41
|
+
Bart ten Brinke - railsdoctors.com
|
42
|
+
Daniel Manges - http://gist.github.com/20319
|
43
|
+
|
44
|
+
=head1 LICENSE
|
45
|
+
MIT
|
46
|
+
|
47
|
+
POD
|
48
|
+
require 'rubygems'
|
49
|
+
require 'munin-plugins-rails'
|
50
|
+
|
51
|
+
Munin::PassengerQueue.new(ARGV, ENV).run
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
pod=<<-POD
|
3
|
+
|
4
|
+
=head1 NAME
|
5
|
+
passenger_status - Munin plugin to monitor passenger application servers.
|
6
|
+
Monitors the amount of sessions and running, active and maximum amount of passenger instances.
|
7
|
+
|
8
|
+
=head1 APPLICABLE SYSTEMS
|
9
|
+
All systems that have passenger installed.
|
10
|
+
|
11
|
+
=head1 CONFIGURATION
|
12
|
+
The plugin needs to execute passenger-status.
|
13
|
+
This configuration section shows the defaults of the plugin:
|
14
|
+
|
15
|
+
[passenger_*]
|
16
|
+
user root
|
17
|
+
command /usr/local/bin/ruby %c
|
18
|
+
|
19
|
+
Options
|
20
|
+
env.passenger_status '/path/to/passenger-status' # Path to passenger-status
|
21
|
+
env.graph_category 'App' # Graph Category. Defaults to App.
|
22
|
+
env.apache_pid_file '/var/run/apache2.pid' # Use if you want to monitor multiple installations.
|
23
|
+
|
24
|
+
ln -s /usr/share/munin/plugins/passenger_status /etc/munin/plugins/passenger_status
|
25
|
+
|
26
|
+
=head1 INTERPRETATION
|
27
|
+
The plugin shows the maximum, active and current number of running passenger instances.
|
28
|
+
|
29
|
+
=head1 MAGIC MARKERS
|
30
|
+
#%# family=auto
|
31
|
+
#%# capabilities=autoconf
|
32
|
+
|
33
|
+
=head1 VERSION
|
34
|
+
1.9.7.1
|
35
|
+
|
36
|
+
=head1 BUGS
|
37
|
+
None known
|
38
|
+
|
39
|
+
=head1 AUTHOR
|
40
|
+
Bart ten Brinke - railsdoctors.com
|
41
|
+
Daniel Manges - http://gist.github.com/20319
|
42
|
+
|
43
|
+
=head1 LICENSE
|
44
|
+
MIT
|
45
|
+
|
46
|
+
POD
|
47
|
+
require 'rubygems'
|
48
|
+
require 'munin-plugins-rails'
|
49
|
+
|
50
|
+
Munin::PassengerStatus.new(ARGV, ENV).run
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
pod=<<-POD
|
3
|
+
|
4
|
+
=head1 NAME
|
5
|
+
rails_database_time - Munin plugin to monitor the minimum, average and maximum database times.
|
6
|
+
|
7
|
+
=head1 APPLICABLE SYSTEMS
|
8
|
+
All systems that have a rails application log.
|
9
|
+
|
10
|
+
=head1 CONFIGURATION
|
11
|
+
The request-log-analyzer gem has to be intalled.
|
12
|
+
Also the script has to be able to access the rails log file and tail.
|
13
|
+
This configuration section shows the defaults of the plugin:
|
14
|
+
|
15
|
+
[rails_database_time]
|
16
|
+
env.log_file '/path/to/production.log'
|
17
|
+
user www-data
|
18
|
+
command /usr/local/bin/ruby %c
|
19
|
+
log_format rails3
|
20
|
+
|
21
|
+
Options
|
22
|
+
env.lines 50000 # Number of lines to tail
|
23
|
+
env.interval 300 # Munin interval in seconds (used for graphs and caching)
|
24
|
+
env.log_format # request-log-analyzer log format (passed to '--format')
|
25
|
+
env.request_log_analyzer '/usr/local/bin' # Path to gem. Use this for Debian.
|
26
|
+
env.graph_category 'App' # Graph Category. Defaults to App.
|
27
|
+
|
28
|
+
ln -s /usr/share/munin/plugins/rails_database_time /etc/munin/plugins/rails_database_time
|
29
|
+
|
30
|
+
=head1 INTERPRETATION
|
31
|
+
Three lines are graphed, showing the minimum, average and maximum database times.
|
32
|
+
|
33
|
+
=head1 MAGIC MARKERS
|
34
|
+
#%# family=auto
|
35
|
+
#%# capabilities=autoconf
|
36
|
+
|
37
|
+
=head1 VERSION
|
38
|
+
1.9.7
|
39
|
+
|
40
|
+
=head1 BUGS
|
41
|
+
None known
|
42
|
+
|
43
|
+
=head1 AUTHOR
|
44
|
+
Bart ten Brinke - railsdoctors.com
|
45
|
+
|
46
|
+
=head1 LICENSE
|
47
|
+
MIT
|
48
|
+
|
49
|
+
POD
|
50
|
+
require 'rubygems'
|
51
|
+
require 'munin-plugins-rails'
|
52
|
+
|
53
|
+
Munin::RailsDatabaseTime.new(ARGV, ENV).run
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
pod=<<-POD
|
3
|
+
|
4
|
+
=head1 NAME
|
5
|
+
rails_request_duration - Munin plugin to monitor the minimum, average and maximum request duration.
|
6
|
+
|
7
|
+
=head1 APPLICABLE SYSTEMS
|
8
|
+
All systems that have a rails application log.
|
9
|
+
|
10
|
+
=head1 CONFIGURATION
|
11
|
+
The request-log-analyzer gem has to be intalled.
|
12
|
+
Also the script has to be able to access the rails log file and tail.
|
13
|
+
This configuration section shows the defaults of the plugin:
|
14
|
+
|
15
|
+
[rails_request_duration]
|
16
|
+
env.log_file '/path/to/production.log'
|
17
|
+
user www-data
|
18
|
+
command /usr/local/bin/ruby %c
|
19
|
+
log_format rails3
|
20
|
+
|
21
|
+
Options
|
22
|
+
env.lines 50000 # Number of lines to tail
|
23
|
+
env.interval 300 # Munin interval in seconds (used for graphs and caching)
|
24
|
+
env.log_format # request-log-analyzer log format (passed to '--format')
|
25
|
+
env.request_log_analyzer '/usr/local/bin' # Path to gem. Use this for Debian.
|
26
|
+
env.graph_category 'App' # Graph Category. Defaults to App.
|
27
|
+
|
28
|
+
ln -s /usr/share/munin/plugins/rails_request_duration /etc/munin/plugins/rails_request_duration
|
29
|
+
|
30
|
+
=head1 INTERPRETATION
|
31
|
+
Three lines are graphed, showing the minimum, average and maximum request times.
|
32
|
+
|
33
|
+
=head1 MAGIC MARKERS
|
34
|
+
#%# family=auto
|
35
|
+
#%# capabilities=autoconf
|
36
|
+
|
37
|
+
=head1 VERSION
|
38
|
+
1.9.7
|
39
|
+
|
40
|
+
=head1 BUGS
|
41
|
+
None known
|
42
|
+
|
43
|
+
=head1 AUTHOR
|
44
|
+
Bart ten Brinke - railsdoctors.com
|
45
|
+
|
46
|
+
=head1 LICENSE
|
47
|
+
MIT
|
48
|
+
|
49
|
+
POD
|
50
|
+
require 'rubygems'
|
51
|
+
require 'munin-plugins-rails'
|
52
|
+
|
53
|
+
Munin::RailsRequestDuration.new(ARGV, ENV).run
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
pod=<<-POD
|
3
|
+
|
4
|
+
=head1 NAME
|
5
|
+
rails_request_error - Munin plugin to monitor the amount of errors and process blockers.
|
6
|
+
|
7
|
+
=head1 APPLICABLE SYSTEMS
|
8
|
+
All systems that have a rails application log.
|
9
|
+
|
10
|
+
=head1 CONFIGURATION
|
11
|
+
The request-log-analyzer gem has to be intalled.
|
12
|
+
Also the script has to be able to access the rails log file and tail.
|
13
|
+
This configuration section shows the defaults of the plugin:
|
14
|
+
|
15
|
+
[rails_request_error]
|
16
|
+
env.log_file '/path/to/production.log'
|
17
|
+
user www-data
|
18
|
+
command /usr/local/bin/ruby %c
|
19
|
+
log_format rails3
|
20
|
+
|
21
|
+
Options
|
22
|
+
env.lines 50000 # Number of lines to tail
|
23
|
+
env.interval 300 # Munin interval in seconds (used for graphs and caching)
|
24
|
+
env.log_format # request-log-analyzer log format (passed to '--format')
|
25
|
+
env.request_log_analyzer '/usr/local/bin' # Path to gem. Use this for Debian.
|
26
|
+
env.graph_category 'App' # Graph Category. Defaults to App.
|
27
|
+
|
28
|
+
ln -s /usr/share/munin/plugins/rails_request_error /etc/munin/plugins/rails_request_error
|
29
|
+
|
30
|
+
=head1 INTERPRETATION
|
31
|
+
Two lines are graphed, one showing the amount of errors raised and one showing the amount of process
|
32
|
+
blockers. Process blockers are requests that took longer than 1 second to complete.
|
33
|
+
|
34
|
+
=head1 MAGIC MARKERS
|
35
|
+
#%# family=auto
|
36
|
+
#%# capabilities=autoconf
|
37
|
+
|
38
|
+
=head1 VERSION
|
39
|
+
1.9.7
|
40
|
+
|
41
|
+
=head1 BUGS
|
42
|
+
None known
|
43
|
+
|
44
|
+
=head1 AUTHOR
|
45
|
+
Bart ten Brinke - railsdoctors.com
|
46
|
+
|
47
|
+
=head1 LICENSE
|
48
|
+
MIT
|
49
|
+
|
50
|
+
POD
|
51
|
+
require 'rubygems'
|
52
|
+
require 'munin-plugins-rails'
|
53
|
+
|
54
|
+
Munin::RailsRequestError.new(ARGV, ENV).run
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
pod=<<-POD
|
3
|
+
|
4
|
+
=head1 NAME
|
5
|
+
rails_requests - Munin plugin to monitor the amount of get, put, post and delete requests from a
|
6
|
+
rails application log.
|
7
|
+
|
8
|
+
=head1 APPLICABLE SYSTEMS
|
9
|
+
All systems that have a rails application log.
|
10
|
+
|
11
|
+
=head1 CONFIGURATION
|
12
|
+
The request-log-analyzer gem has to be intalled.
|
13
|
+
Also the script has to be able to access the rails log file and tail.
|
14
|
+
This configuration section shows the defaults of the plugin:
|
15
|
+
|
16
|
+
[rails_requests]
|
17
|
+
env.log_file '/path/to/production.log'
|
18
|
+
user www-data
|
19
|
+
command /usr/local/bin/ruby %c
|
20
|
+
log_format rails3
|
21
|
+
|
22
|
+
Options
|
23
|
+
env.lines 50000 # Number of lines to tail
|
24
|
+
env.interval 300 # Munin interval in seconds (used for graphs and caching)
|
25
|
+
env.log_format # request-log-analyzer log format (passed to '--format')
|
26
|
+
env.request_log_analyzer '/usr/local/bin' # Path to gem. Use this for Debian.
|
27
|
+
env.graph_category 'App' # Graph Category. Defaults to App.
|
28
|
+
|
29
|
+
ln -s /usr/share/munin/plugins/rails_requests /etc/munin/plugins/rails_requests
|
30
|
+
|
31
|
+
=head1 INTERPRETATION
|
32
|
+
All HTTP methods are stacked so that the total equals the amount of requests processed per 5 minutes.
|
33
|
+
|
34
|
+
=head1 MAGIC MARKERS
|
35
|
+
#%# family=auto
|
36
|
+
#%# capabilities=autoconf
|
37
|
+
|
38
|
+
=head1 VERSION
|
39
|
+
1.9.7
|
40
|
+
|
41
|
+
=head1 BUGS
|
42
|
+
None known
|
43
|
+
|
44
|
+
=head1 AUTHOR
|
45
|
+
Bart ten Brinke - railsdoctors.com
|
46
|
+
|
47
|
+
=head1 LICENSE
|
48
|
+
MIT
|
49
|
+
|
50
|
+
POD
|
51
|
+
require 'rubygems'
|
52
|
+
require 'munin-plugins-rails'
|
53
|
+
|
54
|
+
Munin::RailsRequests.new(ARGV, ENV).run
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
pod=<<-POD
|
3
|
+
|
4
|
+
=head1 NAME
|
5
|
+
rails_view_render_time - Munin plugin to monitor the minimum, average and maximum view render times.
|
6
|
+
|
7
|
+
=head1 APPLICABLE SYSTEMS
|
8
|
+
All systems that have a rails application log.
|
9
|
+
|
10
|
+
=head1 CONFIGURATION
|
11
|
+
The request-log-analyzer gem has to be intalled.
|
12
|
+
Also the script has to be able to access the rails log file and tail.
|
13
|
+
This configuration section shows the defaults of the plugin:
|
14
|
+
|
15
|
+
[rails_view_render_time]
|
16
|
+
env.log_file '/path/to/production.log'
|
17
|
+
user www-data
|
18
|
+
command /usr/local/bin/ruby %c
|
19
|
+
log_format rails3
|
20
|
+
|
21
|
+
Options
|
22
|
+
env.lines 50000 # Number of lines to tail
|
23
|
+
env.interval 300 # Munin interval in seconds (used for graphs and caching)
|
24
|
+
env.log_format # request-log-analyzer log format (passed to '--format')
|
25
|
+
env.request_log_analyzer '/usr/local/bin' # Path to gem. Use this for Debian.
|
26
|
+
env.graph_category 'App' # Graph Category. Defaults to App.
|
27
|
+
|
28
|
+
ln -s /usr/share/munin/plugins/rails_view_render_time /etc/munin/plugins/rails_view_render_time
|
29
|
+
|
30
|
+
=head1 INTERPRETATION
|
31
|
+
Three lines are graphed, showing the minimum, average and maximum view render times.
|
32
|
+
|
33
|
+
=head1 MAGIC MARKERS
|
34
|
+
#%# family=auto
|
35
|
+
#%# capabilities=autoconf
|
36
|
+
|
37
|
+
=head1 VERSION
|
38
|
+
1.9.7
|
39
|
+
|
40
|
+
=head1 BUGS
|
41
|
+
None known
|
42
|
+
|
43
|
+
=head1 AUTHOR
|
44
|
+
Bart ten Brinke - railsdoctors.com
|
45
|
+
|
46
|
+
=head1 LICENSE
|
47
|
+
MIT
|
48
|
+
|
49
|
+
POD
|
50
|
+
require 'rubygems'
|
51
|
+
require 'munin-plugins-rails'
|
52
|
+
|
53
|
+
Munin::RailsViewRenderTime.new(ARGV, ENV).run
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: munin-plugins-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 10
|
10
|
+
version: 0.2.10
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Andrew Eberbach
|
14
|
+
- Bart ten Brinke
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-03-19 00:00:00 +01:00
|
20
|
+
default_executable: request-log-analyzer-munin
|
21
|
+
dependencies: []
|
22
|
+
|
23
|
+
description:
|
24
|
+
email: andrew@ebertech.ca
|
25
|
+
executables:
|
26
|
+
- request-log-analyzer-munin
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files:
|
30
|
+
- README.rdoc
|
31
|
+
files:
|
32
|
+
- VERSION
|
33
|
+
- lib/munin-plugins-rails.rb
|
34
|
+
- lib/munin/command.rb
|
35
|
+
- lib/munin/plugins/passenger_memory_stats.rb
|
36
|
+
- lib/munin/plugins/passenger_queue.rb
|
37
|
+
- lib/munin/plugins/passenger_status.rb
|
38
|
+
- lib/munin/plugins/rails_database_time.rb
|
39
|
+
- lib/munin/plugins/rails_request_duration.rb
|
40
|
+
- lib/munin/plugins/rails_request_error.rb
|
41
|
+
- lib/munin/plugins/rails_requests.rb
|
42
|
+
- lib/munin/plugins/rails_view_render_time.rb
|
43
|
+
- lib/munin/rails_plugin.rb
|
44
|
+
- lib/munin/request_log_analyzer_plugin.rb
|
45
|
+
- munin/munin_passenger_memory_stats
|
46
|
+
- munin/munin_passenger_queue
|
47
|
+
- munin/munin_passenger_status
|
48
|
+
- munin/munin_rails_database_time
|
49
|
+
- munin/munin_rails_request_duration
|
50
|
+
- munin/munin_rails_request_error
|
51
|
+
- munin/munin_rails_requests
|
52
|
+
- munin/munin_rails_view_render_time
|
53
|
+
- README.rdoc
|
54
|
+
- bin/request-log-analyzer-munin
|
55
|
+
has_rdoc: true
|
56
|
+
homepage:
|
57
|
+
licenses: []
|
58
|
+
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
requirements: []
|
83
|
+
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 1.3.7
|
86
|
+
signing_key:
|
87
|
+
specification_version: 3
|
88
|
+
summary: Plugins for Munin that use passenger and RLA
|
89
|
+
test_files: []
|
90
|
+
|