Skip to content

Instantly share code, notes, and snippets.

View christopher-b's full-sized avatar

Christopher Bennell christopher-b

View GitHub Profile
@christopher-b
christopher-b / passenger-statsd.rb
Last active December 15, 2015 10:39
Passenger - Statsd
#! /usr/bin/ruby
require 'socket'
statsd_host = ""
statsd_port = "8125"
namespace_prefix = "statsd-ruby"
mode = "statsd"
ARGV.each do |arg|
name, value = arg.split '='
@christopher-b
christopher-b / redis-graphite.rb
Last active December 11, 2015 17:39
Report Redis stats from (INFO) to Graphite
#!/usr/bin/env ruby
require 'socket'
require 'optparse'
# Collect INFO from Redis, report it to Graphite
opts = OptionParser.new do |opts|
opts.banner = "Usage: redis-graphite.rb redis-host[:redis-port] graphite-host"
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
require 'socket'
class Graphite
def initialize(host)
@host = host
end
def socket
return @socket if @socket && [email protected]?
@socket = TCPSocket.new(@host, 2003)