Skip to content

Instantly share code, notes, and snippets.

View joemiller's full-sized avatar

joe miller joemiller

View GitHub Profile
@joemiller
joemiller / sensu.clj-project
Created April 3, 2012 01:40
experimenting with omnibus for packaging sensu
;; put this in omnibus/config/project
(project "sensu" "0.9.5" "1"
:build-order [ "prep" "autoconf" "zlib" "openssl" "ruby" "sensu" ])
@joemiller
joemiller / Rakefile
Created April 4, 2012 15:07
early work on Rake-based DSL for building 'fat' packages (primarily for use by Sensu)
require_relative 'software'
require_relative 'package'
BUILD_DIR='/tmp/testing'
INSTALL_DIR='/opt/sensu'
Dir['*.rake'].each { |f| import f }
Fatty::Software.new do |t|
t.name = 'sensu'
@joemiller
joemiller / Rakefile
Created April 11, 2012 21:36
bunchr ('omnibus') rake based dsl example. close to stable/final for 0.0.1.
$: << File.join(File.dirname(__FILE__), 'lib')
require 'bunchr'
# these global vars are used throughout our *.rake recipes
BUILD_DIR='/tmp/testing'
INSTALL_DIR='/opt/sensu'
# load up all of the *.rake recipes
Dir['*.rake'].each { |f| import f }
@joemiller
joemiller / sensu_test_install.sh
Created April 12, 2012 01:43
script to setup a sensu client and server for quick testing
#!/bin/sh
#
# The purpose of this script is to setup all the pre-reqs needed to
# standup a quick single-node Sensu client + server for use during
# testing.
#
# I don't recommend using this for a production setup, but if you must,
# then you should replace the SSL keys and certs with your own.
# You can use the script from this repo to help with SSL certs:
# https://github.com/joemiller/joemiller.me-intro-to-sensu
@joemiller
joemiller / go.sh
Created April 20, 2012 14:02
parallel provisioning with Vagrant
#!/bin/sh
# concurrency is hard, let's have a beer
MAX_PROCS=4
parallel_provision() {
while read box; do
echo "Provisioning '$box'. Output will be in: $box.out.txt" 1>&2
echo $box
@joemiller
joemiller / Rakefile
Created April 20, 2012 14:57
omnibus ruby with bunchr and fpm
require 'bunchr'
Bunchr.build_dir = '/tmp/build'
Bunchr.install_dir = '/opt/ruby'
Bunchr.load_recipes Dir['recipes/**/*.rake']
# put together all the Software objects from the *.rake recipes and bunch
# them together into whatever packages this platform supports (tar, rpm, deb)!
Bunchr::Packages.new do |t|
@joemiller
joemiller / jenkins_silence.rb
Created May 8, 2012 20:41
example ruby for silencing checks in Sensu
#!/usr/bin/env ruby
require 'em-http-request'
require 'json'
servers = ["mysql01", "rabbitmq01",
"riak01", "api01", "web01",
"widgets01", "app01", "app02"]
pending = servers.length
EM.run {
@joemiller
joemiller / sensu_playbook_coverage.rb
Created June 25, 2012 22:09
script to check your sensu playbook url coverage
#!/usr/bin/env ruby
#
# Sensu Check Playbook Audit
# ==========================
#
# All monitors should have a documentation page (eg: wiki) so that team members
# know what to do when they're paged to deal with a particular alert. This
# script is intendend to help you find the 'playbook coverage' of your
# sensu infrastructure.
#
@joemiller
joemiller / gist:3079026
Created July 9, 2012 21:21
screencap of building sensu v0.9.6 packages with sensu-build.git toolset

commands to start the build:

joes-imac:sensu-build jmiller$ export SENSU_GIT_REF=v0.9.6 ; export BUILD_NUMBER=1

joes-imac:sensu-build jmiller$ time ./para-vagrant.sh 

and the output:

@joemiller
joemiller / gist:3125370
Created July 16, 2012 22:05
sketching ideas for sensu transformers
"handlers": {
"default": {
"type": "set",
"handlers": [
"stdout"
]
},
"stdout": {
"type": "pipe",
"command": "./test/handlers/stdout.rb"