-
-
Save xwmx/60808 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 MB" | |
puts "apache_rss.label Apache Dirty RSS" | |
puts "passenger_rss.label Passenger Dirty RSS" | |
exit(0) | |
end | |
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] | |
end | |
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