Skip to content

Instantly share code, notes, and snippets.

@jfqd
Created March 16, 2010 08:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jfqd/333747 to your computer and use it in GitHub Desktop.
Save jfqd/333747 to your computer and use it in GitHub Desktop.
Memcached Munin Plugin
#!/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