Repository
Munin (contrib)
Last change
2020-08-25
Graph Categories
Keywords
Language
Ruby

passenger_processes

Sadly there is no documentation for this plugin.

#!/usr/bin/env ruby
#
# [passenger_processes]
# user root
# env.process_stats_command /opt/ruby-enterprise-1.8.6-20080810/bin/passenger-status
#

process_stats_command = ENV['process_stats_command'] || '/opt/ruby-enterprise-1.8.6-20080810/bin/passenger-status'

if ARGV.length > 0 && ARGV[0] == 'config'
  puts 'graph_title Passenger Processes'
  puts 'graph_category webserver'
  puts 'graph_vlabel processes'
  puts 'max.label Max processes'
  puts 'count.label Total processes'
  puts 'active.label Active processes'
  puts 'queued.label Queued requests'
  exit(0)
end

max = nil
count = nil
active = nil
queued = nil

`#{process_stats_command}`.each_line do |line|
  case line
  when /max\s+=\s+(\d+)/
    max = $~[1]
  when /count\s+=\s+(\d+)/
    count = $~[1]
  when /^active\s+=\s+(\d+)/
    active = $~[1]
  when /Waiting on global queue\s+=\s+(\d+)/
    queued = $~[1]
  end
end

puts "max.value #{max}"
puts "count.value #{count}"
puts "active.value #{active}"
puts "queued.value #{queued.to_i}"