Skip to content

Instantly share code, notes, and snippets.

Changes in 2.2.26
Modified checks/__init__.py
diff --git a/checks/__init__.py b/checks/__init__.py
index 492733c..46f5ed3 100644
--- a/checks/__init__.py
+++ b/checks/__init__.py
@@ -53,12 +53,17 @@ class LaconicFilter(logging.Filter):
class Check(object):
"""
(Abstract) class for all checks with the ability to:
@alq666
alq666 / haproxy.awk
Created June 21, 2012 21:34
Simple haproxy parser
# 2012-06-21T06:49:34+00:00 localhost haproxy[14561]: 10.193.171.146:8047 [21/Jun/2012:06:49:34.002] public dogdispatcher/i-6529e303:9000 52/0/2/10/64 202 151 - - ---- 583/570/3/
# $4 source
# $7 backend/host:port
# $8 Tq/.../Tr/Tt
BEGIN {
}
{
# parse urls
split($(NF-1), p, "?");
url = p[1];
@alq666
alq666 / custom_event.rb
Created July 5, 2012 16:24
An example on using custom events, tags and aggregation
require 'rubygems'
require 'dogapi'
# Create a simple client
# The host is optional here, it's a shortcut to tie event and metrics to a given host
#
# You typically want to do:
# Dogapi::Client.new(your_actual_api_key_as_a_string, ...)
# We are using ENV to let you experiment via an environment variable.
dog = Dogapi::Client.new(ENV['DATADOG_KEY'])
@alq666
alq666 / gist:3060697
Created July 6, 2012 15:00
Datadog GPG Public Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.0.10
mQENBE2AOZoBCACzWTHwaCCaqAssCKt9B4qcLIlTbY8zC3ZfZvQ/spwjmpdCK5Ny4U8+WOll
yjeHL/oXb5qJRLf+KgGJW8Pa0OsVWO9puoW3bTs2VmgjOya7nbN9FHipbqJQVsMnbo12EPYt
jCfv8f/P4iRNYmv9cTOaCwssA19DnLxWfEzXEK8SNgRgKSPCEffyUc/TwBOAny2unJvTprPO
dfX7tsrECU6DroWd64y69d+TJ+3jHrOD3Dg1YpNOIFYJI6OfZT+zuAMc1ip7oHUAyHupGjpa
h05YjzFWYyoepR/5gCzNZTvuDMzDvD+S08K0cklwKMwXYtT3Zzx2MzstbsxVFOyA8/mVABEB
AAG0KERhdGFkb2cgUGFja2FnZXMgPHBhY2thZ2VAZGF0YWRvZ2hxLmNvbT6JAT4EEwECACgF
Ak2AOZoCGwMFCQWjmoAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJECJq6YDHp9pSObsH
@alq666
alq666 / test-git-receive-hook.md
Created July 9, 2012 22:10
post-receive git hook on the command line

Verify the git configuration

git config --get datadog.api
git config --get datadog.application

Both should return one key (API and application respectively).

Go to a git repo

cd my-git-repo
{"series":[{"metric":"response_code.httpd.403","points":[["1341860400","1"],["1341853200","1"],["1341838800","2"],["1341831600","1"],["1341835200","1"],["1341842400","1"],["1341849600","1"],["1341846000","2"],["1341856800","1"]],"type":"gauge","host":"Iadprod"},{"metric":"response_code.httpd.403","points":[["1341853200","5"],["1341831600","13"]],"type":"gauge","host":"Ordprod"},{"metric":"response_code.httpd.403","points":[["1341860400","1"],["1341885600","1"]],"type":"gauge","host":"Seaprod"},{"metric":"response_code.httpd.304","points":[["1341853200","27"],["1341867600","40"],["1341882000","462"],["1341824400","208"],["1341849600","24"],["1341828000","178"],["1341874800","195"],["1341810000","165"],["1341860400","13"],["1341885600","186"],["1341813600","211"],["1341831600","186"],["1341838800","247"],["1341835200","229"],["1341864000","19"],["1341892800","178"],["1341842400","211"],["1341878400","213"],["1341871200","50"],["1341820800","164"],["1341817200","160"],["1341846000","27"],["1341856800","24"],["13
@alq666
alq666 / bootstrap.sh
Created July 18, 2012 03:20
Raid0 bootstrap
# On EC2, /mnt is usually already on
mounted=$(mount | grep /mnt | wc -l)
if [ $mounted -eq 1 ]; then
umount -l /mnt
fi
# Install mdadm and xfsprogs unattended
DEBIAN_FRONTEND=noninteractive apt-get -y install mdadm xfsprogs
# Create a RAID0 volume with 256KiB stripes, ignore what's already on the device
@alq666
alq666 / build.py.diff
Created July 18, 2012 17:25
Patch for jenkins
diff --git a/checks/build.py b/checks/build.py
index 8563722..dbb75f8 100644
--- a/checks/build.py
+++ b/checks/build.py
@@ -38,6 +38,7 @@ class Hudson(object):
except ValueError:
raise Continue("Skipping non-timestamp dir: %s" % (dir_name))
else:
+ self.logger.debug("JENKINS path %s / ts %s / watermark %s" % (dir_name, timestamp, self.high_watermarks[job_name]))
# Check if it's a build we've seen already
@alq666
alq666 / gist:3174101
Created July 25, 2012 02:50
Datadog functions

A short introduction to Datadog functions

You can apply functions to metric queries in the graph editor, as long as you use the JSON editor.

The general format is:

function(metric{scope} [by {filter}])

In case of binary operators (+, -, /, *), the format is:

@alq666
alq666 / gist:3190186
Created July 27, 2012 20:04
Working around the supervisor bug in Natty

How to avoid the supervisor error on Ubuntu 11.04 (Natty Narwhal)

curl http://mirror.pnl.gov/ubuntu//pool/universe/p/python-meld3/python-meld3_0.6.5-3ubuntu1_amd64.deb > meld3.deb
sudo dpkg -i meld3.deb
sudo apt-get install datadog-agent