Skip to content

Instantly share code, notes, and snippets.

View darrikmazey's full-sized avatar

Darrik Mazey darrikmazey

  • DarmaSoft, LLC.
  • Akron, Ohio, U.S.A.
View GitHub Profile
#!/usr/bin/ruby
require 'json'
require 'net/http'
require 'uri'
require 'pp'
require 'date'
ELASTIC_BASE_URL = "http://localhost:9200"
RANDOM_INTERVAL = 14 * 60
description "start and stop riemann-rails-logs"
author "Gareth Rushgrove"
start on runlevel [2345]
stop on runlevel [!2345]
#respawn
#respawn limit 5 20
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/riemann-rails-logs.pid --chuid <%= @riemann_tools_user %> --exec /usr/local/bin/riemann-rails-logs -- --host <%= @riemann_host %> --port <%= @riemann_port %> <%= @tags.map { |t| "--tag \"#{t}\"" }.join(' ') if @tags.any? %> --event-host "`hostname -f | tr -d '[[:space:]]'`" --logfile /var/www/apps/<%= @rails_app %>/current/log/production.log --rails-app <%= @rails_app %> --ttl 60
#!/usr/bin/env ruby
require File.expand_path('../../lib/riemann/tools', __FILE__)
require 'rb-inotify'
class RequestQueue
def initialize(size = 100)
@max_size = size
@keys = []
@data = {}
@darrikmazey
darrikmazey / riemann.conf
Created November 3, 2015 15:31
riemann.conf
;;; include riemann-elastic plugin
(require '[riemann.elastic :as elastic])
;;; SNIP ;;;
(def elastic-url "http://SOME_IP:9200")
;;(def elastic-url "")
(def elastic-conn (when (seq elastic-url) (elastic/es-connect elastic-url)))

Keybase proof

I hereby claim:

  • I am darrikmazey on github.
  • I am darrik (https://keybase.io/darrik) on keybase.
  • I have a public key whose fingerprint is 2EAD 1DAF B611 2271 FCD2 5B66 E58F 8035 06A3 45C7

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am darrikmazey on github.
  • I am darrik (https://keybase.io/darrik) on keybase.
  • I have a public key whose fingerprint is A39E A366 7B6B 216D B3FE C765 5299 4F5B 9D2D 2DF1

To claim this, I am signing this object:

Core was generated by `/usr/bin/python2.7 examples/hello_world.py'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f1ce7fca488 in ?? () from /usr/lib64/libpython2.7.so.1.0
(gdb) bt
#0 0x00007f1ce7fca488 in ?? () from /usr/lib64/libpython2.7.so.1.0
#1 0x00007f1ce7fcddc2 in PyObject_CallFunctionObjArgs () from /usr/lib64/libpython2.7.so.1.0
#2 0x00007f1ce2eb314e in __Pyx_Import(_object*, _object*, int) () from /usr/lib64/python2.7/site-packages/libopenzwave-0.3.0b1-py2.7-linux-x86_64.egg/libopenzwave.so
#3 0x00007f1ce2e981ae in initlibopenzwave () from /usr/lib64/python2.7/site-packages/libopenzwave-0.3.0b1-py2.7-linux-x86_64.egg/libopenzwave.so
#4 0x00007f1ce8074a49 in _PyImport_LoadDynamicModule () from /usr/lib64/libpython2.7.so.1.0
#5 0x00007f1ce8072c39 in ?? () from /usr/lib64/libpython2.7.so.1.0
This file has been truncated, but you can view the full file.
execve("/usr/bin/python", ["python", "examples/hello_world.py"], [/* 45 vars */]) = 0
brk(0) = 0xacd000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4e242f6000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=147009, ...}) = 0
mmap(NULL, 147009, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4e242d2000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\33\2\0\0\0\0\0"..., 832) = 832
(def elastic-url "http://x.x.x.x:9200")
(def elastic-conn (when (seq elastic-url) (elastic/es-connect elastic-url)))
(def es-index
(let [sinks (if elastic-conn
[(async-queue! :elastic-search
{:queue-size 40000 :core-pool-size 30}
(batch 300 15 (elastic/es-index "riemann-elastic" :index "riemann")))]
[])]
(fn [e]
@darrikmazey
darrikmazey / silence.clj
Created April 8, 2015 13:58
silence function
(defn silenced?
"has this host been manually silenced?"
[host]
(info "*** silenced? " host)
(->> (list 'and (list '= 'host host)
'(= service "silenced"))
(riemann.index/search (:index @core))
first
:state
(= "silence")))