Class: Munin::PassengerStatus

Inherits:
RequestLogAnalyzerPlugin show all
Defined in:
lib/munin/plugins/passenger_status.rb

Instance Attribute Summary

Attributes inherited from RequestLogAnalyzerPlugin

#debug, #environment, #graph_category, #passenger_memory_stats, #passenger_status

Instance Method Summary collapse

Methods inherited from RequestLogAnalyzerPlugin

#autoconf, #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



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/munin/plugins/passenger_status.rb', line 10

def config
  status = `#{passenger_status}`

  status =~ /max\s+=\s+(\d+)/
  upper_limit = $1 || 150

  puts "graph_category \#{graph_category}\ngraph_title Passenger status\ngraph_vlabel count\ngraph_args --base 1000 -l 0 --upper-limit \#{upper_limit}\ngraph_info The amount of active passengers on this application server - railsdoctors.com\n\nsessions.label sessions\nmax.label max processes\nrunning.label running processes\nactive.label active processes\n"
  exit 0
end

#ensure_configurationObject



5
6
7
8
# File 'lib/munin/plugins/passenger_status.rb', line 5

def ensure_configuration
  require_passenger_status
  super
end

#runObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/munin/plugins/passenger_status.rb', line 31

def run
  status = run_command(passenger_status, debug)

  status =~ /max\s+=\s+(\d+)/
  puts "max.value #{$1}"

  status =~ /count\s+=\s+(\d+)/
  puts "running.value #{$1}"

  status =~ /active\s+=\s+(\d+)/
  puts "active.value #{$1}"

  total_sessions = 0
  status.scan(/Sessions: (\d+)/).flatten.each { |count| total_sessions += count.to_i }
  puts "sessions.value #{total_sessions}"
end