Skip to content

Instantly share code, notes, and snippets.



Forked from wmoxam/gist:37525
Created Dec 18, 2008
What would you like to do?
#!/usr/bin/env ruby
# Be sure to configure this node in the plugin configuration
# Memory stats must be run by root
# Ex:
# [passenger_memory]
# user root
# env.memory_stats_command path_to_passenger-memory-stats
memory_stats_command = ENV['memory_stats_command'] || '/opt/ruby-enterprise-1.8.6-20080810/bin/passenger-memory-stats'
if ARGV.length > 0 && ARGV[0] == 'config'
puts "graph_title Passenger Memory Usage"
puts "graph_vlabel apache_rss"
puts "apache_rss.label Apache Dirty RSS"
puts "graph_vlabel passenger_rss"
puts "passenger_rss.label Passenger Dirty RSS"
apache_rss = nil
passenger_rss = nil
`#{memory_stats_command}`.each_line do |line|
next unless /### Total private dirty RSS: (\d+\.\d+) MB/.match(line)
passenger_rss = $~[1] unless apache_rss.nil?
apache_rss ||= $~[1]
puts "apache_rss.value #{apache_rss}"
puts "passenger_rss.value #{passenger_rss}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.