Skip to content

Instantly share code, notes, and snippets.

@PaulusTM
Created October 26, 2011 17:30
Show Gist options
  • Save PaulusTM/1317085 to your computer and use it in GitHub Desktop.
Save PaulusTM/1317085 to your computer and use it in GitHub Desktop.
passenger memory stats for munin
#!/usr/bin/env ruby
# by Daniel Paulus | 27 - 10 - 2011
#
# put in /etc/munin/plugins/passenger_memory_stats
# chmod a+x /usr/share/munin/plugins/passenger_memory_stats
#
# add this to /etc/munin/plugin-conf.d/munin-node:
# [passenger_*]
# user root
# command ruby %c
#
# restart munin-node
def output_config
puts <<-END
graph_category Passenger
graph_title Passenger memory stats
graph_vlabel count
memory.label memory
END
exit 0
end
def output_values
status = `/home/rails/.rvm/gems/ree-1.8.7-2011.03/gems/passenger-3.0.7/bin/passenger-memory-stats | tail -1`
unless $?.success?
$stderr.puts "failed executing passenger-memory-stats"
exit 1
end
status =~ /(\d+\.\d+)/
puts "memory.value #{$1}"
end
if ARGV[0] == "config"
output_config
else
output_values
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment