Skip to content

Instantly share code, notes, and snippets.

View maguec's full-sized avatar

Chris Mague maguec

View GitHub Profile
@maguec
maguec / deplyable_gem.rb
Created October 5, 2011 04:34
Easy Rake file for building a deployable gem
task :default => :build_gem
##################################################################
def run_command(cmd)
cmdrun = IO.popen(cmd)
output = cmdrun.read
cmdrun.close
if $?.to_i > 0
puts "count not run #{cmd}, it returned an error #{output}"
exit 2
@maguec
maguec / gemspec_deployable.rb
Created October 5, 2011 04:37
example gemspec file
version = File.read("VERSION").strip
Gem::Specification.new do |s|
s.name = 'deployable_application'
s.version = version
s.platform = Gem::Platform::RUBY
s.summary = "an example of a project that can be deployed"
s.description = "Make something that can run in production"
s.author = "Joe Developer"
s.email = "github@example.com"
@maguec
maguec / wrapit.rb
Created April 13, 2012 22:04
simple agent wrapping a command
module MCollective
module Agent
class Wrapit < RPC::Agent
#####################################################################################
metadata :name => "My Agent",
:description => "Example of how to wrap a command",
:author => "Me <me@example.com>",
:license => "DWYWI",
:version => "0.1",
:url => "http://blog.mague.com",
@maguec
maguec / wrapit_client.rb
Created April 13, 2012 22:16
simple client for a wrapped command
#!/usr/bin/env ruby
require 'rubygems' if RUBY_VERSION < "1.9"
require 'mcollective'
include MCollective::RPC
args = {}
action=""
options = rpcoptions do |parser, options|
@maguec
maguec / squid_collectd.rb
Created March 16, 2013 17:36
A sample plugin to collect data from squid
#!/usr/bin/env ruby
require 'getoptlong'
require 'yaml'
#need to sync stdout with collectd execs!
$stdout.sync = true
if File.readable? '/etc/mcollective/facts.yaml'
facts=YAML::load(File.open('/etc/mcollective/facts.yaml'))
else
@maguec
maguec / gist:5177442
Created March 16, 2013 17:38
Example configuration for squid collectd exec
###############################################################
# Puppet Controlled Default Template
###############################################################
FQDNLookup false
LoadPlugin syslog
<Plugin syslog>
LogLevel info
</Plugin>
LoadPlugin cpu
LoadPlugin disk
@maguec
maguec / gist:5177489
Created March 16, 2013 17:50
Notes on installation of graphite
sudo apt-get install python-cairo python-memcache python-sqlite memcached python-django-tagging python-django libapache2-mod-python apache2 libapache2-mod-wsgi git-core python-pyparsing python-tz libdbd-mysql-perl libmysqlclient-dev libmysqlclient18 mysql-client-5.5 mysql-client-core-5.5 mysql-common python-mysqldb
mkdir -p /var/tmp/software
cd /var/tmp/software
git clone https://github.com/graphite-project/graphite-web.git
git clone https://github.com/graphite-project/carbon.git
git clone https://github.com/graphite-project/whisper.git
for i in whisper carbon graphite-web; do
### Keybase proof
I hereby claim:
* I am maguec on github.
* I am maguec (https://keybase.io/maguec) on keybase.
* I have a public key whose fingerprint is 713C 9A7F DD19 C992 3C2A F870 78B0 7C7D 855E B038
To claim this, I am signing this object:
input {
file {
path => "/home/chris/Code/LS_TEST/logstash-1.4.2/b.log"
type => "json_haproxy"
sincedb_path => "/tmp/since"
codec => "json"
}
}
#!/usr/bin/env ruby
require 'json'
require 'uri'
require 'yaml'
require 'net/http'
require 'getoptlong'
args = {
:yaml => false,