Skip to content

Instantly share code, notes, and snippets.

View technovangelist's full-sized avatar

Matt Williams technovangelist

View GitHub Profile
@technovangelist
technovangelist / datadog-nginx
Last active April 25, 2017 20:35 — forked from gane5h/datadog-nginx
Nginx log parsing with datadog
"""
Thanks to gane5h for the original script. this is a small kludgy tweak to that one.
Custom parser for nginx log suitable for use by Datadog 'dogstreams'.
To use, add to datadog.conf as follows:
dogstreams: [path to ngnix log (e.g: "/var/log/nginx/access.log"]:[path to this python script (e.g "/usr/share/datadog/agent/dogstream/nginx.py")]:[name of parsing method of this file ("parse")]
so, an example line would be:
dogstreams: /var/log/nginx/access.log:/usr/share/datadog/agent/dogstream/nginx.py:parse
Log of nginx should be defined like that:
log_format time_log '$time_local "$request" S=$status $bytes_sent T=$request_time R=$http_x_forwarded_for';
when starting dd-agent, you can find the collector.log and check if the dogstream initialized successfully
@technovangelist
technovangelist / setup.md
Created February 12, 2016 23:17
Setting up Pushover.net and Datadog
  1. Create Pushover account
  2. Create a new Application in the Pushover site.
  3. You should now have a token and user id. You will need this for the webhook
  4. Go to the Datadog webhooks integration
  5. Enter Pushover for the name.
  6. Under URL enter `https://api.pushover.net/1/messages.json?token=YOURPUSHOVERAPPTOKEN&user=YOURPUSHOVERUSERID
  7. Under Custom Payload, enter {"title":"$EVENT_TITLE","message":"$EVENT_MSG"}
  8. Check both Use Custom Payload and Encode as form
  9. Create a monitor that notifies @webhook-pushover
  10. Boom, you are done
@technovangelist
technovangelist / gist:e60825c77fcbb082ae491a9723fd58b6
Created April 12, 2016 20:24
use the stress command to stress the cpu, io, disk, and memory a random amount every x seconds where x is a random number up to 20.
while sleep `shuf -i 0-10 -n 1`; do sudo stress -c `shuf -i 1-4 -n 1` -m `shuf -i 1-2 -n 1` -d `shuf -i 1-5 -n 1` -i `shuf -i 0-4 -n 1` -t `shuf -i 0-20 -n 1`s; done
- hosts: manager
become: yes
tasks:
- name: Initialize Docker Swarm
shell: docker swarm init --advertise-addr {{ ansible_eth1.ipv4.address}}
- hosts: manager
become: no
tasks:
- name: Capture Docker Swarm Join Command
$(function() {
var margin = { top: 300, right: 100, bottom: 100, left: 100 },
width = 1400 - margin.right - margin.left,
height = 1080 - margin.top - margin.bottom;
var parseTime = d3.timeParse("%H:%M:%S");
var x = d3.scaleTime().range([0, width]);
var y = d3.scaleLinear().range([height, 0]);
var log2y = d3.scaleLinear().range([height, 0]);
@technovangelist
technovangelist / gist:217d706332ff57a421af2693aeb0a771
Last active August 17, 2017 19:52
Great Sample Applications
https://github.com/dockersamples - Docker Compose and Swarm Samples
https://github.com/kubernetes/kubernetes/tree/master/examples - Example apps for K8s
https://github.com/elastic/examples
https://github.com/reactjs/redux/tree/master/examples
https://github.com/googlesamples
https://github.com/serverless/examples
https://github.com/graphcool-examples
https://github.com/RestDB/clientexamples
https://github.com/oracle/oracle-db-examples
https://github.com/electron/simple-samples
@technovangelist
technovangelist / init.lua
Created August 21, 2017 12:53
current (2017-08-21) hammerspoon config
local appfinder = require "hs.appfinder"
local app = require "hs.application"
local alive1 = hs.image.imageFromPath("~/bin/alive1.png")
local alive2 = hs.image.imageFromPath("~/bin/alive2.png")
alive = hs.menubar.new()
if alive then
alive:setIcon(alive2,false)
end
function updateAlive()
@technovangelist
technovangelist / keybase.md
Last active October 16, 2017 18:14
keybase.md

Keybase proof

I hereby claim:

  • I am technovangelist on github.
  • I am technovangelist (https://keybase.io/technovangelist) on keybase.
  • I have a public key ASAwAKX8y22VrWaIrmN3zWj8EVLsPqD5hFD8fk5-EGZMoQo

To claim this, I am signing this object: