Class: Bipbip::Plugin::Redis

Inherits:
Bipbip::Plugin show all
Defined in:
lib/bipbip/plugin/redis.rb

Instance Method Summary collapse

Methods inherited from Bipbip::Plugin

#initialize, #interrupt, #interrupted?, #metric_identifier, #metrics_names, #name, #run

Methods included from InterruptibleSleep

#interrupt_sleep, #interruptible_sleep

Constructor Details

This class inherits a constructor from Bipbip::Plugin

Instance Method Details

#metrics_schemaObject



9
10
11
12
13
14
# File 'lib/bipbip/plugin/redis.rb', line 9

def metrics_schema
  [
      {:name => 'total_commands_processed', :type => 'ce_counter', :unit => 'Commands'},
      {:name => 'used_memory', :type => 'ce_gauge', :unit => 'b'},
  ]
end

#monitor(server) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bipbip/plugin/redis.rb', line 16

def monitor(server)
  redis = RedisClient.new(
      :host => server['hostname'],
      :port => server['port']
  )
  stats = redis.info

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