This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get required build bits | |
yum install -y jdk jruby nodejs rpm-build | |
# setup jruby (add /opt/jruby/bin to your path) | |
jgem install fpm | |
# checkout statsd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [host "0.0.0.0"] | |
(tcp-server :host host) | |
(udp-server :host host) | |
(ws-server :host host)) | |
; keep data for 5 minutes, just throw into index | |
(let [index (default :ttl 300 (update-index (index))) | |
graph (graphite {:host "graphite.cf.ac.uk" | |
:protocol :udp | |
:pool-size 10})] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "logstash/inputs/base" | |
require "logstash/namespace" | |
# Read snmp trap messages as events | |
# | |
# Resulting @message looks like : | |
# #<SNMP::SNMPv1_Trap:0x6f1a7a4 @varbind_list=[#<SNMP::VarBind:0x2d7bcd8f @value="teststring", | |
# @name=[1.11.12.13.14.15]>], @timestamp=#<SNMP::TimeTicks:0x1af47e9d @value=55>, @generic_trap=6, | |
# @enterprise=[1.2.3.4.5.6], @source_ip="127.0.0.1", @agent_addr=#<SNMP::IpAddress:0x29a4833e @value="\xC0\xC1\xC2\xC3">, | |
# @specific_trap=99> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "logstash/outputs/base" | |
require "logstash/namespace" | |
# Push events to a RabbitMQ exchange using the (JRuby-only) hot_bunnies library. | |
# | |
# This has been tested with hot_bunnies 1.5.0. | |
# find links to both here: | |
# | |
# * RabbitMQ - <http://www.rabbitmq.com/> | |
# * Hot Bunnies - <https://github.com/ruby-amqp/hot_bunnies> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gem found matching: jruby-openssl (= 0.8.7) | |
Gem found matching: jruby-win32ole (>= 0) | |
Gem found matching: jdbc-mysql (>= 0) | |
Gem found matching: msgpack-jruby (>= 0) | |
Gem found matching: cinch (>= 0) | |
Gem found matching: spoon (>= 0) | |
Gem found matching: mocha (>= 0) | |
Gem found, but funky: shoulda (>= 0) (Unable to activate bourne-1.1.2, because mocha-0.13.3 conflicts with mocha (= 0.10.5)) | |
Gem found matching: rspec (>= 0) | |
Gem found matching: insist (= 0.0.8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run with "jruby --1.9 /path/to/this.rb" and wait 10 minutes | |
class Thing | |
def initialize | |
require 'cabin' | |
@logger = Cabin::Channel.new | |
sout = Logger.new(STDOUT) | |
@logger.level = :debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ range $index, $app := .Apps }} | |
listen {{ $app.EscapedId }}_{{ $app.ServicePort }} | |
bind *:{{ $app.ServicePort }} | |
mode http | |
{{ if $app.HealthCheckPath }} | |
option httpchk GET {{ $app.HealthCheckPath }} | |
{{ end }} | |
balance leastconn | |
capture request header X-Forwarded-For len 15 | |
{{ range $page, $task := .Tasks }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns tyrekick.core | |
(:use ring.adapter.jetty ring.util.response ring.middleware.json) | |
(:gen-class)) | |
(defn handler | |
"dead simple to get benchmark reqs/sec" | |
[request] | |
(response {:message "hello nasty"})) | |
(defn app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn widdershins [coll] | |
(letfn [(flip [tocoll fromcoll] | |
(if (empty? fromcoll) | |
tocoll | |
(flip (cons (first fromcoll) tocoll) (rest fromcoll)) | |
) | |
)] | |
(flip [] coll) | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@topcat logstash]# java -jar logstash-1.0.12-monolithic.jar agent -f logstash-simple.cnf | |
{:args=>["agent", "-f", "logstash-simple.cnf"]} | |
W, [2011-06-27T10:36:21.439000 #27280] WARN -- runner.class: Input #<LogStash::Inputs::Syslog:0x12297d7> shutting down | |
2011-06-27T09:36:21.991000Z syslog://10.1.2.3: <30>ntpd[3355]: synchronized to 1.2.3.4, stratum 2 | |
2011-06-27T09:36:22.631000Z syslog://10.2.32.2: <14>ncpd: cmd=0, len=14, data: BB BB 00 1C 00 00 00 00 1C 3F 00 00 00 00 | |
... | |
... | |
[root@topcat logstash]# cat logstash-simple.cnf | |
input { | |
syslog { |