Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:37542
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#!/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_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|
if /max\s+=\s+(\d+)/.match(line)
max = $~[1]
elsif /count\s+=\s+(\d+)/.match(line)
count = $~[1]
elsif /^active\s+=\s+(\d+)/.match(line)
active = $~[1]
elsif /Waiting on global queue\s+=\s+(\d+)/.match(line)
queued = $~[1]
end
end
 
puts "max.value #{max}"
puts "count.value #{count}"
puts "active.value #{active}"
puts "queued.value #{queued.to_i}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.