Class: Munin::PassengerMemoryStats
- Inherits:
-
RequestLogAnalyzerPlugin
- Object
- RequestLogAnalyzerPlugin
- Munin::PassengerMemoryStats
- Defined in:
- lib/munin/plugins/passenger_memory_stats.rb
Instance Attribute Summary
Attributes inherited from RequestLogAnalyzerPlugin
#debug, #environment, #graph_category, #passenger_memory_stats, #passenger_status
Instance Method Summary collapse
- #config ⇒ Object
- #ensure_configuration ⇒ Object
-
#run ⇒ Object
Collect the data
debug
Show debug information.
Methods inherited from RequestLogAnalyzerPlugin
#autoconf, #handle_arguments, #initialize, #require_command, #require_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
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/munin/plugins/passenger_memory_stats.rb', line 11 def config memory_info = open('/proc/meminfo', 'r') do |lines| lines.inject({}) do |h, line| matched = line.match(/^([\w_\(\)]+):\s+(\d+)/) h[matched[1].to_sym] = matched[2].to_i * 1024 h end end upper_limit = memory_info[:MemTotal] puts <<-CONFIG graph_category #{graph_category} graph_title Passenger memory stats graph_vlabel Bytes graph_args --base 1000 -l 0 --upper-limit #{upper_limit} graph_info The memory used by passenger instances on this application server memory.label memory CONFIG exit 0 end |
#ensure_configuration ⇒ Object
5 6 7 8 9 |
# File 'lib/munin/plugins/passenger_memory_stats.rb', line 5 def ensure_configuration require_passenger_memory_stats super end |
#run ⇒ Object
Collect the data debug
Show debug information
34 35 36 37 38 39 40 41 |
# File 'lib/munin/plugins/passenger_memory_stats.rb', line 34 def run stats = run_command(passenger_memory_stats, debug) #### Total private dirty RSS: 81.81 MB stats =~ /RSS:\s*([\d\.]+)\s*MB\Z/m memory = ($1.to_f * 1024 * 1024).to_i puts "memory.value #{memory}" end |