Skip to content

Instantly share code, notes, and snippets.

View phrawzty's full-sized avatar
🕺
probably karaoke

Daniel Maher phrawzty

🕺
probably karaoke
View GitHub Profile
#!/usr/bin/env bash
set -e
TFORM_VERSION="0.5.3_linux_amd64"
gem install puppet puppet-lint
puppet-lint --with-filename --no-80chars-check --no-autoloader_layout-check --fail-on-warnings puppet/
puppet parser validate `find puppet/ -name '*.pp'`
@phrawzty
phrawzty / check_repli.rb
Created February 18, 2011 15:20
Same as pyr's, but with Nagios-correct exit codes.
#!/usr/bin/env ruby
require 'mysql'
require 'yaml'
require 'optparse'
def parse argv
env = {:path => 'check_repli.yml'}
env[:path] = ENV['CHECK_REPLI_CONFIG'] if ENV.include? 'CHECK_REPLI_CONFIG'
@phrawzty
phrawzty / simple-nagios-json.rb
Created March 1, 2011 14:40
A simple Nagios plugin that makes an HTTP request and interprets a JSON response; implemented in Ruby - because why not? This is really more of a proof of concept than something super useful, so ymmv. ;)
#!/usr/bin/ruby1.9.1
# Nagios plugin that looks for some JSON or summat.
require 'json'
require 'net/http'
require 'uri'
require 'optparse'
@options = {}
@phrawzty
phrawzty / agentreload.rb
Created March 25, 2011 09:37
An MCollective agent to hot-reload MCollective agents (simple RPC-style)
module MCollective
module Agent
class agentreload<RPC::Agent
action 'reload' do
reload
end
private
def reload
@phrawzty
phrawzty / syslog
Created June 14, 2011 16:33
how to debug this mcollective error ?
2011-06-14T18:20:49.00000+02:00 [hostname.here] mcollectived[7774]: agents.rb:126:in `dispatch' Execution of test failed: Could not create instance of plugin test_agent: /usr/lib/ruby/1.8/mcollective/rpc/ddl.rb:46:in `initialize': (eval):57:in `initialize': compile error
2011-06-14T18:20:49.00000+02:00 [hostname.here] mcollectived[7774]: agents.rb:127:in `dispatch' /usr/lib/ruby/1.8/mcollective/pluginmanager.rb:69:in `[]'
2011-06-14T18:20:49.92722+02:00 [hostname.here] /usr/lib/ruby/1.8/mcollective/agents.rb: 103:in `timeout'
2011-06-14T18:20:49.92722+02:00 [hostname.here] /usr/lib/ruby/1.8/mcollective/agents.rb: 113:in `dispatch'
2011-06-14T18:20:49.92722+02:00 [hostname.here] /usr/lib/ruby/1.8/mcollective/agents.rb: 111:in `initialize'
2011-06-14T18:20:49.92722+02:00 [hostname.here] /usr/lib/ruby/1.8/mcollective/agents.rb: 111:in `new'
2011-06-14T18:20:49.92722+02:00 [hostname.here] /usr/lib/ruby/1.8/mcollective/agents.rb: 111:in `dispatch'
2011-06-14T18:20:49.92722+02:00 [hostname.here] /usr/li
@phrawzty
phrawzty / foo.ddl
Created June 20, 2011 10:36
MC "timeout" not being respected ?
metadata :name => 'Foo',
:description => 'foo foo foo',
:author => 'dan@plizy.com',
:license => 'other',
:version => '0.1',
:url => 'none',
:timeout => 30
action 'go', :description => 'waits for X seconds' do
input :time,
@phrawzty
phrawzty / Questions
Created September 7, 2011 13:46
GOTO Amsterdam
Day job: System Administration (with Devops tendencies).
What is your language of choice: Ruby (recently), Perl (traditionally).
Open Source contributions: Lots of little scripts, plugins, and so forth over the years.
How do you use GitHub: Handy way to maintain and distribute my modest contributions to the OSS community.
@phrawzty
phrawzty / pv.sh
Created September 8, 2011 14:03
Quick bash script to validate puppet manifests before committing them. Uses the puppet parser and the puppet-lint gem to do the actual validation. Uses rvm because that's what's sane. :P
#!/bin/bash
OLD=`rvm current`
source "$HOME/.rvm/scripts/rvm"
rvm use 1.8.7
gem list --local
puppet parser validate $1
puppet-lint $1
rvm use $OLD
@phrawzty
phrawzty / gist:1590203
Created January 10, 2012 17:47
GNU sort on Debian vs CentOS
$ cat sortme
1234
abcd
ABCD
***
:::
debian$ cat sortme | sort
:::
@phrawzty
phrawzty / key.pp
Created January 24, 2012 14:10
APT hooks for Puppet
# Shamelessly based on https://gist.github.com/844735
define apt::key (
$keyserv,
$ensure = present
) {
$grep_for_key = "apt-key finger | grep fingerprint | awk '{print \$10 \$11 \$12 \$13}' | grep '${name}'"
case $ensure {
present: {