munin-plugins-rails 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,10 +1,13 @@
1
1
  = Munin-Rails-Plugins
2
2
  Collection of Concise Munin plugins for Rails server environments.
3
3
  This will make monitoring your rails app a piece of cake.
4
-
4
+
5
5
  This project contains munin plugins that not only work in munin, but are also concise (see references).
6
6
  Most things in this repository rely heavily on the request-log-analyzer gem.
7
7
 
8
+ The project has now been converted into a gem.
9
+ If you are looking for the loose scripts, please checkout https://github.com/barttenbrinke/munin-plugins-rails/tree/stable
10
+
8
11
  == What's in the box?
9
12
  * passenger_memory_stats - Munin plugin to monitor the memory usage of passenger application servers.
10
13
  * pasenger_queue - Montoring of passenger queue lenth.
@@ -14,61 +17,78 @@ Most things in this repository rely heavily on the request-log-analyzer gem.
14
17
  * rails_request_error - Application errors and process blocker counters.
15
18
  * rails_requests - Get, put, post and delete requests.
16
19
  * rails_view_render_time - Min, avg and max view render times.
17
-
20
+
18
21
  For screenshots, head over to: http://barttenbrinke.github.com/munin-plugins-rails/
19
-
22
+
20
23
  == 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
24
+ Installing should be as easy as
27
25
 
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
26
+ gem install munin-rails-plugins
33
27
 
34
- Run "/etc/munin/plugins/rails_requests autoconf" and "munin-run rails_requests" to test the plugin.
28
+ After that you have two options:
35
29
 
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.
30
+ You can add the passenger plugins that will monitor the server as a whole. These include:
31
+ * passenger_memory_stats - Munin plugin to monitor the memory usage of passenger application servers.
32
+ * pasenger_queue - Montoring of passenger queue lenth.
33
+ * passenger_status - Running, active and maximum number of passenger instances as well as sessions.
34
+ * rails_database_time - Min, avg, max of database times.
35
+ * rails_request_duration - Min, avg, max of the total request durations.
36
+ * rails_request_error - Application errors and process blocker counters.
37
+ * rails_requests - Get, put, post and delete requests.
38
+ * rails_view_render_time - Min, avg and max view render times.
38
39
 
39
- == Monitoring multiple applications
40
+ To do this run:
40
41
 
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:
42
+ sudo request-log-analyzer-munin install
43
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
44
+ This will create the necessary symlinks in /etc/munin/plugins and create reasonable configurations in /etc/munin/plugin-conf.d:
46
45
 
47
- And in the munin-node file:
46
+ * munin_passenger_memory_stats
47
+ * munin_passenger_queue
48
+ * munin_passenger_status
48
49
 
49
- [rails_app1_*]
50
- env.log_file '/path/to/app1/production.log'
51
- env.graph_category App1
50
+ You can customize these as needed.
52
51
 
53
- [rails_app2_*]
54
- env.log_file '/path/to/app2/production.log'
55
- env.graph_category App2
52
+ You can add a specific application's log file so that you can use the following:
53
+ * rails_database_time
54
+ * rails_request_duration
55
+ * rails_request_error
56
+ * rails_requests
57
+ * rails_view_render_time
56
58
 
59
+ To do this run
60
+
61
+ sudo request-log-analyzer-munin add app_name path_to_log_file
62
+
63
+ app_name: this will be the prefix for the graphs and the munin plugins so it should be a valid identifier (/[A-Za-z0-9_]*/).
64
+ path_to_log_file: this is the path to the log file against which request-log-analyzer will run
65
+
66
+ After running this command you'll have appropriate symlinks in /etc/munin/plugins and a set of configuration files in /etc/munin/plugin-conf.d:
67
+
68
+ * app_name_munin_rails_database_time
69
+ * app_name_munin_rails_request_duration
70
+ * app_name_munin_rails_request_error
71
+ * app_name_munin_rails_requests
72
+ * app_name_munin_rails_view_render_time
73
+
74
+ For more detailed information, see the documentation embedded in the plugins.
75
+
76
+ Remember to restart munin-node.
77
+
57
78
  == Problems
58
79
  * sudo gem install request-log-analyzer
59
80
  * Check if the paths in the plugin configuration are correct.
60
81
  * Make sure the specified user is allowed to write to /tmp and access your rails logfile.
61
-
82
+
62
83
  If you encounter performance problems with your app, please take a look at the request-log-analyzer wiki on
63
84
  examples on how to drill down to the core of your problem. If you want to hire an expert, please visit us at
64
85
  http://railsdoctors.com or mail me at: bart@railsdoctors.com
65
-
86
+
66
87
  Happy monitoring!
67
-
88
+
68
89
  == Additional information
69
90
  * Railsdoctors: http://railsdoctors.com
