Skip to content

Instantly share code, notes, and snippets.

View pshima's full-sized avatar

Pete Shima pshima

View GitHub Profile

Runbook for X

What is happening?

Such and such service is probably having X, that means Y.

What is the user experience when this happens?

No users will be able to do anything.

haproxy_http_production:
command: /etc/sensu/plugins/haproxy/haproxy-metrics.rb -h my.hostname.com -q haproxy_stats -u username -p password -s my.hostname
handlers: ["graphite"]
interval: 60
subscribers: ["sensu_server"]
type: metric
memcached_graphite_production:
command: /etc/sensu/plugins/memcached/check-memcached-graphite.rb -h my.hostname -p 11211
handlers: ["graphite"]
@pshima
pshima / gist:2259915
Created March 31, 2012 06:18
Sensu Redis Metrics Run
redis = Redis.new(:host => config[:host], :port =>config[:port])
redis.info.each do |k, v|
output "#{config[:scheme]}.#{k}", v
end
@pshima
pshima / deploy_revision before_migrate
Created January 27, 2012 18:55 — forked from jbz/deploy_revision before_migrate
Bundler error inside deploy_revision before_migrate
before_migrate do
if app['main']['uses_bundler']
link "#{release_path}/vendor/bundle" do
to "#{app['main']['deploy_to']}/shared/vendor_bundle"
end
common_groups = %w{development test cucumber staging production}
execute "LANG=en_US.UTF-8 LC_ALL='en_US.UTF-8' bundle install --deployment --without #{(common_groups -([app['main']['rails_env']])).join(' ')}" do
ignore_failure true
cwd release_path
environment ({'LANG' => 'en_US.UTF-8'})
@pshima
pshima / unicorn.conf
Created December 15, 2011 07:03
Unicorn logrotate
/path/to/unicorn/log/unicorn.stderr.log
/path/to/production/log/production.log
{
daily
missingok
rotate 180
compress
dateext
# this is important if using "compress" since we need to call
@pshima
pshima / check_raindrops.rb
Created December 15, 2011 06:43
check_raindrops
# from https://github.com/petey5king/raindrops-nagios
#!/usr/bin/env ruby
#script to check the unicorn backlog
#requires the nagios gem, raindrops and rubygems
$LOAD_PATH.unshift '../lib'
require 'rubygems'
@pshima
pshima / nrpe.cfg
Created December 15, 2011 06:39
nrpe raindrops
command[check_raindrops]=/usr/lib/nagios/plugins/check_raindrops -w 512 -c 900
@pshima
pshima / nrpe.cfg
Created December 15, 2011 06:36
nrpe unicorn
command[check_unicorn]=/usr/lib/nagios/plugins/check_procs -c 1:24 -C unicorn
@pshima
pshima / nginx.conf
Created December 11, 2011 06:57
Nginx Config
location ~ ^/(images|assets|javascripts|stylesheets|fonts)/ {
try_files /$uri /oldassets/$uri =404;
expires 10y;
}
@pshima
pshima / deploy.rb
Created December 11, 2011 06:44
Capistrano asset hack
namespace :assets do
task :generate, :except => { :no_release => true }, :roles => :app do
desc "Asset copy"
run "mkdir #{release_path}/public/oldassets"
run "mkdir #{release_path}/public/oldassets/stylesheets"
run "mkdir #{release_path}/public/oldassets/javascripts"
run "cp -r #{deploy_to}/current/public/stylesheets/* #{release_path}/public/oldassets/stylesheets/"
run "cp -r #{deploy_to}/current/public/javascripts/* #{release_path}/public/oldassets/javascripts/"
end
end