Class: Munin::RailsRequests
- Inherits:
-
RailsPlugin
- Object
- RequestLogAnalyzerPlugin
- RailsPlugin
- Munin::RailsRequests
- Defined in:
- lib/munin/plugins/rails_requests.rb
Instance Attribute Summary
Attributes inherited from RailsPlugin
#after_time, #floor_time, #interval, #log_file, #log_format, #number_of_lines, #request_log_analyzer, #temp_file_name, #temp_folder, #temp_prefix
Attributes inherited from RequestLogAnalyzerPlugin
#debug, #environment, #graph_category, #passenger_memory_stats, #passenger_status
Instance Method Summary collapse
- #config ⇒ Object
-
#run ⇒ Object
Gather information.
Methods inherited from RailsPlugin
#ensure_configuration, #ensure_log_file, #fetch_or_create_yaml_file, #get_request_log_analyzer_file, #handle_arguments, #parse_request_log_analyzer_data
Methods inherited from RequestLogAnalyzerPlugin
#autoconf, #ensure_configuration, #handle_arguments, #initialize, #require_command, #require_gem, #require_passenger_gem, #require_passenger_memory_stats, #require_passenger_status, #require_request_log_analyzer_gem, #require_tail_command, #require_yaml_gem, #run_command
Constructor Details
This class inherits a constructor from Munin::RequestLogAnalyzerPlugin
Instance Method Details
#config ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/munin/plugins/rails_requests.rb', line 5 def config puts "graph_category \#{graph_category}\ngraph_title Processed requests\ngraph_vlabel Requests per second\ngraph_info The amount of requests processed by this application server - railsdoctors.com\n\nget.label get\nget.draw AREA\npost.label post\npost.draw STACK\nput.label put\nput.draw STACK\ndelete.label delete\ndelete.draw STACK\n" exit 0 end |
#run ⇒ Object
Gather information
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/munin/plugins/rails_requests.rb', line 25 def run ensure_log_file # Initialize values get_value = 0 post_value = 0 put_value = 0 delete_value = 0 # Walk through the File.open(get_request_log_analyzer_file).each_line{ |line| if match = line.match(/^\s+GET\:\s(\d+).*/) get_value = match[1].to_i elsif match = line.match(/^\s+POST\:\s(\d+).*/) post_value = match[1].to_i elsif match = line.match(/^\s+PUT\:\s(\d+).*/) put_value = match[1].to_i elsif match = line.match(/^\s+DELETE\:\s(\d+).*/) delete_value = match[1].to_i end } puts "get.value #{get_value / interval.to_f}" puts "post.value #{post_value / interval.to_f}" puts "put.value #{put_value / interval.to_f}" puts "delete.value #{delete_value / interval.to_f}" end |