Sha256: 8b2fb714e5045a54b301b02b9cf85272730fef1c143c01447d076df92dacba24

Contents?: true

Size: 854 Bytes

Versions: 3

Compression:

Stored size: 854 Bytes

Contents

#!/usr/bin/env ruby

# Gathers redis INFO statistics and submits them to Riemann.

require File.expand_path('../../lib/riemann/tools', __FILE__)

class Riemann::Tools::Redis
  include Riemann::Tools
  require 'redis'

  opt :redis_host, "Redis hostname", :default => 'localhost'
  opt :redis_port, "Redis port", :default => 6379
  opt :redis_password, "Redis password", :default => ''

  def initialize
    @redis = ::Redis.new(:host => opts[:redis_host], :port => opts[:redis_port])
    @redis.auth(opts[:redis_password]) unless opts[:redis_password] == ''
  end

  def tick
    @redis.info.each do |property, value|
      report(
        :host    => opts[:redis_host],
        :service => "redis #{property}",
        :metric  => value.to_f,
        :state   => 'ok',
        :tags    => ['redis']
      )
    end
  end

end

Riemann::Tools::Redis.run

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
riemann-tools-0.1.1 bin/riemann-redis
riemann-tools-0.1.0 bin/riemann-redis
riemann-tools-0.0.9 bin/riemann-redis