Skip to content

Instantly share code, notes, and snippets.

View technovangelist's full-sized avatar

Matt Williams technovangelist

View GitHub Profile
@technovangelist
technovangelist / tcp_check.yaml
Last active August 29, 2015 14:09
TCP Check
init_config:
instances:
- name: My service
host: datadog.com
port: 8080
window: 5
threshold: 3
@technovangelist
technovangelist / MyCustomCheck.py
Last active August 29, 2015 14:09
MyCustomCheck.py
from checks import AgentCheck
import re
import psutil
class CheckProcessNotRunning(AgentCheck):
def check(self, instance):
search = instance['search']
running_names = [p.name().strip() for p in psutil.process_iter()]
matched = len([n for n in running_names if re.match(search, n)])
@technovangelist
technovangelist / MyCustomCheck.yaml
Created November 9, 2014 22:35
MyCustomCheck.yaml
init_config:
instances:
- search: top
@technovangelist
technovangelist / http.go
Last active March 30, 2019 01:21
Trivial Expvar Sample Code
package main
import (
"expvar"
"github.com/paulbellamy/ratecounter"
"io"
"net/http"
"strconv"
"time"
)
@technovangelist
technovangelist / webtest.sh
Last active July 18, 2016 00:38
ZSH script to visit a page over and over again with random seconds between visits
#!/bin/zsh
# use webtest.sh <url to visit>
zmodload -i zsh/mathfunc
for i in {1..1000}
do
sleep $(( rand48()*2 ))
curl $1
done
@technovangelist
technovangelist / go_expvar.yaml
Created February 5, 2015 20:05
go_expvar.yaml Sample for Trivial Web App
init_config:
instances:
# Most memstats metrics are exported by default
# See http://godoc.org/runtime#MemStats for their explanation
- expvar_url: http://localhost:8000/debug/vars
tags:
- "application_name:myapp"
- "optionaltag2"
@technovangelist
technovangelist / dcomp.zsh
Last active August 29, 2015 14:16
docker-compose zsh function
dcomp(){
local bdout=$(boot2docker status) 2>/dev/null
if [ $bdout = 'poweroff' ]; then
boot2docker up && $(boot2docker shellinit)
fi
docker-compose $*
}
@technovangelist
technovangelist / dockerstop.zsh
Last active February 25, 2017 19:14
cron script to shutdown boot2docker
#!/bin/zsh
# set cron to run this every couple of minutes and it will shutdown boot2docker
# when its been running with no processes for maxminutes
maxminutes=10
local bdout
local dpqout
bdout=$(boot2docker status) 2>/dev/null
if [[ $bdout = "running" ]]; then
echo "boot2docker running"
from dogapi import dog_http_api as api
import console
import json
from StringIO import StringIO
api.api_key = 'apikey'
api.application_key = 'appkey'
board_id = console.input_alert('enter screenboard id')
@technovangelist
technovangelist / gist:ca8b01692459776d668f
Created July 9, 2015 13:47
Getting HTTPie working on the mac
1) Go to https://github.com/jkbrzt/httpie to get the full instructions on its use
2) Install it: brew install httpie
3) If you are on a Mac and have not upgraded your Python version install other stuff:
pip install --upgrade pyopenssl pyasn1 ndg-httpsclient
(I have the new 15" MBP with force touch trackpad so its as new as they get and I had to install this)
4) Use it....
If trying to use this to look at Docker Stats API, the command to use is going to be: