Class: Munin::RailsRequestError

Inherits:
RailsPlugin show all
Defined in:
lib/munin/plugins/rails_request_error.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

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

#configObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/munin/plugins/rails_request_error.rb', line 5

def config
  puts <<-CONFIG
graph_category #{graph_category}
graph_title Request errors
graph_vlabel Count
graph_info The amount of request errors - railsdoctors.com

error.label error
blocker.label blocker
CONFIG
  exit 0
end

#runObject

Gather information



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/munin/plugins/rails_request_error.rb', line 19

def run
  ensure_log_file

  # Initialize values
  error_value = 0
  blocker_value = 0

  rla = parse_request_log_analyzer_data

  if rla && rla["Failed requests"]
    rla["Failed requests"].each do |item|
      error_value += item[1]
    end
  end

  if rla && rla["Process blockers (> 1 sec duration)"]
    rla["Process blockers (> 1 sec duration)"].each do |item|
      blocker_value += item[1]
    end
  end

  puts "error.value #{error_value}"
  puts "blocker.value #{blocker_value}"
end