class Bipbip::Plugin::Memcached

Public Instance Methods

metrics_schema() click to toggle source
# File lib/bipbip/plugin/memcached.rb, line 7
def metrics_schema
  [
    { name: 'cmd_get', type: 'counter' },
    { name: 'cmd_set', type: 'counter' },
    { name: 'get_misses', type: 'counter' },
    { name: 'bytes', type: 'gauge', unit: 'b' },
    { name: 'evictions', type: 'counter' }
  ]
end
monitor() click to toggle source
# File lib/bipbip/plugin/memcached.rb, line 17
def monitor
  memcached = MemcachedClient.new(config['hostname'].to_s + ':' + config['port'].to_s)
  stats = memcached.stats
  memcached.quit

  data = {}
  metrics_names.each do |key|
    data[key] = stats[key.to_sym].shift.to_i
  end
  data
end