-
-
Save stonegao/515473 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/ruby | |
| # memcached munin plugin | |
| require 'rubygems' | |
| require 'memcache' | |
| if ENV['HOST'].nil? or ENV['PORT'].nil? | |
| puts "Define a HOST and PORT!" | |
| Kernel.exit(1) | |
| end | |
| if ARGV.first == "config" | |
| puts "graph_title #{server_str} - items" | |
| puts 'graph_category Memcached' | |
| puts 'graph_vlabel Items' | |
| puts 'curr_items.label Current items' | |
| puts 'evictions.label Items ousted' | |
| else | |
| mem = Memcache::Server.new(:host => ENV['HOST'], :port => ENV['PORT']) | |
| stats_hash = mem.stats | |
| puts "curr_items.value #{stats_hash['curr_items']}" | |
| puts "evictions.value #{stats_hash['evictions']}" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment