Sha256: 4aa12fed55929d10f3a71bd2fb403594eb4a4a1703e21512e0cfb70900080ce7
Contents?: true
Size: 910 Bytes
Versions: 14
Compression:
Stored size: 910 Bytes
Contents
# frozen_string_literal: true require 'riemann/tools' # Gathers memcached STATS and submits them to Riemann. module Riemann module Tools class Memcached include Riemann::Tools require 'socket' opt :memcached_host, 'Memcached hostname', default: 'localhost' opt :memcached_port, 'Memcached port', default: 11_211 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 end end end
Version data entries
14 entries across 14 versions & 1 rubygems