Sha256: 4b763722a232dc96de854694ef21822115f05b2f17fc261a618864b158cb38e3
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
#! /usr/bin/env ruby # # check-memcached-stats # # DESCRIPTION: # Check Memcached stats # # OUTPUT: # metric data # # PLATFORMS: # Linux # # DEPENDENCIES: # gem: sensu-plugin # gem: socket # # USAGE: # #YELLOW # # NOTES: # # LICENSE: # Copyright 2012 AJ Christensen <aj@junglist.gen.nz> # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # require 'sensu-plugin/check/cli' require 'socket' require 'timeout' class MemcachedStats < Sensu::Plugin::Check::CLI option :host, short: '-h HOST', long: '--host HOST', description: 'Memcached Host to connect to', required: false, default: '127.0.0.1' option :port, short: '-p PORT', long: '--port PORT', description: 'Memcached Port to connect to', proc: proc(&:to_i), default: 11_211 def run Timeout.timeout(30) do TCPSocket.open(config[:host], config[:port]) do |socket| socket.print "stats\r\n" socket.close_write socket.read end end rescue Timeout::Error warning "timed out connecting to memcached on port #{config[:port]}" rescue critical "Can't connect to port #{config[:port]}" else ok 'memcached stats protocol responded in a timely fashion' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sensu-plugins-memcached-0.0.3 | bin/check-memcached-stats.rb |
sensu-plugins-memcached-0.0.2 | bin/check-memcached-stats.rb |