Class: Riemann::Tools::Memcached
- Inherits:
-
Object
- Object
- Riemann::Tools::Memcached
- Includes:
- Riemann::Tools
- Defined in:
- lib/riemann/tools/memcached.rb
Constant Summary
Constants included from Riemann::Tools
Instance Attribute Summary
Attributes included from Riemann::Tools
Instance Method Summary collapse
Methods included from Riemann::Tools
#attributes, #endpoint_name, included, #initialize, #options, #report, #riemann, #run
Instance Method Details
#tick ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/riemann/tools/memcached.rb', line 15 def tick sock = TCPSocket.new(opts[:memcached_host], opts[:memcached_port]) sock.print("stats\r\n") sock.flush stats = sock.gets loop do stats = sock.gets break if stats.strip == 'END' m = stats.match(/STAT (\w+) (\S+)/) report( host: opts[:memcached_host].dup, service: "memcached #{m[1]}", metric: m[2].to_f, state: 'ok', tags: ['memcached'], ) end sock.close end |