Skip to content

Instantly share code, notes, and snippets.

View bwhaley's full-sized avatar
🐋

Ben Whaley bwhaley

🐋
View GitHub Profile
@bwhaley
bwhaley / example_usage.py
Last active July 6, 2021 11:18
Python log handler for Sumo Logic HTTP source
import logging
import logging.config
import sumologger
from sumologger import SumoHTTPHandler
logging.config.dictConfig(sumologger.LOGGING)
logger = logging.getLogger("sumologger")
logger.debug("Nifty log message")
@bwhaley
bwhaley / gist:6471649
Last active July 22, 2019 23:40
Use this little script as EC2 User Data to install a Sumo Logic collector. Be sure to base64 encode it.
curl -o /tmp/sumo.sh https://collectors.sumologic.com/rest/download/linux/64
sh /tmp/sumo.sh -q -dir "/usr/local/SumoCollector"
/etc/init.d/collector stop
cat > /usr/local/SumoCollector/config/custom_sources.json << END
{
"api.version": "v1",
"sources": [
{
"sourceType": "LocalFile",
"name": "LocalAuth",
Metadata-Version: 1.0
Name: carbon
Version: <%=graphite_ver%>
Summary: Backend data caching and persistence daemon for Graphite
Home-page: https://launchpad.net/graphite
Author: Chris Davis
Author-email: chrismd@gmail.com
License: Apache Software License 2.0
Description: UNKNOWN
Platform: UNKNOWN
@bwhaley
bwhaley / error_log
Created February 12, 2013 19:58
gdash errors with ruby 1.8.7
NoMethodError - undefined method `decode_www_form' for URI:Module:
./lib/gdash/sinatra_app.rb:208:in `link_to_print'
/home/bwhaley/gdash/lib/gdash/../../views/layout.erb:40:in `evaluate_source'
/usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:144:in `cached_evaluate'
/usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:127:in `evaluate'
/usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:686:in `render'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:694:in `render'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:694:in `catch'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:694:in `render'
set nocompatible
syntax enable
set encoding=utf-8
set showcmd " display incomplete commands
filetype plugin indent on " load file type plugins + indentation
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces
set expandtab " use spaces, not tabs
@bwhaley
bwhaley / gist:3540423
Created August 30, 2012 20:43
collectd tcp connections exec script
#!/usr/bin/env ruby
require 'getoptlong'
PLUGIN_NAME = 'tcpconns'
def usage
puts("#{$0} -h <fqdn> [-i <sampling_interval>]")
exit
end
@bwhaley
bwhaley / gist:3540422
Created August 30, 2012 20:43
collectd tcp connections exec script
#!/usr/bin/env ruby
require 'getoptlong'
PLUGIN_NAME = 'tcpconns'
def usage
puts("#{$0} -h <fqdn> [-i <sampling_interval>]")
exit
end
@bwhaley
bwhaley / gist:3318910
Created August 10, 2012 23:21
post-receive hook for updating git repos on multiple puppet masters
#!/bin/sh
set -e
git-update-server-info
#
# Hook to update the /etc/puppet with the lastest git changes
#
# To enable this hook, rename this file to "post-receive".
read oldrev newrev refname