70
91
  * Request-log-analzer: http://github.com/wvanbergen/request-log-analyzer/
71
92
  * Screenshots http://barttenbrinke.github.com/munin-plugins-rails/
72
93
  * Munin: http://munin.projects.linpro.no/wiki/ConcisePlugins
73
- * License: MIT
74
-
94
+ * License: MIT
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.10
1
+ 0.2.11
@@ -1,4 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $:.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
4
+
3
5
  require 'munin-plugins-rails'
4
- Munin::Command.new.run(ARGV)
6
+
7
+ if ARGV.length > 0
8
+ Munin::Command.new.run(ARGV)
9
+ else
10
+ puts "Request-log-analyzer-munin, by Andrew Eberbach & Bart ten Brinke - version 0.2.10"
11
+ puts
12
+ puts "This gem automatates munin-plugin configurations for monitoring of rails apps using"
13
+ puts "the request-log-analyzer gem"
14
+ puts
15
+ puts "Usage: request-log-analyzer-munin [install|appname] <OPTIONS>"
16
+ puts
17
+ puts
18
+ puts "To install passenger plugins:"
19
+ puts " request-log-analyzer-munin install"
20
+ puts
21
+ puts "To install railsplugins:"
22
+ puts " request-log-analyzer-munin <app-name> <log-file>"
23
+ puts
24
+ puts "Examples:"
25
+ puts " request-log-analyzer-munin install"
26
+ puts " request-log-analyzer-munin MyAwesomeApp /srv/my_app/current/log/production.log"
27
+ puts
28
+ exit(0)
29
+ end
data/lib/munin/command.rb CHANGED
@@ -19,7 +19,7 @@ user root
19
19
  command /usr/local/bin/ruby %c
20
20
  env.passenger_status '/usr/local/bin/passenger-status'
21
21
  env.passenger_memory_stats '/usr/local/bin/passenger-memory-stats'
22
- env.graph_category Passenger
22
+ env.graph_category <%= graph_category %>
23
23
  DATA
24
24
 
25
25
  RAILS_PLUGIN_CONFIG = <<-DATA
@@ -28,27 +28,29 @@ env.log_file <%= options[:log_file] %>
28
28
  user root
29
29
  command /usr/local/bin/ruby %c
30
30
  env.request_log_analyzer /usr/local/bin/request-log-analyzer
31
- env.graph_category <%= plugin_target_name %>
31
+ env.graph_category <%= graph_category %>
32
32
  DATA
33
33
 
34
+ PASSENGER_CATEGORY = "Passenger"
35
+
34
36
  def install_application(args)
35
37
  app_name = args.shift
36
38
  log_file = args.shift
37
39
  RAILS_PLUGINS.each do |plugin|
38
40
  plugin_target_name = [app_name, plugin].join("_")
39
41
  add_plugin(plugin, plugin_target_name)
40
- add_plugin_config(plugin_target_name, RAILS_PLUGIN_CONFIG, :log_file => log_file)
42
+ add_plugin_config(plugin_target_name, app_name, RAILS_PLUGIN_CONFIG, :log_file => log_file)
41
43
  end
42
44
  end
43
45
 
44
46
  def install_passenger_plugins
45
47
  PASSENGER_PLUGINS.each do |plugin|
46
48
  add_plugin(plugin, plugin)
47
- add_plugin_config(plugin, PASSENGER_PLUGIN_CONFIG)
49
+ add_plugin_config(plugin, PASSENGER_CATEGORY, PASSENGER_PLUGIN_CONFIG)
48
50
  end
49
51
  end
50
52
 
51
- def add_plugin_config(plugin_target_name, config_template, options = {})
53
+ def add_plugin_config(plugin_target_name, graph_category, config_template, options = {})
52
54
  FileUtils.mkdir_p(munin_plugin_config_path)
53
55
  template = ERB.new config_template
54
56
  File.open(File.join(munin_plugin_config_path, plugin_target_name), "w+") do |file|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: munin-plugins-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
5
- prerelease: false
4
+ hash: 1
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 10
10
- version: 0.2.10
9
+ - 11
10
+ version: 0.2.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Eberbach
@@ -16,10 +16,23 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-03-19 00:00:00 +01:00
19
+ date: 2011-03-28 00:00:00 -04:00
20
20
  default_executable: request-log-analyzer-munin
21
- dependencies: []
22
-
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: request-log-analyzer
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :runtime
35
+ version_requirements: *id001
23
36
  description:
24
37
  email: andrew@ebertech.ca
25
38
  executables:
@@ -82,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
95
  requirements: []
83
96
 
84
97
  rubyforge_project:
85
- rubygems_version: 1.3.7
98
+ rubygems_version: 1.5.0
86
99
  signing_key:
87
100
  specification_version: 3
88
101
  summary: Plugins for Munin that use passenger and RLA