Skip to content

Instantly share code, notes, and snippets.

View phobos182's full-sized avatar

Jeremy Carroll phobos182

View GitHub Profile
@phobos182
phobos182 / diamond.conf
Created November 20, 2012 22:47
Diamond Upstart File
# diamond - A system statistics collector for graphite
#
# Diamond is a daemon and toolset for gather system statistics
# and publishing them to graphite.
description "Diamond system statistics collector"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]
@phobos182
phobos182 / diamond
Created November 20, 2012 21:57
diamond init script
#!/usr/bin/env python
import os
import sys
import configobj
import pwd
import grp
for path in [
os.path.join('opt', 'diamond', 'lib'),
@phobos182
phobos182 / alert.py
Created October 29, 2012 20:29
Server alert api
#!/usr/bin/env python
# Sample
from jira.client import JIRA
from optparse import OptionParser
from pagerduty import *
import hashlib
import hipchat
import simplejson as json
import socket
@phobos182
phobos182 / kafka_consumer.py
Created October 22, 2012 15:07
Kafka Graphite Consumer
#!/usr/bin/env python
from optparse import OptionParser
from brod.zk import *
import pickle
import struct
import socket
import sys
import time
@phobos182
phobos182 / kafka_consumer.py
Created October 22, 2012 14:57
Kafka Graphite Consumer
#!/usr/bin/env python
from optparse import OptionParser
from brod.zk import *
import pickle
import struct
import socket
import sys
import time
@phobos182
phobos182 / kafka_graphite.py
Created October 18, 2012 00:04
Kafka Pickle Consumer
#!/usr/bin/env python
from optparse import OptionParser
from brod.zk import ZKConsumer
import time
import socket
import struct
import sys
import pickle
@phobos182
phobos182 / gist:3907066
Created October 17, 2012 18:01
opentsdb
zk.avg_latency 3 1350496873 host=zk1 cluster=harmony
zk.min_latency 0 1350496873 host=zk1 cluster=harmony
zk.max_latency 2727 1350496873 host=zk1 cluster=harmony
zk.node_count 4962 1350496873 host=zk1 cluster=harmony
zk.outstanding 1 1350496873 host=zk1 cluster=harmony
zk.received 1545094053 1350496873 host=zk1 cluster=harmony
zk.sent 1545328416 1350496873 host=zk1 cluster=harmony
@phobos182
phobos182 / opentsdb.rb
Created October 17, 2012 17:58
OpenTSDB Handler
#!/usr/bin/env ruby
#
# OpenTSDB TCP handler
# ===
#
# This handler sends metrics to a OpenTSDB server via
# TCP socket.
#
# Compatible checks should generate output in the format:
# metric.path.one timestamp value host=fqdn\n
#_ FIRST RUN _#
root@server:~# puppet agent -t
info: Retrieving plugin
info: Caching catalog for server
info: Applying configuration version '1345065227'
notice: /Stage[main]/Test/File[/tmp/myfile]/content:
--- /tmp/myfile 2012-08-15 21:18:04.816031799 +0000
+++ /tmp/puppet-file20120815-627-do01b1-0 2012-08-15 21:18:32.011877658 +0000
## These patterns were tested w/ haproxy-1.4.15
## Documentation of the haproxy log formats can be found at the following links:
## http://code.google.com/p/haproxy-docs/wiki/HTTPLogFormat
## http://code.google.com/p/haproxy-docs/wiki/TCPLogFormat
HAPROXYTIME (?!<[0-9])%{HOUR:haproxy_hour}:%{MINUTE:haproxy_minute}(?::%{SECOND:haproxy_second})(?![0-9])
HAPROXYDATE %{MONTHDAY:haproxy_monthday}/%{MONTH:haproxy_month}/%{YEAR:haproxy_year}:%{HAPROXYTIME:haproxy_time}.%{INT:haproxy_milliseconds}
# Override these default patterns to parse out what is captured in your haproxy.cfg