Created
March 16, 2010 08:07
-
-
Save jfqd/333747 to your computer and use it in GitHub Desktop.
Memcached Munin Plugin
This file contains 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 | |
# requirements: memcached and the memcache gem (sudo gem install memcache) | |
require 'rubygems' | |
require 'memcache' | |
HOST = ENV['HOST'].nil? ? '127.0.0.1' : ENV['HOST'] | |
PORT = ENV['PORT'].nil? ? 11211 : ENV['PORT'] | |
if ARGV.first == "config" | |
puts "graph_title Memcached - 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